[Top][All Lists]

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

Re: History for query replace pairs

From: Juri Linkov
Subject: Re: History for query replace pairs
Date: Sun, 09 Nov 2014 19:11:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>> And of course we can't use the same separator globally, because
>> char-displayable-p can return different results in different terminals
>> (or even different frames).
> Indeed, this test will need to be done each time the history element
> is about to be displayed.

This problem is solved by the following patch:

=== modified file 'lisp/replace.el'
--- lisp/replace.el     2014-11-07 23:33:41 +0000
+++ lisp/replace.el     2014-11-09 17:11:01 +0000
@@ -67,11 +67,20 @@ (make-obsolete-variable 'query-replace-i
 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
+   "\0"
+   'display (propertize
+            (if (and
+                 ;; Don't call char-displayable-p while pre-loading replace.
+                 (not (equal (car preloaded-file-list) "replace"))
+                 (char-displayable-p ?\u2192)) " \u2192 " " -> ")
+            'face 'minibuffer-prompt)
+   'separator t)
+  "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,6 +146,7 @@ (defun query-replace-read-from (prompt r
 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)

reply via email to

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