From: Tim Landscheidt <tim@tim-landscheidt.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, emacs-devel@gnu.org
Subject: Re: Doc of deprecated INITIAL-INPUT arg of completing-read
Date: Thu, 15 Feb 2024 08:21:35 +0000 [thread overview]
Message-ID: <87sf1u5e9c.fsf@vagabond.tim-landscheidt.de> (raw)
In-Reply-To: <jwvo7ck871k.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 13 Feb 2024 15:09:18 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> I'm not perplexed :-). What I find confusing is:
>> a) The solution for this "very usual" use case is not men-
>> tioned anywhere in the documentation. Instead, the doc-
>> string (for completing-read) suggests a different work-
>> flow.
> The documentation probably needs to be improved in this respect,
> admittedly, but I can't see where the docstring suggests a different
> workflow (or more specifically, I suspect that it only does so if you
> have a particular workflow in mind to start with).
The docstring for completing-read (GNU Emacs 28.3) says re-
garding INITIAL-INPUT:
| If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
| with point positioned at the end. If it is (STRING . POSITION), the
| initial input is STRING, but point is placed at _zero-indexed_
| position POSITION in STRING. (*Note* that this is different from
| ‘read-from-minibuffer’ and related functions, which use one-indexing
| for POSITION.) This feature is deprecated--it is best to pass nil
| for INITIAL-INPUT and supply the default value DEF instead. The
| user can yank the default value into the minibuffer easily using
| M-n.
If one follows this recommendation (setting INITIAL-INPUT to
nil and passing the original value as DEF), the user is not
made aware of the original INITIAL-INPUT value until he
presses M-n.
>> b) With this solution, if the user needs to change the de-
>> fault/initial value, he has to use one more keystroke
>> (M-n) than if INITIAL-INPUT had been used.
> But with your solution, the users that want not just to modify the
> default but to enter a different value need to first delete the initial
> value, (e.g. `C-a C-k`).
> You win some, you lose some.
For example, when I use M-x compile RET, I typically do not
want to enter a different value, but amend the existing one
by adding/changing the target or setting an option. But
even in the basic case of C-x C-f, if I want to find a file
upwards of default-directory, the two extra keystrokes har-
monize well with wanting to do something different, so it
never occured to me that Emacs should protect me from them.
Tim
next prev parent reply other threads:[~2024-02-15 8:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 15:22 Doc of deprecated INITIAL-INPUT arg of completing-read Michael Heerdegen
2022-06-27 16:33 ` [External] : " Drew Adams
2022-06-27 17:22 ` Christopher Dimech
2022-06-28 16:19 ` Michael Heerdegen
2022-06-28 16:40 ` Drew Adams
2022-06-29 13:42 ` Michael Heerdegen
2022-06-29 14:24 ` Drew Adams
2022-06-28 21:46 ` Christopher Dimech
2022-06-29 9:15 ` Arash Esbati
2022-06-29 13:46 ` Michael Heerdegen
2022-06-30 9:10 ` Arash Esbati
2022-07-04 12:25 ` Michael Heerdegen
2022-06-28 19:17 ` [External] : " Jean Louis
2022-06-28 19:15 ` Jean Louis
2022-06-28 21:10 ` Stefan Monnier
2022-06-28 22:00 ` Jean Louis
2022-06-29 2:58 ` Stefan Monnier
2022-06-30 3:08 ` Richard Stallman
2022-06-30 14:28 ` Stefan Monnier
2024-02-13 14:43 ` Tim Landscheidt
2024-02-13 14:59 ` Stefan Monnier
2024-02-13 17:07 ` Tim Landscheidt
2024-02-13 20:09 ` Stefan Monnier
2024-02-15 8:21 ` Tim Landscheidt [this message]
2024-02-15 16:09 ` [External] : " Drew Adams
2024-02-15 18:39 ` Stefan Monnier
2024-02-17 17:12 ` Tim Landscheidt
2024-02-17 17:41 ` Stefan Monnier
2022-06-30 3:08 ` Richard Stallman
2022-07-01 5:54 ` Jean Louis
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=87sf1u5e9c.fsf@vagabond.tim-landscheidt.de \
--to=tim@tim-landscheidt.de \
--cc=emacs-devel@gnu.org \
--cc=michael_heerdegen@web.de \
--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).