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: Fri, 25 Dec 2020 11:23:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> 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)
>
> Would something like that work to give users an option discussed in
> this thread for y-or-n-p?  If so, can you please show a patch for
> that?

I thought that others wanted this to affect all minibuffer commands.
How would it be possible to customize this behavior only for a subset
of commands?

>> > 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.
>
> What are the difficulties?  You can call Lisp from C, given an option,
> which is what I think Martin asked for.

In Lisp it would be simpler to add to the beginning of 'yes-or-no-p':

  (if use-y-or-n-p
      (y-or-n-p prompt)



reply via email to

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