emacs-devel
[Top][All Lists]
Advanced

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

Re: Confused by y-or-n-p


From: Juri Linkov
Subject: Re: Confused by y-or-n-p
Date: Thu, 24 Dec 2020 22:47:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> In the Elisp manual we say that
>
>  ‘yes-or-no-p’ requires more work from the user than ‘y-or-n-p’ and
>      is appropriate for more crucial decisions.
>
> Now while 'yes-or-no-p' implements what is sometimes called a "modeless"
> or "non-modal" dialogue, our original 'y-or-n-p' implemented a "modal"
> dialogue where the user had no other choice but to answer the question
> immediately, possibly performing a few buffer scrolls in between.
>
> However, according to Wikipedia, modal dialogues are used
>
>   "to command user awareness and to display emergency states"
>
> inherently contradicting what we say above.  Maybe I'm the only one who
> sees a contradiction here.  Still I'd suggest to allow users to
> separately choose for both, 'y-or-n-p' _and_ 'yes-or-no-p' dialogues,
> whether they want Emacs to handle them in a modal or non-modal way.

Indeed.  Here is a possible way to make the minibuffer modal:

(defun minibuffer-lock ()
  (when (active-minibuffer-window)
    (select-window (active-minibuffer-window))))

(add-hook 'post-command-hook #'minibuffer-lock)

> And while we're there we could also try to relieve some of our .emacs
> files (mine included) of those
>
> (defalias 'yes-or-no-p 'y-or-n-p)
>
> by providing an option that accomplishes the necessary mapping.

One complication is that currently yes-or-no-p is implemented in C,
so using a new user option in it is not straightforward.



reply via email to

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