GNU bug report logs -
#40940
27.0.91; project-query-replace-regexp stops too early
Previous Next
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
Message #104 received at 40940 <at> debbugs.gnu.org (full text, mbox):
On 02.05.2020 09:44, Eli Zaretskii wrote:
> I can update the doc string, yes. But I don't think it's a good idea
> to divide the coding part between us, though. So please show the
> code, and I will suggest the doc change.
Here's the comprehensive fix I'd like to see:
diff --git a/lisp/fileloop.el b/lisp/fileloop.el
index 543963feaf..69825fdcae 100644
--- a/lisp/fileloop.el
+++ b/lisp/fileloop.el
@@ -181,8 +181,7 @@ fileloop-initialize-search
(fileloop-initialize
files
(lambda ()
- (let ((case-fold-search
- (if (memq case-fold '(t nil)) case-fold case-fold-search)))
+ (let ((case-fold-search (fileloop--case-fold regexp case-fold)))
(re-search-forward regexp nil t)))
(lambda ()
(unless (eq last-buffer (current-buffer))
@@ -190,6 +189,15 @@ fileloop-initialize-search
(message "Scanning file %s...found" buffer-file-name))
nil))))
+(defun fileloop--case-fold (regexp case-fold)
+ (let ((value
+ (if (memql case-fold '(nil t))
+ case-fold
+ case-fold-search)))
+ (if (and value search-upper-case)
+ (isearch-no-upper-case-p regexp t)
+ value)))
+
;;;###autoload
(defun fileloop-initialize-replace (from to files case-fold &optional
delimited)
"Initialize a new round of query&replace on several files.
@@ -203,15 +211,15 @@ fileloop-initialize-replace
(fileloop-initialize
files
(lambda ()
- (let ((case-fold-search
- (if (memql case-fold '(nil t)) case-fold case-fold-search)))
+ (let ((case-fold-search (fileloop--case-fold from case-fold)))
(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 (fileloop--case-fold from case-fold)))
+ (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.