unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Tim Landscheidt <tim@tim-landscheidt.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Doc of deprecated INITIAL-INPUT arg of completing-read
Date: Thu, 15 Feb 2024 16:09:01 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488CAA752F3E9DE1611047CF34D2@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87sf1u5e9c.fsf@vagabond.tim-landscheidt.de>

> 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.

> 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.

Exactly - use the default value as is or edit it.

A user, such as yourself, can prefer having the default
value in the minibuffer by default, i.e., without having
to use `M-n' to insert it.  And how commonly you find
that you use the default value, either as is or by
editing it, can influence your preference.

Stefan's right that the choice is between (1) having it
present by default, and needing to remove it if you don't
want it, and (2) having it absent by default, and needing
to use `M-n' to insert it if you do want it.

The point is that that should be a _user_ choice, not
preordained.  Give users a user option for exactly that
choice.

How helpful a particular use of `completing-read' is in
providing a useful default value can also matter,
obviously.  A poor default value is less likely to be
used (as is or edited).  The vanilla Emacs design of not
inserting the default automatically essentially assumes
(allows and encourages) lazy coding with poor default
values.
___

But this is all about the DEFAULT value, _not_ the
INITIAL-INPUT.  Those are separate things for a reason,
because you can use them differently.

The Emacs policy should be similar to this, which is
the Icicles policy (i.e., if you enable its minor
mode):

1. INITIAL-INPUT should in no way be deprecated.  It's
useful.  It gives a call to `completing-read', e.g.
for a particular command, control over what happens by
default wrt inserting an initial value.

A DEFAULT value doesn't in any way systematically
replace the utility of INITIAL-INPUT.

2. Users should be able to set their preference wrt
whether DEFAULT is inserted automatically (modulo
use of INITIAL-INPUT).  IOW, a user option.
___

Icicles provides option `icicle-default-value' for
this.  Its default value is `t'.

  nil               - Don't insert default value or add it to prompt.
  t                 - Add default value to `completing-read' prompt.
                      Do not insert it.
  `insert-start'    - Insert default value and leave cursor at start.
  `insert-end'      - Insert default value and leave cursor at end.
  `preselect-start' - Insert and preselect default value;
                      leave cursor at beginning.
  `preselect-end'   - Insert and preselect default value;
                      leave cursor at end.

If the default value is inserted automatically you can
easily remove it with `M-k'.  You can use that anytime,
to completely empty the minibuffer, regardless of the
position of the cursor or how much text is there.
(Vanilla Emacs should have a key for this.)

If the default value isn't inserted automatically,
then you can use `M-n' to insert it (as in vanilla
Emacs).  Overall, the default Icicles behavior
matches that of vanilla Emacs.

I mention all of this not to advertise Icicles but to
(once again) suggest that vanilla Emacs should offer
behavior that's somewhat similar:

1. It shouldn't consider INITIAL-INPUT "deprecated".
2. It should give users an option, to choose whether
   the DEFAULT value gets inserted automatically.
3. It should provide a key to empty the minibuffer.
___


https://www.emacswiki.org/emacs/Icicles_-_Customization_and_General_Tips#icicle-default-value

  reply	other threads:[~2024-02-15 16:09 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
2024-02-15 16:09               ` Drew Adams [this message]
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=SJ0PR10MB5488CAA752F3E9DE1611047CF34D2@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=tim@tim-landscheidt.de \
    /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).