From 20228dd981f4467be1033dfad1cfe13d2aa9be9b Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 14 Feb 2026 12:42:37 +0200 Subject: 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. --- CHANGELOG.md | 2 ++ projectile.el | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) 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 ;; -- cgit v1.0