[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: completing-read depricated initial-input

From: Drew Adams
Subject: RE: [External] : Re: completing-read depricated initial-input
Date: Tue, 21 Jun 2022 14:09:03 +0000

>> I differ with the plan to depricate `INITIAL-INPUT`.
> I often miss it, too. I don't recall why it had been deprecated.
> But you still can get the same thing using `minibuffer-setup-hook',
> e.g.
>     (minibuffer-with-setup-hook (lambda () (insert "b"))
>     (completing-read "Input: " (list "a" "b")))
> Eli and Stefan, those working with `completing-read` can
> see the value of having the functionality of INITIAL-INPUT
> in completing-read.  Could you contemplate not deprecating
> the functionality INITIAL-INPUT.  Because the argument does
> have usefulness, which will be possible to do if deprecated.

1. Deprecated doesn't mean it will be removed.
   Removal generally means desupport.  Deprecation
   generally means that it might be desupported at
   some time.  Deprecation is a heads-up that you
   might want to start moving your code away from
   depending on its existence.

2. I argued long ago that it shouldn't be deprecated.

3. The "argument" for deprecating it amounted to only
   a statement that stylistically some preferred that
   only the DEF (default value) argument be used.

   Even if one agrees with such a stylistic guideline
   it should just be a guideline.  There never was a
   good reason to deprecate it.  And really the doc
   should describe circumstances where it might make
   sense not to use it and circumstances where it
   might be useful.

4. FWIW, this is the INITIAL-INPUT part of the doc
   string of `completing-read' used in Icicles.

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.  (This is different from `read-from-minibuffer'
and related functions, which use one-indexing for POSITION.)

INITIAL-INPUT is considered deprecated by vanilla Emacs, but not by
Icicles.  If INITIAL-INPUT is nil and DEF is non-nil, the user can use
`next-history-element' to yank DEF into the minibuffer.

HIST, if non-nil, specifies a history list and optionally the initial
position in the list.  It can be a symbol, which is the history list
variable to use, or it can be a cons cell (HISTVAR . HISTPOS).  If a
cons cell, HISTVAR is the history list variable to use, and HISTPOS is
the initial position (the position in the list used by the minibuffer
history commands).  For consistency, you should also specify that
element of the history as the value of INITIAL-INPUT.  Positions are
counted starting from 1 at the beginning of the list.  The variable
`history-length' controls the maximum length of a history list.

DEF, if non-nil, is the default value or (Emacs 23+ only) the list of
default values.  Option `icicle-default-value' controls the treatment
of the default value (or the first default value, if DEF is a list):
whether it is shown in the prompt, substituted for an empty
INITIAL-INPUT, and so on.  If `icicle-default-value' is t then option
`icicle-default-in-prompt-format-function' is used to format DEF for
its addition to PROMPT.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]