emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 01/01: * lisp/replace.el (query-replace-from-to-sep


From: Juri Linkov
Subject: [Emacs-diffs] master 01/01: * lisp/replace.el (query-replace-from-to-separator): Turn defvar into defcustom. Wrap char-displayable-p in ignore-errors because an attempt to autoload char-displayable-p fails during pre-loading. Move (propertize "\0" ... 'separator t) out of customizable part to query-replace-read-from. (query-replace-read-from): Call custom-reevaluate-setting on query-replace-from-to-separator to reevaluate the separator depending on the return value of char-displayable-p. http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00466.html
Date: Tue, 18 Nov 2014 21:59:19 +0000

branch: master
commit c0b877ba35f5b1d4fc63e8472d6021fba0c8395a
Author: Juri Linkov <address@hidden>
Date:   Tue Nov 18 23:59:14 2014 +0200

    * lisp/replace.el (query-replace-from-to-separator): Turn defvar into 
defcustom.
    Wrap char-displayable-p in ignore-errors because an attempt
    to autoload char-displayable-p fails during pre-loading.
    Move (propertize "\0" ... 'separator t) out of customizable part
    to query-replace-read-from.
    (query-replace-read-from): Call custom-reevaluate-setting on
    query-replace-from-to-separator to reevaluate the separator
    depending on the return value of char-displayable-p.
    http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00466.html
---
 lisp/ChangeLog  |   12 ++++++++++++
 lisp/replace.el |   29 ++++++++++++++++++++---------
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6a6ff73..ba01694 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,17 @@
 2014-11-18  Juri Linkov  <address@hidden>
 
+       * replace.el (query-replace-from-to-separator): Turn defvar into
+       defcustom.  Wrap char-displayable-p in ignore-errors because an
+       attempt to autoload char-displayable-p fails during pre-loading.
+       Move (propertize "\0" ... 'separator t) out of customizable part
+       to query-replace-read-from.
+       (query-replace-read-from): Call custom-reevaluate-setting on
+       query-replace-from-to-separator to reevaluate the separator
+       depending on the return value of char-displayable-p.
+       http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00466.html
+
+2014-11-18  Juri Linkov  <address@hidden>
+
        * bindings.el (minibuffer-local-map): Rebind [down] from
        next-history-element to next-line-or-history-element, and [up]
        from previous-history-element to previous-line-or-history-element.
diff --git a/lisp/replace.el b/lisp/replace.el
index c7fbcb5..2c7ad19 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -67,11 +67,16 @@ That becomes the \"string to replace\".")
 to the minibuffer that reads the string to replace, or invoke replacements
 from Isearch by using a key sequence like `C-s C-s M-%'." "24.3")
 
-(defvar query-replace-from-to-separator
-  (propertize "\0"
-             'display (propertize " \u2192 " 'face 'minibuffer-prompt)
-             'separator t)
-  "String that separates FROM and TO in the history of replacement pairs.")
+(defcustom query-replace-from-to-separator
+  (propertize
+   (or (ignore-errors
+        (if (char-displayable-p ?\u2192) " \u2192 " " -> "))
+       " -> ")
+   'face 'minibuffer-prompt)
+  "String that separates FROM and TO in the history of replacement pairs."
+  :group 'matching
+  :type 'sexp
+  :version "25.1")
 
 (defcustom query-replace-from-history-variable 'query-replace-history
   "History list to use for the FROM argument of `query-replace' commands.
@@ -137,19 +142,25 @@ 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))
+    (custom-reevaluate-setting 'query-replace-from-to-separator)
     (let* ((history-add-new-input nil)
+          (separator
+           (when query-replace-from-to-separator
+             (propertize "\0"
+                         'display query-replace-from-to-separator
+                         'separator t)))
           (query-replace-from-to-history
            (append
-            (when query-replace-from-to-separator
+            (when separator
               (mapcar (lambda (from-to)
                         (concat (query-replace-descr (car from-to))
-                                query-replace-from-to-separator
+                                separator
                                 (query-replace-descr (cdr from-to))))
                       query-replace-defaults))
             (symbol-value query-replace-from-history-variable)))
           (minibuffer-allow-text-properties t) ; separator uses text-properties
           (prompt
-           (if (and query-replace-defaults query-replace-from-to-separator)
+           (if (and query-replace-defaults separator)
                (format "%s (default %s): " prompt (car 
query-replace-from-to-history))
              (format "%s: " prompt)))
           (from
@@ -166,7 +177,7 @@ wants to replace FROM with TO."
          (cons (caar query-replace-defaults)
                (query-replace-compile-replacement
                 (cdar query-replace-defaults) regexp-flag))
-       (let* ((to (if (and (string-match query-replace-from-to-separator from)
+       (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)))



reply via email to

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