]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new optional argument NO-HIGHLIGHT to query-replace-read-args
authorVisuwesh <visuweshm@gmail.com>
Sun, 28 Jul 2024 04:57:33 +0000 (10:27 +0530)
committerEshel Yaron <me@eshelyaron.com>
Mon, 29 Jul 2024 17:16:29 +0000 (19:16 +0200)
* lisp/replace.el (query-replace-read-args): Add new optional
argument to disable regexp highlighting.

* lisp/dired-aux.el (dired-do-query-replace-regexp)
(dired-do-replace-regexp-as-diff)
(dired-do-find-regexp-and-replace): Revert last change, and use
the new argument instead.  (bug#72147)

(cherry picked from commit 99704a7b41f9c3c6c2215cf5c47bc161df05cfa4)

lisp/dired-aux.el
lisp/replace.el

index b7a12c6280efe56cdc4c790556b706ef4b6cb556..642633caf68f1ed1fd3632e649680544d5a7c13f 100644 (file)
@@ -3787,10 +3787,9 @@ Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
 If you exit the query-replace loop (\\[keyboard-quit], RET or q), you can
 resume the query replace with the command \\[fileloop-continue]."
   (interactive
-   (let* ((query-replace-lazy-highlight)
-          (common
-          (query-replace-read-args
-           "Query replace regexp in marked files" t t)))
+   (let ((common
+         (query-replace-read-args
+          "Query replace regexp in marked files" t t t)))
      (list (nth 0 common) (nth 1 common) (nth 2 common)))
    dired-mode)
   (dolist (file (dired-get-marked-files nil nil #'dired-nondirectory-p nil t))
@@ -3812,10 +3811,9 @@ Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
 The replacements are displayed in the buffer *replace-diff* that
 you can later apply as a patch after reviewing the changes."
   (interactive
-   (let* ((query-replace-lazy-highlight)
-          (common
-           (query-replace-read-args
-            "Replace regexp as diff in marked files" t t)))
+   (let ((common
+          (query-replace-read-args
+           "Replace regexp as diff in marked files" t t t)))
      (list (nth 0 common) (nth 1 common) (nth 2 common))))
   (dired-post-do-command)
   (multi-file-replace-regexp-as-diff
@@ -3877,10 +3875,9 @@ REGEXP should use constructs supported by your local `grep' command.
 Also see `query-replace' for user options that affect how this
 function works."
   (interactive
-   (let* ((query-replace-lazy-highlight)
-          (common
+   (let ((common
           (query-replace-read-args
-           "Query replace regexp in marked files" t t)))
+           "Query replace regexp in marked files" t t t)))
      (list (nth 0 common) (nth 1 common)))
    dired-mode)
   (require 'xref)
index 042f37a808f328479af860cbcedb832beb54d8df..160dd5db2b1f6aae31c146bbe68213f3c504a30c 100644 (file)
@@ -353,7 +353,7 @@ should a regexp."
        to))
    regexp-flag))
 
-(defun query-replace-read-args (prompt regexp-flag &optional noerror)
+(defun query-replace-read-args (prompt regexp-flag &optional noerror no-highlight)
   (unless noerror
     (barf-if-buffer-read-only))
   (save-mark-and-excursion
@@ -365,7 +365,7 @@ should a regexp."
                       :filter (when (use-region-p)
                                 (replace--region-filter
                                  (funcall region-extract-function 'bounds)))
-                      :highlight query-replace-lazy-highlight
+                      :highlight (and query-replace-lazy-highlight (not no-highlight))
                       :regexp regexp-flag
                       :regexp-function (or replace-regexp-function
                                            delimited-flag