emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f2301ec: Fix query-replace-regexp when using lisp e


From: Juri Linkov
Subject: [Emacs-diffs] master f2301ec: Fix query-replace-regexp when using lisp expressions for replacement
Date: Mon, 15 Dec 2014 23:54:42 +0000

branch: master
commit f2301ecc237858a029def9afaabe0fdf91591ebc
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    Fix query-replace-regexp when using lisp expressions for replacement
    
    * lisp/replace.el (query-replace-read-from): Use
    query-replace-compile-replacement only on the return value.
    
    Fixes: debbugs:19383
---
 lisp/ChangeLog  |    5 +++++
 lisp/replace.el |    9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5a0a62f..4f8631d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-15  Juri Linkov  <address@hidden>
 
+       * replace.el (query-replace-read-from): Use 
query-replace-compile-replacement
+       only on the return value (bug#19383).
+
+2014-12-15  Juri Linkov  <address@hidden>
+
        * isearch.el (isearch-lazy-highlight-search): Extend the bound of
        the wrapped search by the length of the search string to be able
        to lazy-highlight the whole search string at point (bug#19353).
diff --git a/lisp/replace.el b/lisp/replace.el
index 2c7ad19..fa6f11b 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -70,6 +70,8 @@ from Isearch by using a key sequence like `C-s C-s M-%'." 
"24.3")
 (defcustom query-replace-from-to-separator
   (propertize
    (or (ignore-errors
+        ;; Ignore errors when attempt to autoload char-displayable-p
+        ;; fails while preparing to dump.
         (if (char-displayable-p ?\u2192) " \u2192 " " -> "))
        " -> ")
    'face 'minibuffer-prompt)
@@ -142,6 +144,8 @@ The return value can also be a pair (FROM . TO) indicating 
that the user
 wants to replace FROM with TO."
   (if query-replace-interactive
       (car (if regexp-flag regexp-search-ring search-ring))
+    ;; Reevaluating will check char-displayable-p that is
+    ;; unavailable while preparing to dump.
     (custom-reevaluate-setting 'query-replace-from-to-separator)
     (let* ((history-add-new-input nil)
           (separator
@@ -179,8 +183,7 @@ wants to replace FROM with TO."
                 (cdar query-replace-defaults) regexp-flag))
        (let* ((to (if (and (string-match separator from)
                            (get-text-property (match-beginning 0) 'separator 
from))
-                      (query-replace-compile-replacement
-                       (substring-no-properties from (match-end 0)) 
regexp-flag)))
+                      (substring-no-properties from (match-end 0))))
               (from (if to (substring-no-properties from 0 (match-beginning 0))
                       (substring-no-properties from))))
          (add-to-history query-replace-from-history-variable from nil t)
@@ -198,7 +201,7 @@ wants to replace FROM with TO."
              from
            (add-to-history query-replace-to-history-variable to nil t)
            (add-to-history 'query-replace-defaults (cons from to) nil t)
-           (cons from to)))))))
+           (cons from (query-replace-compile-replacement to regexp-flag))))))))
 
 (defun query-replace-compile-replacement (to regexp-flag)
   "Maybe convert a regexp replacement TO to Lisp.



reply via email to

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