From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Confused by y-or-n-p Date: Fri, 25 Dec 2020 13:46:42 +0200 Message-ID: <838s9mnm59.fsf@gnu.org> References: <834kkcr1eo.fsf@gnu.org> <43b24209-fa65-0e26-7cbd-f99175a7ffd8@gmx.at> <87wnx7j5is.fsf@mail.linkov.net> <83im8qnyca.fsf@gnu.org> <87a6u2z0ue.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33221"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rudalics@gmx.at, rms@gnu.org, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 25 12:47:47 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kslZS-0008Vr-NX for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Dec 2020 12:47:46 +0100 Original-Received: from localhost ([::1]:38350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kslZR-0003oR-PJ for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Dec 2020 06:47:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kslYs-0003O6-66 for emacs-devel@gnu.org; Fri, 25 Dec 2020 06:47:10 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34567) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kslYq-0006nM-MK; Fri, 25 Dec 2020 06:47:08 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2412 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kslYh-0000pn-Ji; Fri, 25 Dec 2020 06:47:00 -0500 In-Reply-To: <87a6u2z0ue.fsf@mail.linkov.net> (message from Juri Linkov on Fri, 25 Dec 2020 11:23:45 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261738 Archived-At: > From: Juri Linkov > 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?