unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* the '?' in read-multiple-choice prompt
@ 2023-09-03  8:38 Shynur Xie
  2023-09-03  9:46 ` Philip Kaludercic
  0 siblings, 1 reply; 4+ messages in thread
From: Shynur Xie @ 2023-09-03  8:38 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: the '?' in read-multiple-choice prompt
  2023-09-03  8:38 the '?' in read-multiple-choice prompt Shynur Xie
@ 2023-09-03  9:46 ` Philip Kaludercic
  2023-09-03 12:34   ` Shynur Xie
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Kaludercic @ 2023-09-03  9:46 UTC (permalink / raw)
  To: Shynur Xie; +Cc: help-gnu-emacs@gnu.org

[-- 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".

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: the '?' in read-multiple-choice prompt
  2023-09-03  9:46 ` Philip Kaludercic
@ 2023-09-03 12:34   ` Shynur Xie
  2023-09-03 12:59     ` Philip Kaludercic
  0 siblings, 1 reply; 4+ messages in thread
From: Shynur Xie @ 2023-09-03 12:34 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: help-gnu-emacs@gnu.org

Thanks a lot!

Will it be installed in one of Emacs branches?
(so that I don't need to modify the definition manually.)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: the '?' in read-multiple-choice prompt
  2023-09-03 12:34   ` Shynur Xie
@ 2023-09-03 12:59     ` Philip Kaludercic
  0 siblings, 0 replies; 4+ messages in thread
From: Philip Kaludercic @ 2023-09-03 12:59 UTC (permalink / raw)
  To: Shynur Xie; +Cc: help-gnu-emacs@gnu.org

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

> Thanks a lot!
>
> Will it be installed in one of Emacs branches?
> (so that I don't need to modify the definition manually.)

I don't know, you can submit a bug report to bug-gnu-emacs@gnu.org with
the diff I sent you to have it discussed.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-03 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-03  8:38 the '?' in read-multiple-choice prompt Shynur Xie
2023-09-03  9:46 ` Philip Kaludercic
2023-09-03 12:34   ` Shynur Xie
2023-09-03 12:59     ` Philip Kaludercic

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