GNU bug report logs - #40940
27.0.91; project-query-replace-regexp stops too early

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> runbox.com>

Date: Tue, 28 Apr 2020 14:57:02 UTC

Severity: normal

Found in version 27.0.91

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: dgutov <at> yandex.ru
Cc: simenheg <at> runbox.com, monnier <at> IRO.UMontreal.CA, 40940 <at> debbugs.gnu.org
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 <at> gnu.org>
> Cc: simenheg <at> runbox.com, monnier <at> IRO.UMontreal.CA, 40940 <at> 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




This bug report was last modified 5 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.