aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-02-14 12:42:37 +0200
committerBozhidar Batsov <bozhidar@batsov.dev>2026-02-14 12:42:37 +0200
commit20228dd981f4467be1033dfad1cfe13d2aa9be9b (patch)
tree5741de529edc6a633ae7be34e4b758e5d4957f92
parenta7223f2015b7d3bd7930997f9966c92b1cd83471 (diff)
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.
-rw-r--r--CHANGELOG.md2
-rw-r--r--projectile.el3
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8832897..4f0b0a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@
### Bugs fixed
+* [#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.
+* [#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+.
* [#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).
* [#1873](https://github.com/bbatsov/projectile/issues/1873): Skip unreadable directories during native indexing instead of aborting with a permission error.
* [#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).
diff --git a/projectile.el b/projectile.el
index 1f52080..ed78865 100644
--- a/projectile.el
+++ b/projectile.el
@@ -4960,9 +4960,10 @@ on which to run the replacement."
(projectile-prepend-project-name
(format "Replace %s with: " old-text))))
(files (projectile-files-with-string old-text directory file-ext)))
+ (require 'fileloop nil t)
(if (fboundp #'fileloop-continue)
;; Emacs 27+
- (progn (fileloop-initialize-replace old-text new-text files 'default)
+ (progn (fileloop-initialize-replace (regexp-quote old-text) new-text files 'default)
(fileloop-continue))
;; Emacs 25 and 26
;;