unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Shynur Xie <one.last.kiss@outlook.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: the '?' in read-multiple-choice prompt
Date: Sun, 03 Sep 2023 09:46:07 +0000	[thread overview]
Message-ID: <87cyyz37z4.fsf@posteo.net> (raw)
In-Reply-To: <PH0PR11MB7470DDF886B92AB9CCF53A5AD7EAA@PH0PR11MB7470.namprd11.prod.outlook.com> (Shynur Xie's message of "Sun, 3 Sep 2023 08:38:26 +0000")

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Shynur Xie <one.last.kiss@outlook.com> writes:

> The function `read-multiple-choice' always display a '?' in the
> prompt.  E.g.,
>
>     (read-multiple-choice "prompt" '((?a "alpha")))
>     ;; prompt (alpha, ?):
>                       ^
>             How can I discard it?
>
> Moreover, if evaluating
>
>     (read-multiple-choice "prompt" '((?? "question")))
>     ;; prompt (? question, ?):
>                ^           ^
>          How to distinguish them?

That behaviour is currently hard-coded, but it would be easy to patch:


[-- Attachment #2: Type: text/plain, Size: 533 bytes --]

diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index bfd7434be9a..d1241a26b68 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -191,7 +191,7 @@ read-multiple-choice--short-answers
          tchar buf wrong-char answer)
     (save-window-excursion
       (save-excursion
-        (if show-help
+        (if (and show-help (not (eq show-help 'no)))
             (setq buf (rmc--show-help prompt help-string show-help
                                       choices altered-names)))
 	(while (not tchar)

[-- Attachment #3: Type: text/plain, Size: 184 bytes --]


Now

(read-multiple-choice "prompt" '((?a "alpha")) nil 'no)

does not add a question mark, and

(read-multiple-choice "prompt" '((?? "question")) nil 'no)

still returns "question".

  reply	other threads:[~2023-09-03  9:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03  8:38 the '?' in read-multiple-choice prompt Shynur Xie
2023-09-03  9:46 ` Philip Kaludercic [this message]
2023-09-03 12:34   ` Shynur Xie
2023-09-03 12:59     ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyyz37z4.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=one.last.kiss@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).