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: martin rudalics
Subject: Re: Confused by y-or-n-p
Date: Fri, 25 Dec 2020 09:42:10 +0100

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

That's too harsh because it would affect all minibuffer interactions.

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

I would just amend this part

      if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes"))
        return unbind_to (count, Qt);
      if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no"))
        return unbind_to (count, Qnil);

leaving dialog boxes and the rest alone.

martin



reply via email to

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