From: Christopher Dimech <dimech@gmx.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
Michael Heerdegen <michael_heerdegen@web.de>,
Arash Esbati <arash@gnu.org>, "eliz@gnu.org" <eliz@gnu.org>,
Help Gnu Emacs <help-gnu-emacs@gnu.org>,
"carlmarcos@tutanota.com" <carlmarcos@tutanota.com>
Subject: Re: RE: [External] : completing-read depricated initial-input
Date: Fri, 24 Jun 2022 10:09:27 +0200 [thread overview]
Message-ID: <trinity-e1bc3ac3-4194-4745-93a1-a19c9e99dd1f-1656058167554@3c-app-mailcom-bs07> (raw)
In-Reply-To: <SJ0PR10MB5488BDAF355045B0D1C78E81F3B49@SJ0PR10MB5488.namprd10.prod.outlook.com>
> Sent: Friday, June 24, 2022 at 12:10 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Stefan Monnier" <monnier@iro.umontreal.ca>, "Michael Heerdegen" <michael_heerdegen@web.de>
> Cc: "Arash Esbati" <arash@gnu.org>, "Christopher Dimech" <dimech@gmx.com>, "eliz@gnu.org" <eliz@gnu.org>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "carlmarcos@tutanota.com" <carlmarcos@tutanota.com>
> Subject: RE: [External] : Re: completing-read depricated initial-input
>
> > I haven't really followed that thread, but IMO the `initial-input` arg
> > should be changed into `setup-function` (so we don't have to use the
> > hideous `minibuffer-with-setup-function` hack) and using a string there
> > should be deprecated (the rare places where inserting an initial string
> > makes sense can use a setup-function instead).
>
> No comment on all of that. At least not until
> it becomes something real to worry about. ;-)
>
> > Also the prompt handling should be changed so that it automatically
> > inserts the default into the prompt. Doing that in a reliable and
> > backward compatible way is not completely straightforward, tho, so
> > maybe a simpler solution is to introduce a whole new function instead.
> >
> > Then a user-customization could also be used to choose between the
> > current default (where the default is added to the prompt) or the other
> > option of always inserting the default as initial value (pre-selected
> > so it can be deleted with a quick DEL).
>
> Possible insertion of the default value, and its
> possible addition to the prompt, should be handled
> more generally than just for completion.
>
> Ideally the choice should belong mainly to users,
> and it should apply to pretty much all minibuffer
> reading functions that allow for a default value.
Quite right. The ability to show an entry rather than always
keeping it blank should be kept.
> _____
>
> FWIW, Icicle mode handles this with user option
> `icicle-default-value'.
>
> When the value's non-`nil' and arg INITIAL-INPUT
> of minibuffer-reading functions is `nil' or "",
> the DEFAULT-VALUE argument can be inserted into
> the minibuffer as initial input.
>
> For `completing-read', `read-file-name'[*], and
> `read-string', if the option value is `t' then the
> default value is added to the prompt as a hint.
>
> Adding the default value to the prompt corresponds
> to a more or less conventional behavior of vanilla
> Emacs. But Emacs doesn't do that systematically.
> Instead, it hard-codes default values into prompts
> here and there. It's up to the particular command
> to decide about this - ad hoc.
>
> By design, individual Icicles commands never add
> the default value to a prompt themselves. Instead,
> option `icicle-default-value' controls the behavior.
>
> Non-`nil' and non-`t' inserts the default value
> into the minibuffer as the initial value.
>
> `nil' neither inserts the default value nor adds
> it to the prompt.
>
> (If the value is `t' or `nil', you can always use
> `M-n' to insert the default value manually.)
>
> If you often want to use or edit the default value,
> then consider setting `icicle-default-value' to
> non-`nil' and non-`t'. If you rarely do so, then
> consider using `nil' or `t'.
>
> A non-`nil', non-`t' value also controls whether
> or not the inserted default value is preselected
> (as the active region), and where to leave the
> cursor: at its beginning or end.
>
> Preselecting the value can be useful in Delete
> Selection mode, because it makes it easy to
> replace that value by typing characters, or delete
> it by hitting `DEL' or `C-d'. (However, all of
> the initial input is deleted with `C-d' or `DEL',
> which is inconvenient if you just want to edit it
> slightly.)
>
> Summary of values:
>
> Don't insert default into minibuffer:
>
> nil - Don't add to prompt.
> t - Add to prompt if `completing-read',
> `read-file-name', or `read-string'.
>
> Do insert default into minibuffer:
>
> `insert-start' - Leave cursor at start.
> `insert-end' - Leave cursor at end.
> `preselect-start' - Preselect and put cursor
> at beginning.
> `preselect-end' - Preselect and put cursor
> at end.
>
> `t' is the default. (I use `insert-end'.)
> _____
>
> When Icicles automatically puts the default value
> into the prompt, as a hint, it also replaces it
> there if put there already by some command, so
> the hint format will be systematically the same.
>
> Option `icicle-default-in-prompt-format-function'
> defines the format to use. By default it's this:
> (lambda (default) (format " (%s)" default))
>
> Function `icicle-handle-default-for-prompt' does
> the work:
> __
>
> (icicle-handle-default-for-prompt PROMPT DEFAULT INCLUDE)
>
> Return PROMPT, possibly changed to format or remove the DEFAULT value.
> Argument INCLUDE:
> * nil means do not include DEFAULT in prompt. Remove it if there.
> * non-nil means include DEFAULT, formatted according to
> `icicle-default-in-prompt-format-function'.
>
> In the existing PROMPT before modification, recognizes inclusion of
> a default value according to these possible patterns:
>
> `minibuffer-default-in-prompt-regexps'
> "(default ___):"
> "(default is ___):"
> " [___] "
> __
>
> Icicles just reuses vanilla Emacs variable
> `minibuffer-default-in-prompt-regexps', which is
> defined for `minibuffer-electric-default-mode'.
>
> A list of regexps matching the parts of minibuffer
> prompts showing defaults.
> When 'minibuffer-electric-default-mode' is active,
> these regexps are used to identify the portions of
> prompts to elide.
>
> (`minibuffer-electric-default-mode'e tries to show
> a default value in a prompt only when hitting RET
> yields that value. If you edit the minibuffer text
> so it's no longer the default value, the default's
> removed from the prompt.)
> ____________________
>
>
> [*]: However, for `read-file-name', if option
> `insert-default-directory' is non-`nil' then, to
> avoid duplication:
>
> * If the default value is the same as the value of
> `default-directory' then it's not added to the
> prompt.
>
> * If the default value is added to the prompt then
> it's first made relative to `default-directory'.
>
>
next prev parent reply other threads:[~2022-06-24 8:09 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 7:56 completing-read depricated initial-input carlmarcos--- via Users list for the GNU Emacs text editor
[not found] ` <N54Fw5q--3-2@tutanota.com-N54INof----2>
2022-06-21 9:51 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-21 11:19 ` Michael Heerdegen
2022-06-21 12:39 ` Emanuel Berg
2022-06-21 12:46 ` Michael Heerdegen
2022-06-21 14:04 ` [External] : " Drew Adams
2022-06-21 14:10 ` Michael Heerdegen
2022-06-21 14:49 ` Drew Adams
2022-06-22 8:50 ` Jean Louis
2022-06-22 9:32 ` Emanuel Berg
2022-06-21 10:26 ` Robert Pluim
2022-06-21 11:15 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-21 12:39 ` Christopher Dimech
2022-06-21 14:09 ` [External] : " Drew Adams
2022-06-21 18:21 ` Arash Esbati
2022-06-21 19:04 ` Emanuel Berg
2022-06-21 20:41 ` [External] : " Drew Adams
2022-06-21 21:28 ` Arash Esbati
2022-06-21 22:07 ` [External] : " Drew Adams
2022-06-21 22:56 ` Emanuel Berg
2022-06-22 13:43 ` Drew Adams
2022-06-22 15:59 ` standard libraries again (was: Re: [External] : Re: completing-read depricated initial-input) Emanuel Berg
2022-06-22 17:39 ` Drew Adams
2022-06-22 18:05 ` Emanuel Berg
2022-06-22 20:53 ` Drew Adams
2022-06-22 21:18 ` Emanuel Berg
2022-06-23 7:59 ` completing-read depricated initial-input Arash Esbati
2022-06-23 10:06 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-23 20:57 ` Emanuel Berg
2022-06-23 11:19 ` Michael Heerdegen
2022-06-23 12:12 ` Arash Esbati
2022-06-23 14:52 ` Michael Heerdegen
2022-06-23 16:30 ` [External] : " Drew Adams
2022-06-23 16:41 ` Michael Heerdegen
2022-06-23 18:27 ` Christopher Dimech
2022-06-23 21:14 ` Emanuel Berg
2022-06-23 18:25 ` RE: [External] : " Christopher Dimech
2022-06-23 21:13 ` [External] : " Emanuel Berg
2022-06-23 21:07 ` Emanuel Berg
2022-06-23 21:06 ` Emanuel Berg
2022-06-23 14:36 ` Jean Louis
2022-06-24 2:35 ` Emanuel Berg
2022-06-24 6:59 ` Jean Louis
2022-06-23 15:19 ` Jean Louis
2022-06-23 15:24 ` Jean Louis
2022-06-23 21:05 ` Stefan Monnier
2022-06-23 22:10 ` Christopher Dimech
2022-06-23 22:19 ` Stefan Monnier
2022-06-23 22:28 ` Christopher Dimech
2022-06-24 7:08 ` Jean Louis
2022-06-24 8:19 ` Christopher Dimech
2022-06-24 11:00 ` Jean Louis
2022-06-24 16:58 ` Christopher Dimech
2022-06-24 8:19 ` Emanuel Berg
2022-06-24 11:31 ` Jean Louis
2022-06-25 18:54 ` Emanuel Berg
2022-06-25 19:51 ` Jean Louis
2022-06-26 17:36 ` Emanuel Berg
2022-06-24 14:30 ` [External] : " Drew Adams
2022-06-24 19:33 ` RE: [External] : " Christopher Dimech
2022-06-25 19:12 ` [External] : " Emanuel Berg
2022-06-25 21:26 ` Drew Adams
2022-06-26 17:39 ` Emanuel Berg
2022-06-26 22:22 ` Drew Adams
2022-06-26 22:42 ` Emanuel Berg
2022-06-24 0:10 ` Drew Adams
2022-06-24 8:09 ` Christopher Dimech [this message]
2022-06-24 2:29 ` Emanuel Berg
2022-06-23 16:23 ` [External] : " Drew Adams
2022-06-23 20:58 ` Arash Esbati
2022-06-23 21:54 ` Christopher Dimech
2022-06-24 2:49 ` Emanuel Berg
2022-06-22 3:09 ` Po Lu
2022-06-22 3:46 ` Emanuel Berg
2022-06-22 4:56 ` Christopher Dimech
2022-06-23 8:20 ` Arash Esbati
2022-06-23 8:27 ` Emanuel Berg
2022-06-23 8:57 ` Tassilo Horn
2022-06-23 10:10 ` Emanuel Berg
2022-06-23 11:26 ` Tassilo Horn
2022-06-23 11:48 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-23 21:38 ` Emanuel Berg
2022-06-24 8:03 ` Christopher Dimech
2022-06-23 21:34 ` Emanuel Berg
2022-06-23 11:58 ` Arash Esbati
2022-06-23 12:10 ` Lars Ingebrigtsen
2022-06-23 14:26 ` Tassilo Horn
2022-06-23 14:46 ` Arash Esbati
2022-06-23 15:18 ` Robert Pluim
2022-06-23 20:46 ` Arash Esbati
2022-06-24 8:40 ` Philip Kaludercic
2022-06-24 2:22 ` Emanuel Berg
2022-06-24 2:17 ` Emanuel Berg
2022-06-23 21:49 ` Emanuel Berg
2022-06-23 21:42 ` Emanuel Berg
2022-06-23 16:25 ` [External] : " Drew Adams
2022-06-23 19:56 ` Tassilo Horn
2022-06-24 11:23 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-24 11:36 ` Jean Louis
2022-06-25 19:01 ` Emanuel Berg
2022-06-25 21:26 ` Drew Adams
2022-06-22 2:59 ` RE: [External] : " Christopher Dimech
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-e1bc3ac3-4194-4745-93a1-a19c9e99dd1f-1656058167554@3c-app-mailcom-bs07 \
--to=dimech@gmx.com \
--cc=arash@gnu.org \
--cc=carlmarcos@tutanota.com \
--cc=drew.adams@oracle.com \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.