unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* completing-read, empty collection, require match
@ 2021-12-04 14:30 Qiantan Hong
  2021-12-04 15:03 ` Stefan Monnier
  2021-12-05 11:21 ` Thierry Volpiatto
  0 siblings, 2 replies; 3+ messages in thread
From: Qiantan Hong @ 2021-12-04 14:30 UTC (permalink / raw)
  To: emacs-devel@gnu.org

(completing-read "test: " nil nil t)
will pop up a prompt in mini buffer, pretend asking you for something
and then inevitably fail.

Is there some rationale behind the current behavior?
Failing immediately seems strictly more efficient.

Best,
Qiantan






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: completing-read, empty collection, require match
  2021-12-04 14:30 completing-read, empty collection, require match Qiantan Hong
@ 2021-12-04 15:03 ` Stefan Monnier
  2021-12-05 11:21 ` Thierry Volpiatto
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2021-12-04 15:03 UTC (permalink / raw)
  To: Qiantan Hong; +Cc: emacs-devel@gnu.org

Qiantan Hong [2021-12-04 14:30:09] wrote:
> (completing-read "test: " nil nil t)
> will pop up a prompt in mini buffer, pretend asking you for something
> and then inevitably fail.
>
> Is there some rationale behind the current behavior?
> Failing immediately seems strictly more efficient.

Yes, it would be more "efficient" in this case if `completing-read`
catches the situation and signals an error, but I don't think such an
optimization is worthwhile: the better optimization is to not make such
a call at all.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: completing-read, empty collection, require match
  2021-12-04 14:30 completing-read, empty collection, require match Qiantan Hong
  2021-12-04 15:03 ` Stefan Monnier
@ 2021-12-05 11:21 ` Thierry Volpiatto
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Volpiatto @ 2021-12-05 11:21 UTC (permalink / raw)
  To: Qiantan Hong; +Cc: emacs-devel@gnu.org

Qiantan Hong <qthong@stanford.edu> writes:

> (completing-read "test: " nil nil t)
> will pop up a prompt in mini buffer, pretend asking you for something
> and then inevitably fail.
>
> Is there some rationale behind the current behavior?
> Failing immediately seems strictly more efficient.

Helm is now quitting when collection is empty and require-match is
strict (i.e. `t').

    (completing-read "test: " nil nil t)
=> Quit.
    (completing-read "test: " nil nil)
=> Returns input.
    (completing-read "test: " nil nil 'confirm)
=> Returns input after confirmation (press RET twice).

-- 
Thierry



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-05 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 14:30 completing-read, empty collection, require match Qiantan Hong
2021-12-04 15:03 ` Stefan Monnier
2021-12-05 11:21 ` Thierry Volpiatto

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