GNU bug report logs - #65459
completing-read INITIAL-VALUE unaware of COLLECTION and REQUIRE-MATCH

Previous Next

Package: emacs;

Reported by: Heime <heimeborgia <at> protonmail.com>

Date: Tue, 22 Aug 2023 22:05:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Heime <heimeborgia <at> protonmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 65459 <at> debbugs.gnu.org
Subject: bug#65459: completing-read INITIAL-VALUE unaware of COLLECTION and REQUIRE-MATCH
Date: Wed, 23 Aug 2023 17:27:56 -0400
>> The normal/recommended call looks like:
>> 
>> (let ((cseq '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta")))
>> (completing-read (format-prompt "Grapheme" "alpha")
>> cseq nil t nil nil "alpha"))
>> 
>> [ Yes, it's a bit cumbersome: hysterical raisins :-( ] - Stefan
>
> Correct.  The solution involves an unwieldy parameter configurations, and possibly
> using convoluted workarounds to achieve the desired behavior.  This scenario implies
> that using the function as intended requires a level of effort, understanding, and
> manipulation that goes beyond direct usage.

Agreed.  That argues in favor of introducing a new function.  But that
new function would be so similar to `completing-read` that it will lead
to users wondering when to use which or why there are two unless we mark
`completing-read` as obsolete, which would in turn cause a lot of
warnings in a lot of packages and code churn.

So, we've been hesitating to make this change for a while, not sure
which choice is least bad.

But at this point do you consider the behavior of

    (let ((cseq '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta")))
      (completing-read (format-prompt "Grapheme" "alpha")
                       cseq nil t nil nil "alpha"))

to be a good solution for your original problem?

[ BTW, to me the main benefit of a new function is that we could try
  and make it so that the user can choose between a UI where the default
  is not inserted in the initial minibuffer (as in the above code), or
  one where it is (presumably pre-selected so you can delete it with
  a simple DEL), as is common in many other applications.  ]


        Stefan





This bug report was last modified 1 year and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.