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.bugs Subject: bug#61553: 29.0.60; Inconsistent use of dialog boxes by read-multiple-choice Date: Thu, 16 Feb 2023 19:59:08 +0200 Message-ID: <83edqp330z.fsf@gnu.org> References: <87a61dfur1.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31537"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61553@debbugs.gnu.org To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 16 19:00:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pSiYO-0007zT-2b for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Feb 2023 19:00:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSiY8-0004jl-6C; Thu, 16 Feb 2023 13:00:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSiY6-0004hm-TB for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 13:00:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSiY6-0004ua-Hv for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 13:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSiY6-0002ki-DY for bug-gnu-emacs@gnu.org; Thu, 16 Feb 2023 13:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Feb 2023 18:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61553 X-GNU-PR-Package: emacs Original-Received: via spool by 61553-submit@debbugs.gnu.org id=B61553.167657035910484 (code B ref 61553); Thu, 16 Feb 2023 18:00:02 +0000 Original-Received: (at 61553) by debbugs.gnu.org; 16 Feb 2023 17:59:19 +0000 Original-Received: from localhost ([127.0.0.1]:37637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSiXO-0002j1-NW for submit@debbugs.gnu.org; Thu, 16 Feb 2023 12:59:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSiXN-0002ip-Ga for 61553@debbugs.gnu.org; Thu, 16 Feb 2023 12:59:17 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSiXI-0004oX-6N; Thu, 16 Feb 2023 12:59:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=umTJl0N9UQWKZkU6JNzaKIa92eozz3s9TQL1ZrjICic=; b=MFqg56lfiuH/ wl5mpIaCDb7dkYd5TUHZY2NyHW8AhEKc2hXp8pouOztsJH8HhRlx4q7nfPFWrQ3H1g0OmfbKrVLsH okzb9t7HW46n78+aURbQX7i8jvscIBSgvNaUIwlZg/I+STy3A2RPut9mAvqQoiCOMOaKZ0PoRxOiD I0TCk7P3W20aXBtDiXjnmd1TKwEgMXA5AXAK4GDWu7JxT+3p8luKqAQCqg0mWtG51MxsQxx26eFu1 sCerc1kPuF79h7FyExHm2H2EN75z8gf6Tn1uyMvcwHGHGUGE/gYHzJFWWJ44zdUFJPqzeDqhXkq9p rQQ1XHmjBoCcie2dQhDOSw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSiXH-0004PT-E6; Thu, 16 Feb 2023 12:59:11 -0500 In-Reply-To: <87a61dfur1.fsf@gmail.com> (message from Augusto Stoffel on Thu, 16 Feb 2023 17:19:30 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255830 Archived-At: > From: Augusto Stoffel > Date: Thu, 16 Feb 2023 17:19:30 +0100 > > > In the scratch buffer of emacs -Q, type > > (read-multiple-choice "Question" '((?y "yes") (?n "no"))) > > then click, on the menu bar, "Lisp-Interaction -> Evaluate and Print". > As expected, I see a dialog box. > > Now repeat the same using the long-form style: > > (read-multiple-choice "Question" '((?y "yes") (?n "no")) nil nil t) > > Then I get a minibuffer query, but I would expect a dialog box in the > case as well. The long-form call does a completing-read, and we don't support that via GUI dialogs (how could we?). > As a more concrete example, when clicking the "File -> Close" menu item > in a modified buffer, I would expect a to always get a dialog box for > the "buffer modified, kill anyway?" question. (assuming of course > use-dialog-box is t). Currently, one gets a minibuffer query by > default. This change from mouse interaction to keyboard interaction > seems unexpected to me. Does the patch below give good results in that case? diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el index 542c965..8ab1f86 100644 --- a/lisp/emacs-lisp/rmc.el +++ b/lisp/emacs-lisp/rmc.el @@ -177,8 +177,9 @@ read-multiple-choice prompt choices help-string show-help))) (defun read-multiple-choice--short-answers (prompt choices help-string show-help) - (let* ((prompt-choices - (if show-help choices (append choices '((?? "?"))))) + (let* ((dialog-p (use-dialog-box-p)) + (prompt-choices + (if (or show-help dialog-p) choices (append choices '((?? "?"))))) (altered-names (mapcar #'rmc--add-key-description prompt-choices)) (full-prompt (format @@ -192,11 +193,12 @@ read-multiple-choice--short-answers (setq buf (rmc--show-help prompt help-string show-help choices altered-names))) (while (not tchar) - (message "%s%s" - (if wrong-char - "Invalid choice. " - "") - full-prompt) + (unless dialog-p + (message "%s%s" + (if wrong-char + "Invalid choice. " + "") + full-prompt)) (setq tchar (if (and (display-popup-menus-p) last-input-event ; not during startup diff --git a/lisp/simple.el b/lisp/simple.el index c58acfe..d0ba7dc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10799,7 +10799,8 @@ kill-buffer--possibly-save '((?y "yes" "kill buffer without saving") (?n "no" "exit without doing anything") (?s "save and then kill" "save the buffer and then kill it")) - nil nil (not use-short-answers))))) + nil nil (and (not use-short-answers) + (not (use-dialog-box-p))))))) (if (equal response "no") nil (unless (equal response "yes")