emacs-diffs
[Top][All Lists]
Advanced

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

master e066db2381: * lisp/replace.el (replace-regexp-function): New func


From: Juri Linkov
Subject: master e066db2381: * lisp/replace.el (replace-regexp-function): New function (bug#52558).
Date: Tue, 28 Dec 2021 14:15:27 -0500 (EST)

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

    * lisp/replace.el (replace-regexp-function): New function (bug#52558).
    
    (replace-search, replace-highlight): Use it.
---
 lisp/replace.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/replace.el b/lisp/replace.el
index 0e81b15a09..2e877305c0 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2621,6 +2621,11 @@ It is used by `query-replace-regexp', `replace-regexp',
 It is called with three arguments, as if it were
 `re-search-forward'.")
 
+(defvar replace-regexp-function nil
+  "Function to convert a search string to a regexp to replace.
+It's bound to `isearch-regexp-function' when searching
+for a string to replace.")
+
 (defun replace-search (search-string limit regexp-flag delimited-flag
                       case-fold &optional backward)
   "Search for the next occurrence of SEARCH-STRING to replace."
@@ -2633,7 +2638,8 @@ It is called with three arguments, as if it were
   ;; outside of this function because then another I-search
   ;; used after `recursive-edit' might override them.
   (let* ((isearch-regexp regexp-flag)
-        (isearch-regexp-function (or delimited-flag
+        (isearch-regexp-function (or replace-regexp-function
+                                     delimited-flag
                                      (and replace-char-fold
                                           (not regexp-flag)
                                           #'char-fold-to-regexp)))
@@ -2690,7 +2696,8 @@ It is called with three arguments, as if it were
   (if query-replace-lazy-highlight
       (let ((isearch-string search-string)
            (isearch-regexp regexp-flag)
-           (isearch-regexp-function (or delimited-flag
+           (isearch-regexp-function (or replace-regexp-function
+                                        delimited-flag
                                         (and replace-char-fold
                                              (not regexp-flag)
                                              #'char-fold-to-regexp)))



reply via email to

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