From 2e4c5ee11de0acb6ae8ee2ec7f0420bfea43e1f9 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Wed, 17 Jul 2024 09:11:04 +0530 Subject: [PATCH] Don't highlight matches in dired query-replace commands * lisp/dired-aux.el (dired-do-query-replace-regexp) (dired-do-replace-regexp-as-diff) (dired-do-find-regexp-and-replace): Turn off lazy highlighting when reading the regexp from the user to avoid highlighting regexp matches in the dired buffer. (bug#72147) (cherry picked from commit cc6324d9dca662ea0ca9439411f4852b85e18986) --- lisp/dired-aux.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 521f3e6dd84..b7a12c6280e 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3787,9 +3787,10 @@ 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 ((common - (query-replace-read-args - "Query replace regexp in marked files" t t))) + (let* ((query-replace-lazy-highlight) + (common + (query-replace-read-args + "Query replace regexp in marked files" 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)) @@ -3811,9 +3812,10 @@ 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 ((common - (query-replace-read-args - "Replace regexp as diff in marked files" t t))) + (let* ((query-replace-lazy-highlight) + (common + (query-replace-read-args + "Replace regexp as diff in marked files" t t))) (list (nth 0 common) (nth 1 common) (nth 2 common)))) (dired-post-do-command) (multi-file-replace-regexp-as-diff @@ -3875,7 +3877,8 @@ 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 ((common + (let* ((query-replace-lazy-highlight) + (common (query-replace-read-args "Query replace regexp in marked files" t t))) (list (nth 0 common) (nth 1 common))) -- 2.39.2