emacs-diffs
[Top][All Lists]
Advanced

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

master 840b1c6: Use save-mark-and-excursion in query-replace-read-args (


From: Juri Linkov
Subject: master 840b1c6: Use save-mark-and-excursion in query-replace-read-args (bug#45617)
Date: Fri, 29 Jan 2021 03:55:36 -0500 (EST)

branch: master
commit 840b1c66b4a686763c9288de8efb7ec48ccf06da
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Use save-mark-and-excursion in query-replace-read-args (bug#45617)
---
 lisp/replace.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lisp/replace.el b/lisp/replace.el
index cbf24be..f13d27a 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -343,14 +343,15 @@ Prompt with PROMPT.  REGEXP-FLAG non-nil means the 
response should a regexp."
 (defun query-replace-read-args (prompt regexp-flag &optional noerror)
   (unless noerror
     (barf-if-buffer-read-only))
-  (let* ((from (query-replace-read-from prompt regexp-flag))
-        (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
-              (query-replace-read-to from prompt regexp-flag))))
-    (list from to
-         (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
-              (and (plist-member (text-properties-at 0 from) 
'isearch-regexp-function)
-                   (get-text-property 0 'isearch-regexp-function from)))
-         (and current-prefix-arg (eq current-prefix-arg '-)))))
+  (save-mark-and-excursion
+    (let* ((from (query-replace-read-from prompt regexp-flag))
+           (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
+                 (query-replace-read-to from prompt regexp-flag))))
+      (list from to
+            (or (and current-prefix-arg (not (eq current-prefix-arg '-)))
+                (and (plist-member (text-properties-at 0 from) 
'isearch-regexp-function)
+                     (get-text-property 0 'isearch-regexp-function from)))
+            (and current-prefix-arg (eq current-prefix-arg '-))))))
 
 (defun query-replace (from-string to-string &optional delimited start end 
backward region-noncontiguous-p)
   "Replace some occurrences of FROM-STRING with TO-STRING.



reply via email to

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