From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: npostavs@users.sourceforge.net, bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Sep 2017 15:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 28525@debbugs.gnu.org Cc: npostavs@users.sourceforge.net X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: npostavs@users.sourceforge.net Received: via spool by submit@debbugs.gnu.org id=B.150592047816028 (code B ref -1); Wed, 20 Sep 2017 15:15:03 +0000 Received: (at submit) by debbugs.gnu.org; 20 Sep 2017 15:14:38 +0000 Received: from localhost ([127.0.0.1]:50318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dughy-0004AR-AG for submit@debbugs.gnu.org; Wed, 20 Sep 2017 11:14:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dughw-00049n-Dm for submit@debbugs.gnu.org; Wed, 20 Sep 2017 11:14:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dugg9-0004jb-Td for submit@debbugs.gnu.org; Wed, 20 Sep 2017 11:14:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36381) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dugg9-0002wh-I1 for submit@debbugs.gnu.org; Wed, 20 Sep 2017 11:12:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dufZ5-0007MW-KJ for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 10:01:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dufYy-0007wH-V7 for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 10:01:23 -0400 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]:54340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dufYy-0007vk-M5 for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2017 10:01:16 -0400 Received: by mail-pf0-x235.google.com with SMTP id d187so1563753pfg.11 for ; Wed, 20 Sep 2017 07:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=t5Z5OOXYnUbey5PTr76s0mDMsH6/qQ5ViccUPZ+ntNQ=; b=WAyctgU7vDt51YcKe7P6lyMDcxxnaZ3hpelrFSKypSodxYRx6BCmL7IAAlNm7MnMj4 N7sXyd2ZLbiSsocEMCboAWrKKNjUG71Pgm38JeFM7Mr6mmD0cB2diJVvAf1AAyR6DMQi BLtHTjeI5OXNnTPUbfzJADDj0afbeAUOIfA1VAQ0qsQWaGlOWzimafKIKnCucghSOHUZ S/MT+7gqVPosuFEfP1SLo2+phARaVPFD9Vl9Hwqrf7408b2y+3LslhEuhDTTddrGWNFd V2wb0VKyNZe4rS4eJwQR8zRmfkUHEo1I+y1x97ywwUhQG+73R8bMBz3cqiUy6Suls2pF 9nJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=t5Z5OOXYnUbey5PTr76s0mDMsH6/qQ5ViccUPZ+ntNQ=; b=jWf0IRmekqbgs6psWkPj9+bKCKEvsk/d3iMXca1I2VP03UW5rWwX6GCgMD2zDWpryY 42BYM39LlJyuQDefWbMS6h6J0zrXIPKgxiylkCoEpNkd9V137ooBP3YPzvAbpvvPCkfM Ldvkmj5UzED+DsFLw17ROxbbDe/DlN7cMtQxYLr6ouyVppMSma+uyuDgiMGmsA1BAMr+ CCxWw6j+AIHp/1/OnjToaDiXminSf8W5VVO/BTv/neXvhhVnB6SdQOATwIee3SeJUBw+ XGYs2CIZG9DUXwa/O2SoodintyEfPzGq8X+Dft2YD0h4/RClW009YrfBba9N6xR1B5Ho QapA== X-Gm-Message-State: AHPjjUgO5uqDthj49m5i6MolTqSe+vIl6iWSBpeyOjgpY5tbgHRsON1T MSl7W2uN7kU2PSOBMPDMTCkH/w== X-Google-Smtp-Source: AOwi7QCHThntgCRewifQK/4rj83jVM9JtapfbTP6s7bKJbSPtM2ip7BeZ6V64ey8aw14dkVFSFk1pg== X-Received: by 10.98.29.199 with SMTP id d190mr1603595pfd.74.1505901116539; Wed, 20 Sep 2017 02:51:56 -0700 (PDT) Received: from calancha-pc ([103.5.140.188]) by smtp.gmail.com with ESMTPSA id e69sm7034494pfc.79.2017.09.20.02.51.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Sep 2017 02:51:55 -0700 (PDT) From: Tino Calancha Date: Wed, 20 Sep 2017 18:51:52 +0900 Message-ID: <87mv5pn1dz.fsf@calancha-pc> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) X-Debbugs-CC: npostavs@users.sourceforge.net Tags: patch The following commit dired-do-delete: Allow to delete dirs recursively without prompts (cbea38e5c4af5386192fb9a48ef4fca5080d6561) doesn't consider the case when an user has aliased 'yes-or-no-p' to 'y-or-n-p'. That's annoying if you are used to the previous behaviour. I do. Recently, I had a private communication with an user whom complained about this recent change. Not sure about the ideal fix. The following patch work around the issue adding a new function 'dired-y-or-n-or-a-p', which is called when yes-or-no-p is aliased to y-or-n-p. This function is y-or-n-p with an additional possible answer '!' (aka, automatic), as in query-replace. --8<-----------------------------cut here---------------start------------->8--- commit d764d51c311a8bf6517f558bbdd5f11dff41a0ba Author: Tino Calancha Date: Wed Sep 20 18:28:52 2017 +0900 dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Some users like to redefine yes-or-no-p as an alias of y-or-n-p. For backward compatibility 'dired-delete-file' must behave as usual in that case. * lisp/dired.el (defun dired-y-or-n-or-a-p): New defun. (dired--yes-no-all-quit-help): If yes-or-no-p is fset to y-or-n-p then call defun dired-y-or-n-or-a-p. (dired-delete-file): Update the pcase: it must handle 3 inputs (symbols): 'automatic, t or nil. (dired-delete-help): Delete variable. * test/lisp/dired-tests.el (dired-test-bug27940): Update test. diff --git a/lisp/dired.el b/lisp/dired.el index 782d8ffa51..80c2b9055f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2994,36 +2994,110 @@ dired-recursive-deletes ;; Match anything but `.' and `..'. (defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*") -(defconst dired-delete-help - "Type: -`yes' to delete recursively the current directory, -`no' to skip to next, -`all' to delete all remaining directories with no more questions, -`quit' to exit, -`help' to show this help message.") +(defun dired-y-or-n-or-a-p (prompt) + "Ask user a \"y or n or a\" question. +This is like `y-or-n-p' with an additional answer '!' to +proceed automatically with no mre questions." + (let ((answer 'recenter) + (padded (lambda (prompt &optional dialog) + (let ((l (length prompt))) + (concat prompt + (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) + "" " ") + (if dialog "" "(y or n or !) ")))))) + (cond + (noninteractive + (setq prompt (funcall padded prompt)) + (let ((temp-prompt prompt)) + (while (not (memq answer '(act skip automatic))) + (let ((str (read-string temp-prompt))) + (cond ((member str '("y" "Y")) (setq answer 'act)) + ((member str '("!")) (setq answer 'automatic)) + ((member str '("n" "N")) (setq answer 'skip)) + (t (setq temp-prompt (concat "Please answer y or n or !. " + prompt)))))))) + ((and (display-popup-menus-p) + last-input-event ; not during startup + (listp last-nonmenu-event) + use-dialog-box) + (setq prompt (funcall padded prompt t) + answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip) ("!" . automatic))))) + (t + (setq prompt (funcall padded prompt)) + (while + (let* ((scroll-actions '(recenter scroll-up scroll-down + scroll-other-window scroll-other-window-down)) + (key + (let ((cursor-in-echo-area t)) + (when minibuffer-auto-raise + (raise-frame (window-frame (minibuffer-window)))) + (read-key (propertize (if (memq answer scroll-actions) + prompt + (concat "Please answer y or n or !. " + prompt)) + 'face 'minibuffer-prompt))))) + (setq answer (lookup-key query-replace-map (vector key) t)) + (cond + ((memq answer '(skip act automatic)) nil) + ((eq answer 'recenter) + (recenter) t) + ((eq answer 'scroll-up) + (ignore-errors (scroll-up-command)) t) + ((eq answer 'scroll-down) + (ignore-errors (scroll-down-command)) t) + ((eq answer 'scroll-other-window) + (ignore-errors (scroll-other-window)) t) + ((eq answer 'scroll-other-window-down) + (ignore-errors (scroll-other-window-down)) t) + ((or (memq answer '(exit-prefix quit)) (eq key ?\e)) + (signal 'quit nil) t) + (t t))) + (ding) + (discard-input)))) + (let ((ret (cond ((eq answer 'act)) + (t (and (eq answer 'automatic) 'automatic))))) + (unless noninteractive + (message "%s%c" prompt (cond ((eq ret 'automatic) ?!) (t (if ret ?y ?n))))) + ret))) (defun dired--yes-no-all-quit-help (prompt &optional help-msg) "Ask a question with valid answers: yes, no, all, quit, help. PROMPT must end with '? ', for instance, 'Delete it? '. If optional arg HELP-MSG is non-nil, then is a message to show when the user answers 'help'. Otherwise, default to `dired-delete-help'." - (let ((valid-answers (list "yes" "no" "all" "quit")) - (answer "") - (input-fn (lambda () - (read-string - (format "%s [yes, no, all, quit, help] " prompt))))) - (setq answer (funcall input-fn)) - (when (string= answer "help") - (with-help-window "*Help*" - (with-current-buffer "*Help*" - (insert (or help-msg dired-delete-help))))) - (while (not (member answer valid-answers)) - (unless (string= answer "help") - (beep) - (message "Please answer `yes' or `no' or `all' or `quit'") - (sleep-for 2)) - (setq answer (funcall input-fn))) - answer)) + ;; Some people redefine 'yes-or-no-p as 'y-or-n-p; for backward + ;; compatibility we must check if that is the case. + (if (eq (symbol-function 'yes-or-no-p) 'y-or-n-p) + (dired-y-or-n-or-a-p prompt) + (let* ((valid-answers (list 'act 'skip 'automatic)) + (input-fn (lambda () + (let ((str + (read-string + (format "%s [yes, no, automatic, help] " prompt)))) + (cond ((string-match "\\`yes\\'" str) 'act) + ((string-match "\\`no\\'" str) 'skip) + ((string-match "\\`automatic\\'" str) 'automatic) + ((string-match "\\`help\\'" str) 'help))))) + (dired-delete-help + (format "Type: +`%s' to delete recursively the current directory, +`%s' to skip to next, +`%s' to delete automatic remaining directories with no more questions, +`%s' to show this help message." + "yes" "no" "automatic" "help"))) + (let ((answer (funcall input-fn))) + (when (eq answer 'help) + (with-help-window "*Help*" + (with-current-buffer "*Help*" + (insert (or help-msg dired-delete-help))))) + (while (not (member answer valid-answers)) + (unless (eq answer 'help) + (beep) + (message "Please answer `yes' or `no' or `automatic'") + (sleep-for 2)) + (setq answer (funcall input-fn))) + (cond ((eq answer 'act)) + (t (and (eq answer 'automatic) 'automatic))))))) ;; Delete file, possibly delete a directory and all its files. ;; This function is useful outside of dired. One could change its name @@ -3055,10 +3129,9 @@ dired-delete-file "delete") (dired-make-relative file)))) (pcase (dired--yes-no-all-quit-help prompt) ; Prompt user. - ('"all" (setq recursive 'always dired-recursive-deletes recursive)) - ('"yes" (if (eq recursive 'top) (setq recursive 'always))) - ('"no" (setq recursive nil)) - ('"quit" (keyboard-quit))))) + ('automatic (setq recursive 'always dired-recursive-deletes recursive)) + ('t (if (eq recursive 'top) (setq recursive 'always))) + ('nil (setq recursive nil))))) (setq recursive nil)) ; Empty dir or recursive is nil. (delete-directory file recursive trash)))) diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 99006eca3e..fb9988ee06 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -399,7 +399,7 @@ dired-test-with-temp-dirs ;; Answer yes (dired-test-with-temp-dirs nil - (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) "yes") + (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) t) '((name . dired-test-bug27940-advice))) (dired default-directory) (dired-toggle-marks) @@ -410,7 +410,7 @@ dired-test-with-temp-dirs ;; Answer no (dired-test-with-temp-dirs nil - (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) "no") + (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) nil) '((name . dired-test-bug27940-advice))) (dired default-directory) (dired-toggle-marks) @@ -418,10 +418,10 @@ dired-test-with-temp-dirs (unwind-protect (should (= 5 (length (dired-get-marked-files)))) ; Just the empty dirs deleted. (advice-remove 'dired--yes-no-all-quit-help 'dired-test-bug27940-advice))) - ;; Answer all + ;; Answer automatic (dired-test-with-temp-dirs nil - (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) "all") + (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) 'automatic) '((name . dired-test-bug27940-advice))) (dired default-directory) (dired-toggle-marks) @@ -432,7 +432,7 @@ dired-test-with-temp-dirs ;; Answer quit (dired-test-with-temp-dirs nil - (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) "quit") + (advice-add 'dired--yes-no-all-quit-help :override (lambda (_) (signal 'quit nil)) '((name . dired-test-bug27940-advice))) (dired default-directory) (dired-toggle-marks) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 27.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-20 built on calancha-pc Repository revision: b1f83c10df7d1bbb16f4e13d18119ad4aa1a2137 From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Sep 2017 08:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: npostavs@users.sourceforge.net, 28525@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.15059817673802 (code B ref 28525); Thu, 21 Sep 2017 08:17:01 +0000 Received: (at 28525) by debbugs.gnu.org; 21 Sep 2017 08:16:07 +0000 Received: from localhost ([127.0.0.1]:50859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duweU-0000zG-Qc for submit@debbugs.gnu.org; Thu, 21 Sep 2017 04:16:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50095) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duweT-0000yW-Ui for 28525@debbugs.gnu.org; Thu, 21 Sep 2017 04:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duweL-0001DV-Eo for 28525@debbugs.gnu.org; Thu, 21 Sep 2017 04:16:00 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duwe3-0007IC-Iv; Thu, 21 Sep 2017 04:15:39 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4210 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1duwe2-0007RZ-UU; Thu, 21 Sep 2017 04:15:39 -0400 Date: Thu, 21 Sep 2017 11:15:31 +0300 Message-Id: <83zi9oeacc.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <87mv5pn1dz.fsf@calancha-pc> (message from Tino Calancha on Wed, 20 Sep 2017 18:51:52 +0900) References: <87mv5pn1dz.fsf@calancha-pc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tino Calancha > Date: Wed, 20 Sep 2017 18:51:52 +0900 > Cc: npostavs@users.sourceforge.net > > The following commit > > dired-do-delete: Allow to delete dirs recursively without prompts > (cbea38e5c4af5386192fb9a48ef4fca5080d6561) > > doesn't consider the case when an user has aliased 'yes-or-no-p' > to 'y-or-n-p'. That's annoying if you are used to the previous > behaviour. I do. > Recently, I had a private communication with an user whom > complained about this recent change. > > Not sure about the ideal fix. The following patch work > around the issue adding a new function > 'dired-y-or-n-or-a-p', which is called when yes-or-no-p is aliased to > y-or-n-p. This function is y-or-n-p with an additional > possible answer '!' (aka, automatic), as in query-replace. People who make such aliases will have to change their aliases to support the 3rd option, right. What function would they use for that? Does such a function exist? If it doesn't exist, then what is the complaint wrt this change, exactly? We can be asked to do one of the following: . continue supporting y-or-n-p as a defalias of yes-or-no-p, with the understanding that the users who do that will not have a way to use the new functionality; or . allow users to specify a function that accepts single-key responses, like y-or-n-p, but also allows to select the new functionality, e.g., with '!' The solution in each of these cases is different. So we should first decide which problem are we trying to solve. From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Sep 2017 13:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 28525@debbugs.gnu.org, npostavs@users.sourceforge.net Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150677646810045 (code B ref 28525); Sat, 30 Sep 2017 13:02:02 +0000 Received: (at 28525) by debbugs.gnu.org; 30 Sep 2017 13:01:08 +0000 Received: from localhost ([127.0.0.1]:40127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyHOE-0002bv-BQ for submit@debbugs.gnu.org; Sat, 30 Sep 2017 09:01:08 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:49622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyHOB-0002bJ-Ii for 28525@debbugs.gnu.org; Sat, 30 Sep 2017 09:01:04 -0400 Received: by mail-pf0-f175.google.com with SMTP id l188so1014635pfc.6 for <28525@debbugs.gnu.org>; Sat, 30 Sep 2017 06:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=5/XN2wuhlqhfra99joqXAuP168DzRLFBAlb9JKQKhr8=; b=C6oWy53MAGYJ4oHiquZvb1NxxJcSwDcGZYV08JGQiLa2MAmRBvtO9A2b7mLZTAViPM FjJN7d1d07C1ToKLCo525WdNGJKdY2hgXaZjACaJ9EmlRlCZJ7WxEvDNgtPv1BtKmlTR x8s91ZbOVRZbJ9a1HnHeS2RNS3zvah2N+uwVmKEudzNOQOf3+3TOZ6oQUHQmL59GO7dl l8ho5mv35Dgm5VsfyPjsBPB+b5xk5O56q9+XRMt1s3LDTMr9OEqWWl1DXpIS5BesCZmq VPD45ceMmMB7l0eXFBfy0H/tzWLUx0bLeGKH/gjR8ZP5ka4n1tJBNHNP04efTnoXZM4c 1ZOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=5/XN2wuhlqhfra99joqXAuP168DzRLFBAlb9JKQKhr8=; b=M2WjEV/OiunxTNf0fBShVx1vF16zb27uGqehubPmiollw2O3HzlRKDSMGoqdn+kcJl 5biTSCdRP/yzNNPehUNkflqjNrWqL0byMdzVK4xM29SiNT7OThsyLjkQqbkm4TMaSELM 45r1zPPxD2ldPrFV5RrGfGGJqtWKunI7HrNjmt8PgIayUlshBNOXyXhwmo/jwaaSjBnk YL3e1aLRwR4kkVE4X9ALogOIvz/A9q9Yif9D6WazbLEfJguABos6dVD2LQv8cp4u5LRD dsWMDui+2CYVaYi8zyNTiP8DOJ+wd9RgTOLUvu/s6u/l0G++qanWRT1LOzL20dRI5gHZ kILA== X-Gm-Message-State: AHPjjUiTAPFsu5Kuu2pk7wAotJ2pdtfXn+68MEpX+sHhFQMbn7E07J9r /y89FyyjmXSWwaBAlCNrzZH+XQ== X-Google-Smtp-Source: AOwi7QDJlDi9YSueUNZm1a/RkLaznQsSW+GgPdQhp8lBtkD0cULoQWcRaMv2RNEPwMGuBNddHzPhOA== X-Received: by 10.98.137.150 with SMTP id n22mr10448877pfk.104.1506776457025; Sat, 30 Sep 2017 06:00:57 -0700 (PDT) Received: from calancha-pc (203.191.218.133.dy.bbexcite.jp. [133.218.191.203]) by smtp.gmail.com with ESMTPSA id o128sm9114762pga.5.2017.09.30.06.00.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Sep 2017 06:00:55 -0700 (PDT) From: Tino Calancha References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> Date: Sat, 30 Sep 2017 22:00:46 +0900 In-Reply-To: <83zi9oeacc.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 21 Sep 2017 11:15:31 +0300") Message-ID: <87tvzktk75.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.8 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Eli Zaretskii writes: >> dired-do-delete: Allow to delete dirs recursively without prompts >> (cbea38e5c4af5386192fb9a48ef4fca5080d6561) >>=20 >> doesn't consider the case when an user has aliased 'yes-or-no-p' >> to 'y-or-n-p'. That's annoying if you are used to the previous >> behaviour. > > People who make such aliases will have to change their aliases to > support the 3rd option, right. What function would they use for that? > Does such a function exist? If it doesn't exist, then what is the > complaint wrt this change, exactly? In my previous patch i checked if `yes-or-no-p' is aliased to `y-or-n-p'. A more general way is to add new functions `yes-or-no-or-else-p', `y-or-n-or-else-p': they ask the question and accept additional answers according with an optional argument. Then we could rewrite the feature using `yes-or-no-or-else-p'. Users might do: (fset 'yes-or-no-or-else-p 'y-or-n-or-else-p) so that they can answer just 'y' or 'n' as before, or even answer '!' to accept all. (yes-or-no-or-else-p "Do it? " '((! . automatic) (\? . help))) (y-or-n-or-else-p "Do it? " '((! . automatic) (\? . help))) The former accepts answers: yes, no, automatic, help The latter accepts: y, n, !, ? > We can be asked to do one of the following: > > . continue supporting y-or-n-p as a defalias of yes-or-no-p, with > the understanding that the users who do that will not have a way > to use the new functionality; or > . allow users to specify a function that accepts single-key > responses, like y-or-n-p, but also allows to select the new > functionality, e.g., with '!' > The solution in each of these cases is different. So we should first > decide which problem are we trying to solve. I prefer the second option. I guess it must be easy to write using `yes-or= -no-or-else-p'. --8<-----------------------------cut here---------------start------------->= 8--- commit 47164987830769282f690a3c3fd9ee36772d5d12 Author: Tino Calancha Date: Sat Sep 30 21:51:55 2017 +0900 New functions: yes-or-no-or-else-p and y-or-n-or-else-p =20=20=20=20 * src/fns.c (yes-or-no-else-p): New defun. (yes-or-no-p): Use it. * lisp/subr.el (y-or-n-or-else-p): Like y-or-n-p with more possible answers specified by arg OTHERS. (y-or-n-p): Use it. diff --git a/lisp/subr.el b/lisp/subr.el index cf15ec287f..6f3f5dabfd 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2484,73 +2484,65 @@ sit-for ;; Behind display-popup-menus-p test. (declare-function x-popup-dialog "menu.c" (position contents &optional hea= der)) =20 -(defun y-or-n-p (prompt) - "Ask user a \"y or n\" question. -Return t if answer is \"y\" and nil if it is \"n\". -PROMPT is the string to display to ask the question. It should -end in a space; `y-or-n-p' adds \"(y or n) \" to it. - -No confirmation of the answer is requested; a single character is -enough. SPC also means yes, and DEL means no. - -To be precise, this function translates user input into responses -by consulting the bindings in `query-replace-map'; see the -documentation of that variable for more information. In this -case, the useful bindings are `act', `skip', `recenter', -`scroll-up', `scroll-down', and `quit'. -An `act' response means yes, and a `skip' response means no. -A `quit' response means to invoke `keyboard-quit'. -If the user enters `recenter', `scroll-up', or `scroll-down' -responses, perform the requested window recentering or scrolling -and ask again. - -Under a windowing system a dialog box will be used if `last-nonmenu-event' -is nil and `use-dialog-box' is non-nil." - ;; =C2=A1Beware! when I tried to edebug this code, Emacs got into a weir= d state - ;; where all the keys were unbound (i.e. it somehow got triggered - ;; within read-key, apparently). I had to kill it. - (let ((answer 'recenter) - (padded (lambda (prompt &optional dialog) - (let ((l (length prompt))) - (concat prompt - (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) - "" " ") - (if dialog "" "(y or n) ")))))) +(defun y-or-n-or-else-p (prompt &optional others) + "Ask user a \"y or n or ...\" question. +OTHERS is a list (INPUT . ACTION), with INPUT the user +input, and ACTION determines how to proceed; both are symbols. +For instance, SYMBOL might be '!' and ACTION 'automatic'. + +This is like `y-or-n-p' with the additional answers in OTHERS." + (let* ((answer 'recenter) + (options (mapcar #'car others)) + (options-str (mapconcat #'identity + (append (list "y" "n") + (mapcar (lambda (x) (symbol-name (car= x))) others)) " or ")) + (actions (append '(skip act) (mapcar #'cdr others))) + (padded (lambda (prompt &optional dialog) + (let ((l (length prompt))) + (concat prompt + (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) + "" " ") + (if dialog "" (concat "(" options-str ")"))))))) (cond (noninteractive (setq prompt (funcall padded prompt)) (let ((temp-prompt prompt)) - (while (not (memq answer '(act skip))) + (while (not (memq answer actions)) (let ((str (read-string temp-prompt))) (cond ((member str '("y" "Y")) (setq answer 'act)) + ((assoc (intern str) others) (setq answer (cdr (assoc (i= ntern str) others)))) ((member str '("n" "N")) (setq answer 'skip)) - (t (setq temp-prompt (concat "Please answer y or n. " + (t (setq temp-prompt (concat "Please answer " options-str ". " prompt)))))))) ((and (display-popup-menus-p) last-input-event ; not during startup (listp last-nonmenu-event) use-dialog-box) (setq prompt (funcall padded prompt t) - answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) + answer + (x-popup-dialog + t + `(,prompt ("Yes" . act) ("No" . skip) + (mapcar (lambda (x) (cons (symbol-name (car x)) (cd= r x))) others))))) (t (setq prompt (funcall padded prompt)) (while (let* ((scroll-actions '(recenter scroll-up scroll-down - scroll-other-window scroll-other-window-down)) + scroll-other-window scroll-other-window-down)) (key (let ((cursor-in-echo-area t)) (when minibuffer-auto-raise (raise-frame (window-frame (minibuffer-window)))) (read-key (propertize (if (memq answer scroll-actions) prompt - (concat "Please answer y or n.= " - prompt)) + (concat "Please answer " optio= ns-str ". " prompt)) 'face 'minibuffer-prompt))))) (setq answer (lookup-key query-replace-map (vector key) t)) (cond - ((memq answer '(skip act)) nil) - ((eq answer 'recenter) - (recenter) t) + ((memq answer actions) nil) + ((member (intern (char-to-string key)) options) + (setq answer (cdr (assoc (intern (char-to-string key)) other= s))) nil) + ((eq answer 'recenter) (recenter) t) ((eq answer 'scroll-up) (ignore-errors (scroll-up-command)) t) ((eq answer 'scroll-down) @@ -2564,11 +2556,43 @@ y-or-n-p (t t))) (ding) (discard-input)))) - (let ((ret (eq answer 'act))) + (let ((ret (cond ((eq answer 'act)) + ((eq answer 'skip) nil) + ((memq answer actions) answer)))) (unless noninteractive - (message "%s%c" prompt (if ret ?y ?n))) + (message "%s%c" prompt (cond ((eq ret t) ?y) + ((null ret) ?n) + ((memq ret actions) + (string-to-char (symbol-name (car (r= assoc ret others)))))))) ret))) =20 +(defun y-or-n-p (prompt) + "Ask user a \"y or n\" question. +Return t if answer is \"y\" and nil if it is \"n\". +PROMPT is the string to display to ask the question. It should +end in a space; `y-or-n-p' adds \"(y or n) \" to it. + +No confirmation of the answer is requested; a single character is +enough. SPC also means yes, and DEL means no. + +To be precise, this function translates user input into responses +by consulting the bindings in `query-replace-map'; see the +documentation of that variable for more information. In this +case, the useful bindings are `act', `skip', `recenter', +`scroll-up', `scroll-down', and `quit'. +An `act' response means yes, and a `skip' response means no. +A `quit' response means to invoke `keyboard-quit'. +If the user enters `recenter', `scroll-up', or `scroll-down' +responses, perform the requested window recentering or scrolling +and ask again. + +Under a windowing system a dialog box will be used if `last-nonmenu-event' +is nil and `use-dialog-box' is non-nil." + ;; =C2=A1Beware! when I tried to edebug this code, Emacs got into a weir= d state + ;; where all the keys were unbound (i.e. it somehow got triggered + ;; within read-key, apparently). I had to kill it. + (y-or-n-or-else-p prompt)) + ;;; Atomic change groups. =20 diff --git a/src/fns.c b/src/fns.c index 4524ff9b26..5eee5d380f 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2582,20 +2582,27 @@ do_yes_or_no_p (Lisp_Object prompt) return call1 (intern ("yes-or-no-p"), prompt); } =20 -DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, - doc: /* Ask user a yes-or-no question. -Return t if answer is yes, and nil if the answer is no. +DEFUN ("yes-or-no-or-else-p", Fyes_or_no_or_else_p, Syes_or_no_or_else_p, = 1, 2, 0, + doc: /* Ask user a yes or no or ... question. +OTHERS is a list (INPUT . ACTION), with INPUT the user +input, and ACTION determines how to proceed; both are symbols. +For instance, SYMBOL might be '!' and ACTION 'automatic'. + +Return t if answer is yes, nil if the answer is no or ACTION if the answer +is ACTION. PROMPT is the string to display to ask the question. It should end in -a space; `yes-or-no-p' adds \"(yes or no) \" to it. +a space; `yes-or-no-or-else-p' adds \"(yes or no or ACTION1 or ACTION2 ...= ) \" to it. =20 The user must confirm the answer with RET, and can edit it until it has been confirmed. =20 If dialog boxes are supported, a dialog box will be used -if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) - (Lisp_Object prompt) +if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. + +This function is like `yes-or-no-p' with the additional answers in OTHERS.= */) + (Lisp_Object prompt, Lisp_Object others) { - Lisp_Object ans; + Lisp_Object ans, yes_or_no, actions, str; =20 CHECK_STRING (prompt); =20 @@ -2611,9 +2618,21 @@ if `last-nonmenu-event' is nil, and `use-dialog-box'= is non-nil. */) return obj; } =20 - AUTO_STRING (yes_or_no, "(yes or no) "); - prompt =3D CALLN (Fconcat, prompt, yes_or_no); - + if (!NILP (others)) { + actions =3D Fmapcar (intern ("symbol-name"), Fmapcar (Qcdr, others)); + yes_or_no =3D Fmapconcat (Qidentity, + CALLN (Fappend, list2 (build_string ("yes"), + build_string ("no")), + actions), + build_string (" or ")); + yes_or_no =3D CALLN (Fconcat, build_string ("("), yes_or_no, build_str= ing (")")); + } + else { + actions =3D Qnil; + yes_or_no =3D build_string ("(yes or no)"); + } + prompt =3D CALLN (Fconcat, prompt, yes_or_no, build_string (" ")); + str =3D CALLN (Fconcat, build_string ("Please answer "), yes_or_no, buil= d_string (".")); while (1) { ans =3D Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, @@ -2623,13 +2642,31 @@ if `last-nonmenu-event' is nil, and `use-dialog-box= ' is non-nil. */) return Qt; if (SCHARS (ans) =3D=3D 2 && !strcmp (SSDATA (ans), "no")) return Qnil; + if (!NILP (Fmember (ans, actions))) + return Fcdr (Frassoc (intern (SSDATA (ans)), others)); =20 Fding (Qnil); Fdiscard_input (); - message1 ("Please answer yes or no."); + message1 (SSDATA (str)); Fsleep_for (make_number (2), Qnil); } } + +DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, + doc: /* Ask user a yes-or-no question. +Return t if answer is yes, and nil if the answer is no. +PROMPT is the string to display to ask the question. It should end in +a space; `yes-or-no-p' adds \"(yes or no) \" to it. + +The user must confirm the answer with RET, and can edit it until it +has been confirmed. + +If dialog boxes are supported, a dialog box will be used +if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) + (Lisp_Object prompt) +{ + return Fyes_or_no_or_else_p (prompt, Qnil); +} DEFUN ("load-average", Fload_average, Sload_average, 0, 1, 0, doc: /* Return list of 1 minute, 5 minute and 15 minute load averag= es. @@ -5273,6 +5310,7 @@ this variable. */); defsubr (&Smapcan); defsubr (&Smapconcat); defsubr (&Syes_or_no_p); + defsubr (&Syes_or_no_or_else_p); defsubr (&Sload_average); defsubr (&Sfeaturep); defsubr (&Srequire); --8<-----------------------------cut here---------------end--------------->= 8--- In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-29 Repository revision: 20a09de953f437109a098fa8c4d380663d921481 From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Oct 2017 04:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: npostavs@users.sourceforge.net, 28525@debbugs.gnu.org Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150683081028290 (code B ref 28525); Sun, 01 Oct 2017 04:07:01 +0000 Received: (at 28525) by debbugs.gnu.org; 1 Oct 2017 04:06:50 +0000 Received: from localhost ([127.0.0.1]:41659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyVWj-0007ME-UM for submit@debbugs.gnu.org; Sun, 01 Oct 2017 00:06:50 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:56319) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyVWh-0007Lx-Sb for 28525@debbugs.gnu.org; Sun, 01 Oct 2017 00:06:48 -0400 Received: by mail-pg0-f42.google.com with SMTP id b11so1519416pgn.12 for <28525@debbugs.gnu.org>; Sat, 30 Sep 2017 21:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=TxEkCqQYkMe/ATDKg0uMs5ej5/YwPslXw9pGPoYq4Ho=; b=WTLqIDIodxNCCAY24FvREYaPa+HE4O/Z6dQTPvWCz1kZRq2r2lSMG/1vpZdxdnYI9G 6ZtYfmEu3iGUPgHETWLEtzIYj+3MJ8aR3cfMoBjSereWnjapR1pc3YT2mWhJxbXVtYIl 8MnF8GMQAJ2kKItZY1g6/mGll+1w/uUTWEe/cXHqelL0/pfNZhyilSn6/B2iirPL4xyL qFl0v1uct9uIKNrMBHHMhyYTmw95JYx6dZpeMjNy2JcGlsFNgTG2qnhz02QOIT6fnfK6 /uE7Lm8fCUUV0GOcsTA3rzfNZF/VaJW3U40YQUb/ArRDQEhnz8CBz7J0F2n3dqEUHR13 GVCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=TxEkCqQYkMe/ATDKg0uMs5ej5/YwPslXw9pGPoYq4Ho=; b=I0x/kJ3fCvJJpDUrwn8Xx2RKDWs7gvg3h+k6b1YDW2V7u1h+QohrgVqDPVSSXzKasz gEwJXss1G1H6InRXYJ6GFCl/YbJTN+SE43jGs16JznV962K9E1Tgz+Fa1kMgR0irjAM5 NxAH5iJ6lN5huS1DUuSDePPcf8/so2MSqe0ZlpbIpRVioaqMtdO45yolO+NfE4Au6D3u FX4bNFV3mAn67SQobwbDnGj5RhlQbR701cVcowrK05No4LblSmJiCLUIOYehgJpqN8v5 gifi6JDz1hOOcp4CIRvUGZRKhtNGh+wd2xH43B1wCdBfbe6F2xuLkPzW44S8Zu7olooM eBRw== X-Gm-Message-State: AHPjjUj2JtqhlmL5DCm1qc9kXM8afj0J5xbVl3/NTHIJGWT8N4eLSzdc nocqbGEKb4+YQ1VwsgGDgzI= X-Google-Smtp-Source: AOwi7QBDmOO7McwAf4YBvXilfOIgsZ/E70ieGEOrEMxiClALF+O2yuViWij01zRGwQtSMayyNnl3RA== X-Received: by 10.159.211.76 with SMTP id g12mr11246689plp.312.1506830801908; Sat, 30 Sep 2017 21:06:41 -0700 (PDT) Received: from calancha-pc (203.191.218.133.dy.bbexcite.jp. [133.218.191.203]) by smtp.gmail.com with ESMTPSA id m82sm12172730pfk.90.2017.09.30.21.06.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Sep 2017 21:06:40 -0700 (PDT) From: Tino Calancha References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> Date: Sun, 01 Oct 2017 13:06:32 +0900 In-Reply-To: <87tvzktk75.fsf@gmail.com> (Tino Calancha's message of "Sat, 30 Sep 2017 22:00:46 +0900") Message-ID: <87poa7tstz.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Tino Calancha writes: > In my previous patch i checked if `yes-or-no-p' is aliased to > `y-or-n-p'. > A more general way is to add new functions `yes-or-no-or-else-p', > `y-or-n-or-else-p': they ask the question and > accept additional answers according with an optional argument. Indeed, we don't need new functions just add an optional argument makes the thing (see below patch). In some cases it might be useful to allow more answers than just 'yes' or 'no'. (yes-or-no-p "Do it? ") ; Accepts 'yes' or 'no' (yes-or-no-p "Do it? " '((l . later) (m . maybe))) ;; Also accepts 'later' and 'maybe'. (y-or-n-p "Do it? " '((l . later) (m . maybe))) ;; Accepts: 'y', 'n', 'l' and 'm'. This has the advantage that is backward compatible for users doing: (fset 'yes-or-no-p 'y-or-n-p) Then, these users can use the new feature answering '!', if we write something like: (yes-or-no-p "Recursively delete dir? " '((! . all) (q . quit) (h . help))) --8<-----------------------------cut here---------------start------------->= 8--- commit 17b1d3715b3d07c487b5b9cc757fc2ce5e0a89a9 Author: Tino Calancha Date: Sun Oct 1 12:44:41 2017 +0900 Accept more answers in yes-or-no-or-else-p and y-or-n-or-else-p =20=20=20=20 * src/fns.c (yes-or-no-p) * lisp/subr.el (y-or-n-or-p): Add optional argument OTHERS. diff --git a/lisp/subr.el b/lisp/subr.el index cf15ec287f..1b11e84dd0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2484,8 +2484,13 @@ sit-for ;; Behind display-popup-menus-p test. (declare-function x-popup-dialog "menu.c" (position contents &optional hea= der)) =20 -(defun y-or-n-p (prompt) - "Ask user a \"y or n\" question. +(defun y-or-n-p (prompt &optional others) + "Ask user a \"y or n r ...\" question. + +OTHERS is a list (INPUT . ACTION), with INPUT the user +input, and ACTION determines how to proceed; both are symbols. +For instance, SYMBOL might be '!' and ACTION 'automatic'. + Return t if answer is \"y\" and nil if it is \"n\". PROMPT is the string to display to ask the question. It should end in a space; `y-or-n-p' adds \"(y or n) \" to it. @@ -2509,48 +2514,58 @@ y-or-n-p ;; =C2=A1Beware! when I tried to edebug this code, Emacs got into a weir= d state ;; where all the keys were unbound (i.e. it somehow got triggered ;; within read-key, apparently). I had to kill it. - (let ((answer 'recenter) - (padded (lambda (prompt &optional dialog) - (let ((l (length prompt))) - (concat prompt - (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) - "" " ") - (if dialog "" "(y or n) ")))))) + (let* ((answer 'recenter) + (options (mapcar #'car others)) + (options-str (mapconcat #'identity + (append (list "y" "n") + (mapcar (lambda (x) (symbol-name = (car x))) others)) " or ")) + (actions (append '(skip act) (mapcar #'cdr others))) + (padded (lambda (prompt &optional dialog) + (let ((l (length prompt))) + (concat prompt + (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) + "" " ") + (if dialog "" (concat "(" options-str ")"))))))) (cond (noninteractive (setq prompt (funcall padded prompt)) (let ((temp-prompt prompt)) - (while (not (memq answer '(act skip))) + (while (not (memq answer actions)) (let ((str (read-string temp-prompt))) (cond ((member str '("y" "Y")) (setq answer 'act)) + ((assoc (intern str) others) (setq answer (cdr (assoc (i= ntern str) others)))) ((member str '("n" "N")) (setq answer 'skip)) - (t (setq temp-prompt (concat "Please answer y or n. " + (t (setq temp-prompt (concat "Please answer " options-str ". " prompt)))))))) ((and (display-popup-menus-p) last-input-event ; not during startup (listp last-nonmenu-event) use-dialog-box) (setq prompt (funcall padded prompt t) - answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) + answer + (x-popup-dialog + t + `(,prompt ("Yes" . act) ("No" . skip) + (mapcar (lambda (x) (cons (symbol-name (car x)) (cd= r x))) others))))) (t (setq prompt (funcall padded prompt)) (while (let* ((scroll-actions '(recenter scroll-up scroll-down - scroll-other-window scroll-other-window-down)) + scroll-other-window scroll-other-window-down)) (key (let ((cursor-in-echo-area t)) (when minibuffer-auto-raise (raise-frame (window-frame (minibuffer-window)))) (read-key (propertize (if (memq answer scroll-actions) prompt - (concat "Please answer y or n.= " - prompt)) + (concat "Please answer " optio= ns-str ". " prompt)) 'face 'minibuffer-prompt))))) (setq answer (lookup-key query-replace-map (vector key) t)) (cond - ((memq answer '(skip act)) nil) - ((eq answer 'recenter) - (recenter) t) + ((memq answer actions) nil) + ((member (intern (char-to-string key)) options) + (setq answer (cdr (assoc (intern (char-to-string key)) other= s))) nil) + ((eq answer 'recenter) (recenter) t) ((eq answer 'scroll-up) (ignore-errors (scroll-up-command)) t) ((eq answer 'scroll-down) @@ -2564,9 +2579,14 @@ y-or-n-p (t t))) (ding) (discard-input)))) - (let ((ret (eq answer 'act))) + (let ((ret (cond ((eq answer 'act)) + ((eq answer 'skip) nil) + ((memq answer actions) answer)))) (unless noninteractive - (message "%s%c" prompt (if ret ?y ?n))) + (message "%s%c" prompt (cond ((eq ret t) ?y) + ((null ret) ?n) + ((memq ret actions) + (string-to-char (symbol-name (car (r= assoc ret others)))))))) ret))) =20 diff --git a/src/fns.c b/src/fns.c index 4524ff9b26..a9e1a864cd 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2582,20 +2582,27 @@ do_yes_or_no_p (Lisp_Object prompt) return call1 (intern ("yes-or-no-p"), prompt); } =20 -DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, - doc: /* Ask user a yes-or-no question. -Return t if answer is yes, and nil if the answer is no. +DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 2, 0, + doc: /* Ask user a yes or no or ... question. +OTHERS is a list (INPUT . ACTION), with INPUT the user +input, and ACTION determines how to proceed; both are symbols. +For instance, SYMBOL might be '!' and ACTION 'automatic'. + +Return t if answer is yes, nil if the answer is no or ACTION if the answer +is ACTION. PROMPT is the string to display to ask the question. It should end in -a space; `yes-or-no-p' adds \"(yes or no) \" to it. +a space; `yes-or-no-or-else-p' adds \"(yes or no or ACTION1 or ACTION2 ...= ) \" to it. =20 The user must confirm the answer with RET, and can edit it until it has been confirmed. =20 If dialog boxes are supported, a dialog box will be used -if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) - (Lisp_Object prompt) +if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. + +This function is like `yes-or-no-p' with the additional answers in OTHERS.= */) + (Lisp_Object prompt, Lisp_Object others) { - Lisp_Object ans; + Lisp_Object ans, yes_or_no, actions, str; =20 CHECK_STRING (prompt); =20 @@ -2611,9 +2618,21 @@ if `last-nonmenu-event' is nil, and `use-dialog-box'= is non-nil. */) return obj; } =20 - AUTO_STRING (yes_or_no, "(yes or no) "); - prompt =3D CALLN (Fconcat, prompt, yes_or_no); - + if (!NILP (others)) { + actions =3D Fmapcar (intern ("symbol-name"), Fmapcar (Qcdr, others)); + yes_or_no =3D Fmapconcat (Qidentity, + CALLN (Fappend, list2 (build_string ("yes"), + build_string ("no")), + actions), + build_string (" or ")); + yes_or_no =3D CALLN (Fconcat, build_string ("("), yes_or_no, build_str= ing (")")); + } + else { + actions =3D Qnil; + yes_or_no =3D build_string ("(yes or no)"); + } + prompt =3D CALLN (Fconcat, prompt, yes_or_no, build_string (" ")); + str =3D CALLN (Fconcat, build_string ("Please answer "), yes_or_no, buil= d_string (".")); while (1) { ans =3D Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, @@ -2623,13 +2642,16 @@ if `last-nonmenu-event' is nil, and `use-dialog-box= ' is non-nil. */) return Qt; if (SCHARS (ans) =3D=3D 2 && !strcmp (SSDATA (ans), "no")) return Qnil; + if (!NILP (Fmember (ans, actions))) + return Fcdr (Frassoc (intern (SSDATA (ans)), others)); =20 Fding (Qnil); Fdiscard_input (); - message1 ("Please answer yes or no."); + message1 (SSDATA (str)); Fsleep_for (make_number (2), Qnil); } } + DEFUN ("load-average", Fload_average, Sload_average, 0, 1, 0, doc: /* Return list of 1 minute, 5 minute and 15 minute load averag= es. --8<-----------------------------cut here---------------end--------------->= 8--- In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-30 Repository revision: 20a09de953f437109a098fa8c4d380663d921481 From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Oct 2017 23:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha , Eli Zaretskii Cc: npostavs@users.sourceforge.net, 28525@debbugs.gnu.org Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150689976714672 (code B ref 28525); Sun, 01 Oct 2017 23:17:02 +0000 Received: (at 28525) by debbugs.gnu.org; 1 Oct 2017 23:16:07 +0000 Received: from localhost ([127.0.0.1]:43210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dynSx-0003oa-DM for submit@debbugs.gnu.org; Sun, 01 Oct 2017 19:16:07 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:44420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dynSv-0003nn-A8 for 28525@debbugs.gnu.org; Sun, 01 Oct 2017 19:16:05 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v91NFwVl028924 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 1 Oct 2017 23:15:58 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v91NFwoN018468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 1 Oct 2017 23:15:58 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v91NFvaw008347; Sun, 1 Oct 2017 23:15:57 GMT MIME-Version: 1.0 Message-ID: <3440084b-1e2d-44d8-a291-44d6622bbbbc@default> Date: Sun, 1 Oct 2017 16:15:56 -0700 (PDT) From: Drew Adams References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> In-Reply-To: <87poa7tstz.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4588.0 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Spam-Score: -5.1 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.1 (-----) FWIW: I don't think that Emacs should test for function aliases and change its behavior accordingly. I don't think users should be encouraged to alias `yes-or-no-p' to `y-or-n-p'. That's a bad idea _in general_, IMO, even if it some users might find it's appropriate for them. I think that making Emacs code automatically recognize such an alias just encourages such (bad) practice on the part of users. ---- FWIW2: It can, however, be helpful to let users override a design choice of `y-or-n-p' or `yes-or-no-p' _for a given calling function_ (as opposed to globally). I've written library Yes-No, to provide such a feature. https://www.emacswiki.org/emacs/Yes-No `yes-no.el' provides no behavior change, except for code that wants to let users decide. For that, the author just provides the symbol for the calling function as an additional argument to the prompting function. For example, the behavior of this call from function `foo' is unchanged: (yes-or-no-p "Agree? "). But this call from function `foo' lets users decide: (yes-or-no-p "Agree? " 'foo). In the latter case, a user can answer `yes', `no', or `use-y-or-n' (which is available with completion). If the latter then the call immediately switches to using `y-or-n-p', and all `yes-or-no-p' calls from function `foo' from then on are redirected to use `y-or-n-p' instead. Similarly, this call from `bar' lets users decide: (y-or-n-p "Agree? " 'bar). Here, a user can answer using character `y', `n', or `e'. Answer `e' switches immediately to using `yes-or-no-p', and all `y-or-n-p' calls from function `bar' from then on are redirected to `yes-or-no-p'. When either redirection is in effect, a user can of course redirect back again, to the original behavior (programmer-defined). And when either redirection is in effect, a user can reset the call to use only the default behavior from then on. To reset a `yes-or-no-p' prompt (redirected from `y-or-n-p') a user chooses input `reset-to-default' (with completion). To reset a `y-or-n-p' prompt (redirected from `yes-or-no-p') a user uses character `^'. A user option lets a user turn off respect of the optional CALLER arg. If nil then there is no change in behavior from vanilla Emacs: no other inputs are allowed besides yes/no or y/n. So even if a library author provides CALLER, to let users decide on a case-by-case basis, a user can choose not to allow herself to do so. (Obviously, a library that uses argument CALLER must require library `yes-no.el'.) The behavior is implemented by putting the symbol for the prompting function to redirect to on the symbol for the calling function, as the value of property `yes/no-prompting'. For example, if a user chooses `use-y-or-n' from `yes-or-no-p' called from `foo', we do this to redirect such calls to prompt with `y-or-n-p': (put 'foo 'yes/no-prompting 'y-or-n-p) Resetting to the default behavior just puts nil as the property value. From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Oct 2017 05:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Drew Adams Cc: npostavs@users.sourceforge.net, Eli Zaretskii , 28525@debbugs.gnu.org, Tino Calancha Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150692283227211 (code B ref 28525); Mon, 02 Oct 2017 05:41:02 +0000 Received: (at 28525) by debbugs.gnu.org; 2 Oct 2017 05:40:32 +0000 Received: from localhost ([127.0.0.1]:43321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dytSx-00074p-Uq for submit@debbugs.gnu.org; Mon, 02 Oct 2017 01:40:32 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:56544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dytSw-00074b-AC for 28525@debbugs.gnu.org; Mon, 02 Oct 2017 01:40:30 -0400 Received: by mail-pg0-f41.google.com with SMTP id n1so1761211pgt.13 for <28525@debbugs.gnu.org>; Sun, 01 Oct 2017 22:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=mQX/et1NovT9gzFbQCuwNKH4+O9HPuCoOLDDgFw7FvI=; b=LjkVbuNAqapPfOVc6mjg+PTqN9YCJPRLBiDkbYYkzAZkYgL8b1YYzWrkXLR10WrQNE Yq0A7cSqUsas3fKsLXnrknNXDBW7bvYWUH7zAVqlPqbIY3YNKLOK2L7wYwKfZ2pG3P1J akVOqXckPOCFa6OkoDtETi40zOuPkRKfNS8EgO4FAbO1Pe7K2ThrwQF4mSi2LRbXmSh2 TEz7hVStmcMSXN1XMG4gvP5Ad4V90bSnGufrA9/VFOu0k4HqX0Vc0Btu5VASBPY53Ier jf+QEUHt5zOkiA9gfFYjCwH3mqCjOf2Hm3bZFJEdE5ygHz7TedeliymDCkbWwUjo5Gss A+4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=mQX/et1NovT9gzFbQCuwNKH4+O9HPuCoOLDDgFw7FvI=; b=CYiPNsx+GpewmllXX4a1wETGZ9N49O+/9PdralZX5M/ZQd3TALUm3adxgb1hy/90R2 14M3VVfj/eeuZP4ldhPq3NeQnsA0PMGT/uQxC1wvCcbGTzvROA0BxgRK32PJiw2cmgyI Km4/50h/cNAm2NqE5Ul0m0gkis6pD2Bh3/qzeqxqBNflWbbFEpM2gWPngi/w1H7d4uo/ QpxiJdEA+mjCuzKaUyj6n+CBYeJH8s+2jaay+aqrNgqeAZJto6kAv8OfHuS+Bdmk6Izj 4EvGWJmWTMyW8Kr2GUmjsXfm5tfqIXcGeERjK8gGeARyWYK6+fdMTUb6xU2TUN/txCgO gTgA== X-Gm-Message-State: AHPjjUhq1eB/K4kJe5iRCciTviKEECKzhsllW6dP/pALG8FXH7RupeRr 775rxQyWEEqgra5KrNqh4Zg= X-Google-Smtp-Source: AOwi7QBb5x7+wKdWwwyInVnIApawZc8Ch8/OH1ZMmImVh7YbcuEVOFi7D5HAiQ1xmGx7dnYjx/TP6g== X-Received: by 10.159.206.134 with SMTP id bg6mr8822821plb.273.1506922824350; Sun, 01 Oct 2017 22:40:24 -0700 (PDT) Received: from calancha-pc (203.191.218.133.dy.bbexcite.jp. [133.218.191.203]) by smtp.gmail.com with ESMTPSA id q125sm6755216pfb.104.2017.10.01.22.40.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Oct 2017 22:40:23 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Mon, 2 Oct 2017 14:40:20 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <3440084b-1e2d-44d8-a291-44d6622bbbbc@default> Message-ID: References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> <3440084b-1e2d-44d8-a291-44d6622bbbbc@default> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Sun, 1 Oct 2017, Drew Adams wrote: > FWIW: I don't think that Emacs should test for > function aliases and change its behavior accordingly. > > I don't think users should be encouraged to alias > `yes-or-no-p' to `y-or-n-p'. That's a bad idea > _in general_, IMO, even if it some users might > find it's appropriate for them. > > I think that making Emacs code automatically > recognize such an alias just encourages such > (bad) practice on the part of users. > > ---- > > FWIW2: It can, however, be helpful to let users > override a design choice of `y-or-n-p' or > `yes-or-no-p' _for a given calling function_ > (as opposed to globally). I've written library > Yes-No, to provide such a feature. > > https://www.emacswiki.org/emacs/Yes-No Thank you for the detailed answer. Your library looks a good solution to add more control where to allow aliasing 'yes-or-no-p to 'y-or-n-p. Here, what i am trying to propose is different: extend the 'yes or no' functions (or add two new functions), so that they accept more than 2 answers. This is inpired in the way `query-replace' works: M-% a RET o RET This prompts to replace 'a' with 'o'. In principle this looks like a 'yes or no' question; actually we can provide additional answers: all possibilities are listed if the user inputs 'h'. For example, '!' performs all replacements without further questions. We find something similar in dired-delete-file: in addition to 'yes', 'no', we can answer to delete all the dirs with no more questions. A function like 'yes-or-no-p' accepting more than 2 answers might be used to handle the examples above, and future cases. From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Oct 2017 13:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: Eli Zaretskii , npostavs@users.sourceforge.net, 28525@debbugs.gnu.org Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150695130122272 (code B ref 28525); Mon, 02 Oct 2017 13:36:01 +0000 Received: (at 28525) by debbugs.gnu.org; 2 Oct 2017 13:35:01 +0000 Received: from localhost ([127.0.0.1]:43525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz0s9-0005n3-89 for submit@debbugs.gnu.org; Mon, 02 Oct 2017 09:35:01 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:21573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz0s7-0005lG-5U for 28525@debbugs.gnu.org; Mon, 02 Oct 2017 09:34:59 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v92DXdMR003316 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 Oct 2017 13:33:39 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v92DXdCQ007463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 Oct 2017 13:33:39 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v92DXbis032526; Mon, 2 Oct 2017 13:33:37 GMT MIME-Version: 1.0 Message-ID: <67c3eddc-d2fc-41c6-ab4d-27291b88be7a@default> Date: Mon, 2 Oct 2017 06:33:36 -0700 (PDT) From: Drew Adams References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> <3440084b-1e2d-44d8-a291-44d6622bbbbc@default> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4588.0 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > Here, what i am trying to propose is different: extend the > 'yes or no' functions (or add two new functions), > so that they accept more than 2 answers. I see. In that case, at least the bug Subject line (title) seems wrong, no? From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Oct 2017 17:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: npostavs@users.sourceforge.net, 28525@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150696612029611 (code B ref 28525); Mon, 02 Oct 2017 17:42:02 +0000 Received: (at 28525) by debbugs.gnu.org; 2 Oct 2017 17:42:00 +0000 Received: from localhost ([127.0.0.1]:44486 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz4j9-0007hX-J0 for submit@debbugs.gnu.org; Mon, 02 Oct 2017 13:41:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz4j6-0007hF-Uh for 28525@debbugs.gnu.org; Mon, 02 Oct 2017 13:41:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz4iy-0002DE-Dm for 28525@debbugs.gnu.org; Mon, 02 Oct 2017 13:41:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz4ij-00020O-Nk; Mon, 02 Oct 2017 13:41:33 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2227 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dz4ii-00052z-TU; Mon, 02 Oct 2017 13:41:33 -0400 Date: Mon, 02 Oct 2017 20:41:15 +0300 Message-Id: <83wp4d1m84.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <87poa7tstz.fsf@gmail.com> (message from Tino Calancha on Sun, 01 Oct 2017 13:06:32 +0900) References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tino Calancha > Cc: 28525@debbugs.gnu.org, npostavs@users.sourceforge.net > Date: Sun, 01 Oct 2017 13:06:32 +0900 > > Tino Calancha writes: > > > In my previous patch i checked if `yes-or-no-p' is aliased to > > `y-or-n-p'. > > A more general way is to add new functions `yes-or-no-or-else-p', > > `y-or-n-or-else-p': they ask the question and > > accept additional answers according with an optional argument. > Indeed, we don't need new functions just add an optional argument makes > the thing (see below patch). > In some cases it might be useful to allow more answers than just 'yes' > or 'no'. On second thought, maybe we should simply ignore this issue, and let users who want to override these functions write their own variants for them? Especially since packages do exist out there to do something like that already. We don't need to solve every single problem with exotic customizations in the core. WDYT? From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Oct 2017 08:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: npostavs@users.sourceforge.net, 28525@debbugs.gnu.org, Tino Calancha Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150701767225362 (code B ref 28525); Tue, 03 Oct 2017 08:02:01 +0000 Received: (at 28525) by debbugs.gnu.org; 3 Oct 2017 08:01:12 +0000 Received: from localhost ([127.0.0.1]:45081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzI8e-0006b0-39 for submit@debbugs.gnu.org; Tue, 03 Oct 2017 04:01:12 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:54961) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzI8Z-0006ai-HD for 28525@debbugs.gnu.org; Tue, 03 Oct 2017 04:01:07 -0400 Received: by mail-it0-f52.google.com with SMTP id e134so10345065ite.3 for <28525@debbugs.gnu.org>; Tue, 03 Oct 2017 01:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ExU5BTSJ7SA0ANx/YKm3A9Lj+JHPS13jhxX/H2WGsoA=; b=Ztzerm4vRMJjV8SCIDRfcsQHPHLYLm/qXSIxri/w/SaWXakuAdAbR+CxcMj030fU1s a6rhvR51nOt6xFhKH0Ncl2BNdXnta9SYoqQW+uZoHEoEE+3pBa9wkwQ6lfNYE9Zpxvhm 8lwB8ktrHXelgf5LUgix02V4/i9AAUX4niu2lQDaK2KvCZcfUxP5dWfRpoPg23e3YmFh vkRuZiOgvhXrgqxRBcgwii+wH7QXNdJB2YgQSEzVcV/THjVMTJayfEqUtjus2oi26dji CFASQK7zh6xYL/dncbaw5cJ7unOuwdeXIiuZ/C0H9u8UwtTkIclCCANbcR6oSyVN3qYo wMKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=ExU5BTSJ7SA0ANx/YKm3A9Lj+JHPS13jhxX/H2WGsoA=; b=q5ZAg6ziPlHlAWUjhgbXyaEP/Zyo5dyQ2bCXcR4G4qpB+vEluxL4cxYyhWS2DUXIvk LfnMdUDwReSa9yl5b53aEvvxmmah43/vJuDcTZAVbfzEjXkqJS+WAvzijCq47QH8E6nL tZDXBBr/sWbGVPqhAFky+zEkqlpB0lIbUvqDGqOdZ1YxM1cDyuYjS8BdUAtiTv5mQW6U EHQvJkP7nW2CCy2voe72ec9CUjPirrd2iCOqsJQEbbxpMdLvjcITNn7rTWjzqK7TaHp2 9yGHjpiifRQ3wT3+MxDp1gytPl+0ZDA1JKzTMt8w+5uchvrW3/ncrzZEoZMmLE85SncD V8qg== X-Gm-Message-State: AMCzsaXv+UmHS+3A1hbRU2JMf/TvG0pTN9LkHfK1IvJ4r3N4d9o/HGfN zszfGZ9FDY8Tkf/byz21BXY= X-Google-Smtp-Source: AOwi7QCCsX+LcP+LJvZlYBv/rkwyOd4OCh+azga3t0VB59FYRkVCmYcOfIEhnR1UBcxxQ6ec0oYYxQ== X-Received: by 10.36.253.9 with SMTP id m9mr11561373ith.105.1507017661857; Tue, 03 Oct 2017 01:01:01 -0700 (PDT) Received: from MAR89-84.kek.jp (MAR89-84.kek.jp. [130.87.89.84]) by smtp.gmail.com with ESMTPSA id v65sm5402020itf.38.2017.10.03.01.00.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 01:01:01 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Tue, 3 Oct 2017 17:00:57 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <83wp4d1m84.fsf@gnu.org> Message-ID: References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> <83wp4d1m84.fsf@gnu.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Mon, 2 Oct 2017, Eli Zaretskii wrote: >>> In my previous patch i checked if `yes-or-no-p' is aliased to >>> `y-or-n-p'. >>> A more general way is to add new functions `yes-or-no-or-else-p', >>> `y-or-n-or-else-p': they ask the question and >>> accept additional answers according with an optional argument. >> Indeed, we don't need new functions just add an optional argument makes >> the thing (see below patch). >> In some cases it might be useful to allow more answers than just 'yes' >> or 'no'. > > On second thought, maybe we should simply ignore this issue, and let > users who want to override these functions write their own variants > for them? Especially since packages do exist out there to do > something like that already. We don't need to solve every single > problem with exotic customizations in the core. Thank you for the comment. That's also a sensible suggestion. Even if we ignore this issue, the existance of a `questionp' which ask a question and allow more than 2 answers (and returns a symbol, easy to check in a `cond' block) might be a useful addition; this is quite general and avoid the need to use `read-string' in cases where the programmer prefers a symbol. If we provide the possible answers as an argument, like in my previous patch, it looks quite explicit. Following the analogy with `yes-or-no-p', `y-or-n-p' it might be a couple of functions so that fset lovers can do: (fset 'questionp 'question-mini-p) So that they can answer just with one key and without RET. Just an idea in mind. Sorry if it's a bad one. From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Oct 2017 08:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Drew Adams Cc: npostavs@users.sourceforge.net, Eli Zaretskii , 28525@debbugs.gnu.org, Tino Calancha Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150701774025493 (code B ref 28525); Tue, 03 Oct 2017 08:03:02 +0000 Received: (at 28525) by debbugs.gnu.org; 3 Oct 2017 08:02:20 +0000 Received: from localhost ([127.0.0.1]:45087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzI9k-0006d6-FA for submit@debbugs.gnu.org; Tue, 03 Oct 2017 04:02:20 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:45903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzI9j-0006cv-Ge for 28525@debbugs.gnu.org; Tue, 03 Oct 2017 04:02:19 -0400 Received: by mail-io0-f181.google.com with SMTP id g32so6888834ioj.2 for <28525@debbugs.gnu.org>; Tue, 03 Oct 2017 01:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=P13oaZoFNl+6vYIWODkj272G9DoxDlDvBiX1sflrXEs=; b=Mg+Gky68aVNhFyGzbd4xSDGajcCjRoFBo3qEN0ubDxT9zgvmrlKlQezovGpot/45X5 LiwsW7nzgpkha3Px0ImRGoVMmizW5X27SWx7w46X+QIs9jsnimjc5z9LwK+T5NdUe2If TDhNU7FVJlMXbWW4n49IjW7bVLLKeghg7NvWq0RyP9cPRKZVD/yV3lbbAddcJcUOL+QO gBzf9Ih6XJQa40Gv5lI3xY30963a3FuDaTJCKDbN0Or4Njdpdfj4OvFOx4cUWF8oNth2 avkJpiVxQ2+UyHuyLmZjUOCcA3rbyPgyjrG3AtMjtfBNSbcQlgGOe5OIkxeP1KX++ffZ h0UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=P13oaZoFNl+6vYIWODkj272G9DoxDlDvBiX1sflrXEs=; b=pnUckYRSF6Sr/2eXNUsLrBJNxWdR6+xpY6KCcAr1To4gNGRszkzeQFkzTBGvCnAxBg UqN+5g87/+UTUNf2oFLt48IzQ/mkiRwUPXMWwSu6m3HWf+LD37F9OWS+UlcbEpdO1uc+ QgrOZ8l+o4xVfYu4R9ywRs+c3VylXsIGj5l2He+trabA4kWIh4htAcONFWmspw8PyNBO c0yM0dKQ//h6NgQe6zj/keIyhbENDKsE8a7gB/Bq/KtjPr3VIud2RCJpnVsSYlWuNXN5 1zirUJ3TR2fWpaxFlYORs84MwY94my2Wa5N+3E85cAwdnj8bZGOvs3tfVNro2FiDYl+H 7s0A== X-Gm-Message-State: AMCzsaWI1LtYuzMZA5n2H+yQ/pW3JJKNtLJQyxhd2USyhSTHuQOfE61j lOMz+Q0XiunzxLoNm0q/+zY= X-Google-Smtp-Source: AOwi7QCXvvGKcEOvad99MiJiOMi6Q0IWb2mY2FK/uXiOMK7qw7PekDJpxow1OZltXUgI5pZcVBZGyA== X-Received: by 10.107.167.129 with SMTP id q123mr24884525ioe.90.1507017733855; Tue, 03 Oct 2017 01:02:13 -0700 (PDT) Received: from MAR89-84.kek.jp (MAR89-84.kek.jp. [130.87.89.84]) by smtp.gmail.com with ESMTPSA id x7sm45399iod.47.2017.10.03.01.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 01:02:13 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Tue, 3 Oct 2017 17:02:10 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <67c3eddc-d2fc-41c6-ab4d-27291b88be7a@default> Message-ID: References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> <3440084b-1e2d-44d8-a291-44d6622bbbbc@default> <67c3eddc-d2fc-41c6-ab4d-27291b88be7a@default> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On Mon, 2 Oct 2017, Drew Adams wrote: >> Here, what i am trying to propose is different: extend the >> 'yes or no' functions (or add two new functions), >> so that they accept more than 2 answers. > > I see. In that case, at least the bug Subject line (title) > seems wrong, no? Of course. Sorry, my bug reports sometimes are under development. From unknown Sat Aug 16 18:46:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Oct 2017 11:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: Eli Zaretskii , npostavs@users.sourceforge.net, 28525@debbugs.gnu.org Received: via spool by 28525-submit@debbugs.gnu.org id=B28525.150702902614957 (code B ref 28525); Tue, 03 Oct 2017 11:11:02 +0000 Received: (at 28525) by debbugs.gnu.org; 3 Oct 2017 11:10:26 +0000 Received: from localhost ([127.0.0.1]:45255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzL5m-0003tA-GT for submit@debbugs.gnu.org; Tue, 03 Oct 2017 07:10:26 -0400 Received: from mout.web.de ([217.72.192.78]:60621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzL5k-0003sv-Di for 28525@debbugs.gnu.org; Tue, 03 Oct 2017 07:10:24 -0400 Received: from drachen.dragon ([92.74.174.244]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M9XQB-1eAayM3sxb-00CxCI; Tue, 03 Oct 2017 13:10:10 +0200 From: Michael Heerdegen References: <87mv5pn1dz.fsf@calancha-pc> <83zi9oeacc.fsf@gnu.org> <87tvzktk75.fsf@gmail.com> <87poa7tstz.fsf@gmail.com> <83wp4d1m84.fsf@gnu.org> Date: Tue, 03 Oct 2017 13:10:06 +0200 In-Reply-To: (Tino Calancha's message of "Tue, 3 Oct 2017 17:00:57 +0900 (JST)") Message-ID: <878tgswkq9.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:Q4SH2x9I/kVM3bL1+0ETFPs3Te67ADSkmYnb+fBSKxAe5wF9Rjj 3krMx0/LPR2MGaCg9qI2G+NJHhEAHLue4JSumdtbwzCnQmRe6ONOQV/lHgZoK0VyB9QMb+v qI7luNzXjX5Zq0ZbGBBbzyU5TO3ofbcxRm6rxJeMxM66wQ6M3g3qBv2viruJXGUTVmmDeag S9Rlp9nHwhFxD1A301GUg== X-UI-Out-Filterresults: notjunk:1;V01:K0:dAMf1WBzx0k=:iT2xmH03O3MfTmP+ez7evc 1JwEvVdjdm0C6rtSQ28LZ+mQ16DG3w+6yVlSxoasiweO1SN5mAWrmHC0Yccot3HDr31GDz2hd SOQZcqJtAemN7omgZtXTyOjm86SSISZ6b24yle8E/PosQHvr2ZThZh4TMliFyAbve5lb3nwmJ zfoNNbEj3C3M3opiEBRI+vEuNaG+PjZL0RblMb0ijGDOFTqbaa6/B+4+//CXqHs/kiqX9vtGK Pxv+vtoeX7/0DBPDN3Fy0dG36UCBha0VSVXopjgnLlLaf//b+Y3WGFs3m3QIFANM1UHVUtFlA RUmi2Q5hkQD9J/iF27sLVCMnCLTLH3G9Cf8FEfugHqUIt5JSIcXBAkhEwBBzNhw8KzAE98dSE K0AT4lfbARIh+LGrQHKXC5qwSSVIsdc85Tc1WoDr/uTc8jp+XewWu/AQo+S6LCIMKCn7xyrDl 2ugL0SzwkHwiwRUQazyXVdmFiEBH/Jr26gIjn82WVg2iyYtQ1w3d+CDr/idlvguq82YIe6gBp xeZ23zTRPChf7PUKozulenPOF9MB+Y+mWqza1daYuMFfpr/1JFMU/4r0WyGWlZ4rbyCPZjiqn c9EBflEirs0Q1V89cU6ISg9KmUqlFLATcYrdlx1P96jShdd7S3VSoPKOiyrpkIKnCd6JZxsoB qjuHPLulhwRJGeLb3EKSKGyfKcBufshva5+oeYsVyIRFRgS64imXwz5X+xRoc0UdATvuE3eTi SWfPY54LOKbUWJMVL3P5r6ACtBX6A7f63PebnUWDXZeOBPsK46J2SoRbufAWDOtY4+5h/kLSM p451j2hKUmMO5CvLWQm6oWD+WVF4jATijb3dhhKj12UILaujDc= X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) Tino Calancha writes: > Even if we ignore this issue, the existance of a `questionp' > which ask a question and allow more than 2 answers > (and returns a symbol, easy to check in a `cond' block) might be > a useful addition; this is quite general and avoid the need to use > `read-string' in cases where the programmer prefers a symbol. FWIW there is already something very similar in subr-x: `read-multiple-choice'. That one is controlled with keys, however. Michael. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 10 17:52:46 2018 Received: (at control) by debbugs.gnu.org; 10 Jan 2018 22:52:46 +0000 Received: from localhost ([127.0.0.1]:51478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZPEj-00052x-VL for submit@debbugs.gnu.org; Wed, 10 Jan 2018 17:52:46 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZPEg-00052j-Id for control@debbugs.gnu.org; Wed, 10 Jan 2018 17:52:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZPEZ-0004es-TC for control@debbugs.gnu.org; Wed, 10 Jan 2018 17:52:36 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34127) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZPEZ-0004ej-OR for control@debbugs.gnu.org; Wed, 10 Jan 2018 17:52:35 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1eZPEZ-00030E-Hv for control@debbugs.gnu.org; Wed, 10 Jan 2018 17:52:35 -0500 Subject: control message for bug 30073 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Wed, 10 Jan 2018 17:52:35 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) merge 28525 30073