unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 12443@debbugs.gnu.org, Stefan Kangas <stefankangas@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Dani Moncayo <dmoncayo@gmail.com>
Subject: bug#12443: 24.2.50; Default values in the minibuffer prompt (fix
Date: Sun, 17 Jan 2021 19:05:06 +0000	[thread overview]
Message-ID: <875z3vxu3h.fsf_-_@tcd.ie> (raw)
In-Reply-To: <87sgbv7xtn.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 06 Sep 2020 17:02:28 +0200")

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> OK, the first sweep has now landed on master (I basically grepped for
> " (default %" and then did the changes.  Boy, were there many different
> ways to "optionally add some defaults" in the code...
>
>  78 files changed, 316 insertions(+), 453 deletions(-)
>
> Look at all the lines saved!  :-)
>
> There's also some of the prompting functions that have some support for
> this general idea, but in different ways:
>
> (defun read-regexp (prompt &optional defaults history)
> [...]
> 	 (input (read-from-minibuffer
> 		 (cond ((string-match-p ":[ \t]*\\'" prompt)
> 			prompt)
> 		       ((and default (> (length default) 0))
> 			 (format "%s (default %s): " prompt
> 				 (query-replace-descr default)))
> 		       (t
> 			(format "%s: " prompt)))
> 		 nil nil nil (or history 'regexp-history) suggestions t)))

Any reason this function wasn't changed in the end?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-format-prompt-in-read-regexp.patch --]
[-- Type: text/x-diff, Size: 1285 bytes --]

From 3d3423ef6705cf157e279c95e5eb8a35b8ca78fb Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Sun, 17 Jan 2021 18:56:50 +0000
Subject: [PATCH] Use format-prompt in read-regexp.

* lisp/replace.el (read-regexp): Use format-prompt (bug#12443).
---
 lisp/replace.el | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lisp/replace.el b/lisp/replace.el
index d41dc98a0d..8f8cbfac54 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -866,13 +866,10 @@ read-regexp
 	 ;; Do not automatically add default to the history for empty input.
 	 (history-add-new-input nil)
 	 (input (read-from-minibuffer
-		 (cond ((string-match-p ":[ \t]*\\'" prompt)
-			prompt)
-		       ((and default (> (length default) 0))
-			 (format "%s (default %s): " prompt
-				 (query-replace-descr default)))
-		       (t
-			(format "%s: " prompt)))
+                 (if (string-match-p ":[ \t]*\\'" prompt)
+                     prompt
+                   (format-prompt prompt (and (length> default 0)
+                                              (query-replace-descr default))))
 		 nil nil nil (or history 'regexp-history) suggestions t)))
     (if (equal input "")
 	;; Return the default value when the user enters empty input.
-- 
2.29.2


[-- Attachment #3: Type: text/plain, Size: 11 bytes --]


-- 
Basil

  parent reply	other threads:[~2021-01-17 19:05 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 13:53 bug#12443: 24.2.50; Default values in the minibuffer prompt (fix inconsisntecy) Dani Moncayo
2012-09-14 15:56 ` Stefan Monnier
2012-09-14 16:39   ` Drew Adams
2012-09-14 19:17     ` Dani Moncayo
2012-09-14 19:10   ` Dani Moncayo
2012-09-14 19:41     ` Stefan Monnier
2012-09-14 20:42       ` Dani Moncayo
2012-09-14 20:50         ` Jambunathan K
2012-09-14 20:55           ` Drew Adams
2012-09-14 22:47         ` Juri Linkov
2020-08-25 12:30           ` Lars Ingebrigtsen
2020-08-25 12:55             ` Stefan Kangas
2020-08-25 13:45               ` Stefan Monnier
2020-08-25 15:19               ` Lars Ingebrigtsen
2020-08-25 15:34                 ` Drew Adams
2020-08-25 16:19                 ` Stefan Kangas
2020-08-25 18:23                 ` Juri Linkov
2020-08-25 19:12                   ` Lars Ingebrigtsen
2020-08-25 20:00                   ` Stefan Monnier
2020-08-26 12:10                     ` Lars Ingebrigtsen
2020-08-27 18:48                       ` Juri Linkov
2020-08-28 14:11                         ` Lars Ingebrigtsen
2020-08-28 15:21                           ` Stefan Monnier
2020-08-30 13:16                             ` Lars Ingebrigtsen
2020-09-06 15:02                             ` Lars Ingebrigtsen
2020-09-06 17:46                               ` Lars Ingebrigtsen
2020-09-06 18:10                                 ` Lars Ingebrigtsen
2020-09-06 18:49                                 ` Drew Adams
2020-09-06 20:18                                   ` Michael Heerdegen
2020-09-06 20:38                                     ` Lars Ingebrigtsen
2020-09-06 20:42                                       ` Lars Ingebrigtsen
2020-09-06 21:55                                         ` Michael Heerdegen
2020-09-06 21:57                                           ` Lars Ingebrigtsen
2020-09-06 21:50                                       ` Michael Heerdegen
2020-09-06 21:56                                         ` Lars Ingebrigtsen
2020-09-07 18:46                                 ` Juri Linkov
2020-09-07 19:27                                   ` Lars Ingebrigtsen
2020-09-08 18:32                                     ` Juri Linkov
2020-09-08 20:37                                       ` Lars Ingebrigtsen
2020-09-09 18:50                                         ` Juri Linkov
2020-09-10 13:14                                           ` Lars Ingebrigtsen
2020-09-11  9:11                                             ` Andrii Kolomoiets
2020-09-11 12:53                                               ` Lars Ingebrigtsen
2020-09-14  8:40                                                 ` Andrii Kolomoiets
2020-09-14 11:15                                                   ` Lars Ingebrigtsen
2020-10-13  2:31                                                     ` Lars Ingebrigtsen
2020-09-12 19:04                                             ` Juri Linkov
2020-09-13  8:53                                               ` Juri Linkov
2020-09-13 14:30                                                 ` Eli Zaretskii
2020-09-13 13:00                                               ` Lars Ingebrigtsen
2020-09-07 20:11                                   ` Lars Ingebrigtsen
2021-01-17 19:05                               ` Basil L. Contovounesios [this message]
2021-01-18 16:40                                 ` bug#12443: 24.2.50; Default values in the minibuffer prompt (fix Lars Ingebrigtsen
2021-01-18 18:06                                   ` Basil L. Contovounesios
2020-08-28 14:13                         ` bug#12443: 24.2.50; Default values in the minibuffer prompt (fix inconsisntecy) Lars Ingebrigtsen

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=875z3vxu3h.fsf_-_@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=12443@debbugs.gnu.org \
    --cc=dmoncayo@gmail.com \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /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).