Skip to content

Commit 20228dd

Browse files
committed
Fix projectile-replace on Emacs 27+ (#1748, #1741)
Two bugs in projectile-replace: 1. fileloop is autoloaded but never required, so (fboundp #'fileloop-continue) returns nil and the function falls back to the legacy Emacs 25/26 code path even on Emacs 27+. Fix by requiring fileloop before the check. 2. fileloop-initialize-replace expects a regexp, but projectile-replace is documented to do literal replacement. Fix by wrapping the search term with regexp-quote.
1 parent a7223f2 commit 20228dd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs fixed
1010

11+
* [#1748](https://github.com/bbatsov/projectile/issues/1748): Fix `projectile-replace` falling back to the legacy Emacs 25/26 code path on Emacs 27+ because `fileloop` was not loaded.
12+
* [#1741](https://github.com/bbatsov/projectile/issues/1741): Fix `projectile-replace` treating the search string as a regexp instead of a literal string on Emacs 27+.
1113
* [#1897](https://github.com/bbatsov/projectile/issues/1897): Filter deleted-but-unstaged files from `git ls-files` output in alien/hybrid indexing (when `fd` is not used).
1214
* [#1873](https://github.com/bbatsov/projectile/issues/1873): Skip unreadable directories during native indexing instead of aborting with a permission error.
1315
* [#1961](https://github.com/bbatsov/projectile/issues/1961): Prevent directories from matching file-type project root markers (e.g., a `workspace` directory no longer matches the `WORKSPACE` Bazel marker on case-insensitive filesystems).

projectile.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4960,9 +4960,10 @@ on which to run the replacement."
49604960
(projectile-prepend-project-name
49614961
(format "Replace %s with: " old-text))))
49624962
(files (projectile-files-with-string old-text directory file-ext)))
4963+
(require 'fileloop nil t)
49634964
(if (fboundp #'fileloop-continue)
49644965
;; Emacs 27+
4965-
(progn (fileloop-initialize-replace old-text new-text files 'default)
4966+
(progn (fileloop-initialize-replace (regexp-quote old-text) new-text files 'default)
49664967
(fileloop-continue))
49674968
;; Emacs 25 and 26
49684969
;;

0 commit comments

Comments
 (0)