From: Juri Linkov <juri@jurta.org>
Cc: monnier@iro.umontreal.ca, eclig@gmx.net, emacs-devel@gnu.org
Subject: Re: Patch: Follow convention for reading with the minibuffer.
Date: Thu, 08 Sep 2005 09:54:47 +0300 [thread overview]
Message-ID: <87ek80cat2.fsf@jurta.org> (raw)
In-Reply-To: <E1EDCMU-00043r-N4@fencepost.gnu.org> (Richard M. Stallman's message of "Wed, 07 Sep 2005 22:42:02 -0400")
> Putting the colon at the end is definitely better. Can someone fix
> C-x b to work that way?
I guess the current format of the default buffer prompt was easier
to implement. Finding an appropriate place in the given prompt to
insert the default value is not a trivial task to do in C. As users
can provide an arbitrary prompt (e.g. the example in the Emacs Lisp
manual suggest using the question mark: "Buffer name? ", where the
right place for the default value is just before the question mark:
"Buffer name (default foo)? "), a heuristics should be used to parse
the prompt and to find a place to insert the default value.
Ideally, there should exist a special prompt-formatting function with
two arguments: `prompt' and `default'. For example, the default
function and format value would look like:
(defvar prompt-default-format " (default %s): ")
(defun format-prompt-default (prompt default)
;; If there is no default yet in the prompt
(if (not (string-match (replace-regexp-in-string
"%s" ".*" prompt-default-format nil t)
prompt))
(setq prompt (replace-regexp-in-string
" *\\W? *$"
(format prompt-default-format default)
prompt)))
prompt)
> PS: Actually I even prefer
>
> Enter the answer [42]:
>
> because minibuffer width is limited.
>
> Now that the minibuffer prompt can be continued, saving space there is
> less important than it would have been before. And the word "default"
> will serve to explain to new users.
With the special formatting function and the format variable this
would be easy to customize:
(setq prompt-default-format " [%s]: ")
(read-buffer "Buffer name: " "foo" t)
will display the prompt:
Buffer name [foo]:
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2005-09-08 6:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-06 18:01 Patch: Follow convention for reading with the minibuffer Emilio Lopes
2005-09-06 20:01 ` Stefan Monnier
2005-09-08 2:42 ` Richard M. Stallman
2005-09-08 6:54 ` Juri Linkov [this message]
2005-09-09 12:50 ` Richard M. Stallman
2005-09-09 16:05 ` Drew Adams
2005-09-09 17:13 ` Thien-Thi Nguyen
2005-09-09 18:20 ` Stefan Monnier
2005-09-11 13:52 ` Emilio Lopes
2005-09-24 13:52 ` Romain Francoise
2005-09-24 22:09 ` Thien-Thi Nguyen
2005-09-25 12:11 ` Juanma Barranquero
2005-09-29 20:57 ` Juri Linkov
2005-09-30 19:52 ` Stefan Monnier
2005-10-02 20:23 ` Juri Linkov
2005-09-29 20:59 ` Juri Linkov
2005-09-30 5:55 ` Romain Francoise
2005-09-30 17:34 ` Richard M. Stallman
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=87ek80cat2.fsf@jurta.org \
--to=juri@jurta.org \
--cc=eclig@gmx.net \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).