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: Eli Zaretskii
Subject: Re: Confused by y-or-n-p
Date: Fri, 25 Dec 2020 13:46:42 +0200

> From: Juri Linkov <juri@linkov.net>
> Cc: rudalics@gmx.at,  emacs-devel@gnu.org,  rms@gnu.org
> Date: Fri, 25 Dec 2020 11:23:45 +0200
> 
> >> (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?

Can't we add to post-command-hook only in the commands from that
subset, and remove it when leaving the minibuffer?

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

You can do the same, almost literally, in C, can't you?



reply via email to

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