From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 25482@debbugs.gnu.org
Subject: bug#25482: 26.0.50; Allow setting `query-replace-from-to-separator` to nil
Date: Fri, 20 Jan 2017 06:54:02 +0100 [thread overview]
Message-ID: <87pojib7k5.fsf@gmail.com> (raw)
In-Reply-To: <83lgu76nuf.fsf@gnu.org>
Here the patch updated:
1 file changed, 25 insertions(+), 16 deletions(-)
lisp/replace.el | 41 +++++++++++++++++++++++++----------------
modified lisp/replace.el
@@ -79,15 +79,15 @@ 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")
-(defcustom query-replace-from-to-separator
- (propertize (if (char-displayable-p ?→) " → " " -> ")
- 'face 'minibuffer-prompt)
- "String that separates FROM and TO in the history of replacement pairs."
- ;; Avoids error when attempt to autoload char-displayable-p fails
- ;; while preparing to dump, also stops customize-rogue listing this.
- :initialize 'custom-initialize-delay
+(defcustom query-replace-from-to-separator " → "
+ "String that separates FROM and TO in the history of replacement pairs.
+When nil the default separator \" -> \" will be used as a plain string
+and the pair will not be added to `query-replace-history'
+\(Same behavior as in emacs 24.5)."
:group 'matching
- :type '(choice string (sexp :tag "Display specification"))
+ :type '(choice
+ (const :tag "Disabled" nil)
+ string)
:version "25.1")
(defcustom query-replace-from-history-variable 'query-replace-history
@@ -165,9 +165,15 @@ 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)
+ (when (stringp query-replace-from-to-separator)
+ (setq query-replace-from-to-separator
+ (propertize (if (char-displayable-p
+ (string-to-char
+ (replace-regexp-in-string
+ " " "" query-replace-from-to-separator)))
+ query-replace-from-to-separator
+ " -> ")
+ 'face 'minibuffer-prompt)))
(let* ((history-add-new-input nil)
(separator
(when query-replace-from-to-separator
@@ -185,9 +191,13 @@ wants to replace FROM with TO."
(symbol-value query-replace-from-history-variable)))
(minibuffer-allow-text-properties t) ; separator uses text-properties
(prompt
- (if (and query-replace-defaults separator)
- (format "%s (default %s): " prompt (car minibuffer-history))
- (format "%s: " prompt)))
+ (cond ((and query-replace-defaults separator)
+ (format "%s (default %s): " prompt (car minibuffer-history)))
+ (query-replace-defaults
+ (format "%s (default %s -> %s): " prompt
+ (query-replace-descr (caar query-replace-defaults))
+ (query-replace-descr (cdar query-replace-defaults))))
+ (t (format "%s: " prompt))))
(from
;; The save-excursion here is in case the user marks and copies
;; a region in order to specify the minibuffer input.
@@ -200,8 +210,7 @@ wants to replace FROM with TO."
(if regexp-flag
(read-regexp prompt nil 'minibuffer-history)
(read-from-minibuffer
- prompt nil nil nil nil
- (car (if regexp-flag regexp-search-ring search-ring)) t)))))
+ prompt nil nil nil nil (car search-ring) t)))))
(to))
(if (and (zerop (length from)) query-replace-defaults)
(cons (caar query-replace-defaults)
--
Thierry
next prev parent reply other threads:[~2017-01-20 5:54 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 8:18 bug#25482: 26.0.50; Allow setting `query-replace-from-to-separator` to nil Thierry Volpiatto
2017-01-19 16:01 ` Eli Zaretskii
2017-01-20 5:54 ` Thierry Volpiatto [this message]
[not found] ` <87vatac0a2.fsf@gmail.com>
2017-01-20 5:42 ` bug#25482: Fwd: " Thierry Volpiatto
2017-01-20 7:56 ` Eli Zaretskii
2017-01-20 11:35 ` Thierry Volpiatto
2017-01-20 13:06 ` Eli Zaretskii
2017-01-20 15:16 ` Thierry Volpiatto
2017-01-22 19:06 ` Eli Zaretskii
2017-01-22 20:14 ` Thierry Volpiatto
2017-01-22 20:32 ` Eli Zaretskii
2017-01-23 8:13 ` Thierry Volpiatto
2017-01-28 6:50 ` Thierry Volpiatto
2017-01-28 7:31 ` Eli Zaretskii
2017-01-28 10:43 ` Thierry Volpiatto
2017-01-28 11:01 ` Eli Zaretskii
2017-01-28 11:23 ` Thierry Volpiatto
2017-01-28 13:50 ` Eli Zaretskii
2017-01-28 16:46 ` Thierry Volpiatto
[not found] ` <87k29ey93n.fsf@mail.linkov.net>
2017-01-29 3:42 ` Eli Zaretskii
2017-01-30 0:16 ` Juri Linkov
2017-02-13 0:37 ` Juri Linkov
2017-02-13 2:24 ` Glenn Morris
2017-02-13 3:04 ` Glenn Morris
2017-02-13 5:51 ` Eli Zaretskii
2017-02-14 0:04 ` Juri Linkov
2017-02-14 0:24 ` Drew Adams
2017-02-18 10:45 ` Eli Zaretskii
2017-02-13 5:53 ` Thierry Volpiatto
2017-02-16 20:43 ` Juri Linkov
2017-01-21 10:05 ` Thierry Volpiatto
2017-01-21 10:24 ` Thierry Volpiatto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pojib7k5.fsf@gmail.com \
--to=thierry.volpiatto@gmail.com \
--cc=25482@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).