bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#40940: 27.0.91; project-query-replace-regexp stops too early


From: Eli Zaretskii
Subject: bug#40940: 27.0.91; project-query-replace-regexp stops too early
Date: Wed, 29 Apr 2020 13:41:50 +0300

> Date: Wed, 29 Apr 2020 12:24:36 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: simenheg@runbox.com, monnier@IRO.UMontreal.CA, 40940@debbugs.gnu.org
> 
> First, this is broken if the shell doesn't expand ~/ or if the Emacs
> notion of the home directory is different from that of the shell.

The patch below seems to fix the rest.  Note that I've decided to make
the change in fileloop.el, since I think all the other callers need
the same fix.  Also, using downcase is not entirely correct, we should
use isearch-no-upper-case-p instead.

Comments?

diff --git a/lisp/fileloop.el b/lisp/fileloop.el
index 543963f..f7a199e 100644
--- a/lisp/fileloop.el
+++ b/lisp/fileloop.el
@@ -204,14 +204,24 @@ fileloop-initialize-replace
    files
    (lambda ()
      (let ((case-fold-search
-            (if (memql case-fold '(nil t)) case-fold case-fold-search)))
+            (if (memql case-fold '(nil t))
+                case-fold
+              (if (equal from (downcase from))
+                  case-fold-search
+                nil))))
        (if (re-search-forward from nil t)
           ;; When we find a match, move back
           ;; to the beginning of it so perform-replace
           ;; will see it.
           (goto-char (match-beginning 0)))))
    (lambda ()
-     (perform-replace from to t t delimited nil multi-query-replace-map))))
+     (let ((case-fold-search
+            (if (memql case-fold '(nil t))
+                case-fold
+              (if (equal from (downcase from))
+                  case-fold-search
+                nil))))
+       (perform-replace from to t t delimited nil multi-query-replace-map)))))
 
 (provide 'fileloop)
 ;;; fileloop.el ends here





reply via email to

[Prev in Thread] Current Thread [Next in Thread]