GNU bug report logs - #60312
30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp:

Previous Next

Package: emacs;

Reported by: "T.V Raman" <raman <at> google.com>

Date: Sun, 25 Dec 2022 15:23:02 UTC

Severity: wishlist

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60312 in the body.
You can then email your comments to 60312 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Sun, 25 Dec 2022 15:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "T.V Raman" <raman <at> google.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 25 Dec 2022 15:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp:
Date: Sun, 25 Dec 2022 07:22:46 -0800
At present this is hard-wired in the C file:

https:/git.savannah.gnu.org/cgit/emacs.git/tree/src/fns.c?h=master#n3208

AUTO_STRING (yes_or_no, "(yes or no) ");

I'd like to be able to customize this in some cases to something more
terse  --- hearing "yes or no " each time gets wordy.



-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




In GNU Emacs 30.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.16.0) of 2022-12-11 built on raman9
Repository revision: c9f61f134a9db6c7c5157d5df75f62d29cd4f8a7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Debian GNU/Linux rodete

Configured using:
 'configure --enable-silent-rules --without-native-compilation
 --without-xwidgets --with-mailutils --without-compress-install'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Article

Minor modes in effect:
  TeX-PDF-mode: t
  recentf-mode: t
  websearch-mode: t
  shx-global-mode: t
  shell-dirtrack-mode: t
  savehist-mode: t
  save-place-mode: t
  psession-mode: t
  psession-autosave-mode: t
  midnight-mode: t
  global-auto-revert-mode: t
  flx-ido-mode: t
  display-time-mode: t
  disable-mouse-global-mode: t
  company-statistics-mode: t
  company-prescient-mode: t
  prescient-persist-mode: t
  auto-correct-mode: t
  dired-omit-mode: t
  server-mode: t
  repeat-mode: t
  display-battery-mode: t
  ido-ubiquitous-mode: t
  ido-everywhere: t
  global-voice-lock-mode: t
  voice-lock-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/raman/.emacs.d/elpa/lispy-20221114.2013/elpa hides /home/raman/.emacs.d/elpa/ivy-20220926.1250/elpa
/home/raman/.emacs.d/elpa/transient-20221202.1727/transient hides /usr/local/share/emacs/30.0.50/lisp/transient
/home/raman/.emacs.d/elpa/xref-1.6.0/xref hides /usr/local/share/emacs/30.0.50/lisp/progmodes/xref
/home/raman/.emacs.d/elpa/project-0.9.3/project hides /usr/local/share/emacs/30.0.50/lisp/progmodes/project
/home/raman/.emacs.d/elpa/flymake-1.2.2/flymake hides /usr/local/share/emacs/30.0.50/lisp/progmodes/flymake
/home/raman/.emacs.d/elpa/eglot-20221020.1010/eglot hides /usr/local/share/emacs/30.0.50/lisp/progmodes/eglot
/home/raman/emacs/lisp/emacspeak/lisp/tetris hides /usr/local/share/emacs/30.0.50/lisp/play/tetris

Features:
(shadow emacsbug vm-sort vm-virtual vm-delete vm-save tapestry
vm-rfaddons vm-menu vm-window vm-toolbar vm-folder vm-undo vm-mouse
vm-page vm-motion vm-minibuf vm-message vm-misc vm-macro emacspeak-vm
u-vm-color bbdb-vm vm-mime vm-summary bbdb-mua bbdb-com emacspeak-bbdb
bbdb bbdb-site vm vm-autoloads vm-vars vm-version emacspeak-epub light
emacspeak-desktop desktop mailalias browse-at-remote sort smiley
gnus-cite qp mm-archive mail-extr gnus-async gnus-bcklg gnus-dup
gnus-ml disp-table utf-7 nndraft nnmh gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg nntp gnus-cache epa-file bash-completion
vc macrostep-c cmacexp timezone emacspeak-feeds jka-compr
emacspeak-twittering twittering-mode pianobar emacspeak-pianobar
misearch multi-isearch network-stream shr-color textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check url-cache
mule-util emacspeak-url-template emacspeak-websearch emacspeak-dbus
emacspeak-nm amixer preview reftex-dcr reftex-auc font-latex latex
latex-flymake emacspeak-flymake flymake-proc flymake warnings
tex-ispell tex-style tex crm smartparens-latex tex-mode cdlatex
emacspeak-reftex reftex reftex-loaddefs reftex-vars oc-basic ol-info
ol-bibtex emacspeak-bibtex bibtex recentf tree-widget
emacspeak-sh-script sh-script smie executable dired-aux
emacspeak-orgalist orgalist emacs-news-mode bug-reference
emacspeak-lispy lispy emacspeak-hydra hydra lv delsel lispy-inline avy
edebug debug backtrace help-fns radix-tree lispy-tags mode-local
zoutline smartparens-org emacspeak-org ox-md ox-html emacspeak-etable
table ox-publish ox org-element org-persist org-id org-refile avl-tree
ol-eww org-tempo emacspeak-tempo tempo org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol rx org-fold org-fold-core org-keys oc
org-loaddefs find-func emacspeak-calendar appt diary-lib
diary-loaddefs solar cal-dst cal-menu calendar cal-loaddefs
org-version org-compat org-macs soundscape files-x emacspeak-wizards
vc-git emacspeak-diff-mode diff-mode vc-dispatcher
common-lisp-snippets yasnippet-snippets emacspeak-yasnippet yasnippet
emacspeak-smartparens smartparens-config smartparens-javascript
smartparens-text smartparens-c smartparens emacspeak-hideshow hideshow
company-graphviz-dot graphviz-dot-mode company-bbdb company-semantic
company-template company-files company-abbrev company-keywords
company-etags company-dabbrev-code company-dabbrev company-capf js
treesit imenu emacspeak-c cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs color emacspeak-muggles
format-spec emacspeak-xref emacspeak-widget emacspeak-auctex
emacspeak-tab-bar emacspeak-slime emacspeak-shx emacspeak-project
emacspeak-outline emacspeak-message emacspeak-kmacro emacspeak-info
emacspeak-ido emacspeak-gnus gm-nnir nnir gnus-art mm-uu mml2015
mm-view mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo
gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message yank-media
rfc822 mml mml-sec emacspeak-epa epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader gnus-win
emacspeak-hide emacspeak-eww emacspeak-we emacspeak-xslt dom-addons
emacspeak-custom emacspeak-compile emacspeak-company emacspeak-comint
emacspeak-calc emacspeak-buff-menu emacspeak-arc emacspeak-advice
emacspeak-cedet eww xdg url-queue shr pixel-fill kinsoku url-file svg
dom mm-url auth-source-xoauth2 auth-source-pass smtpmail sendmail gnus
nnheader gnus-util time-date mail-utils range websearch-mode websearch
websearch-custom shx shell pcomplete savehist saveplace psession
frameset async midnight gmaps autorevert filenotify flx-ido flx
emacspeak-m-player emacspeak-amark ladspa emacspeak-dired locate time
disable-mouse edmacro company-statistics company-prescient prescient
char-fold company auto-correct cus-start dired-x dired dired-loaddefs
modus-vivendi-theme modus-themes pcase cl-extra help-mode server
diminish aster texmathp calc calc-loaddefs rect calc-macs repeat
emacspeak-mpv emacspeak-google gweb g-utils slime-asdf grep
slime-quicklisp slime-hyperdoc url-http url-auth mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny
slime-fancy slime-indentation slime-cl-indent cl-indent
slime-trace-dialog slime-fontifying-fu slime-package-fu
slime-references slime-compiler-notes-tree slime-scratch
slime-presentations bridge slime-macrostep macrostep slime-mdot-fu
slime-enclosing-context slime-fuzzy slime-fancy-trace
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
slime-repl slime-parse slime easy-mmode compile etags fileloop
generator xref project arc-mode archive-mode noutline outline comint
ansi-osc ansi-color ring hyperspec thingatpt browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util url-parse auth-source eieio
eieio-core password-cache json map url-vars mailcap file-xoauth2
kmacro emacs-startup emacspeak-setup outloud-voices emacspeak
emacspeak-loaddefs emacspeak-preamble emacspeak-speak battery dbus
ido-completing-read+ memoize cus-edit pp cus-load icons wid-edit
minibuf-eldef ido xml subr-x sox-gen emacspeak-keymap
emacspeak-pronounce emacspeak-sounds voice-defs voice-setup dtk-speak
cl-seq nvm f f-shortdoc shortdoc text-property-search dash s cl-macs
byte-opt advice info eglot-autoloads define-word-autoloads
rg-autoloads vdiff-autoloads dwim-shell-command-autoloads
common-lisp-snippets-autoloads bbdb-autoloads paradox-autoloads
browse-at-remote-autoloads slime-company-autoloads async-autoloads
flx-ido-autoloads free-keys-autoloads shx-autoloads cdlatex-autoloads
fussy-autoloads ein-autoloads polymode-autoloads smartparens-autoloads
systemd-autoloads forge-autoloads markdown-mode-autoloads
stumpwm-mode-autoloads run-command-recipes-autoloads
haskell-mode-autoloads elpy-autoloads arxiv-citation-autoloads
js2-mode-autoloads company-fuzzy-autoloads ht-autoloads
latex-table-wizard-autoloads list-utils-autoloads bytecomp
byte-compile cl gv cl-loaddefs cl-lib diminish-autoloads f-autoloads
graphviz-dot-mode-autoloads pydoc-autoloads elisp-refs-autoloads
websearch-autoloads closql-autoloads emacsql-sqlite-autoloads
biblio-autoloads biblio-core-autoloads auth-source-xoauth2-autoloads
deadgrep-autoloads simple-httpd-autoloads project-autoloads
pulseaudio-control-autoloads arxiv-mode-autoloads lispy-autoloads
hydra-autoloads company-prescient-autoloads prescient-autoloads
flx-autoloads calibredb-autoloads s-autoloads csound-mode-autoloads
shut-up-autoloads el-fetch-autoloads jabber-autoloads srv-autoloads
ghub-autoloads treepy-autoloads ace-window-autoloads avy-autoloads
auctex-autoloads tex-site units-mode-autoloads ivy-autoloads
csv-mode-autoloads notmuch-addr-autoloads notmuch-autoloads
slime-autoloads macrostep-autoloads emacsql-autoloads
exec-path-from-shell-autoloads xr-autoloads magit-autoloads
magit-section-autoloads git-commit-autoloads transient-autoloads
company-autoloads highlight-autoloads run-command-autoloads
yasnippet-snippets-autoloads multi-autoloads yaml-autoloads
parsebib-autoloads dash-autoloads rust-mode-autoloads xref-autoloads
websocket-autoloads mpv-autoloads fsm-autoloads pos-tip-autoloads
popup-autoloads request-deferred-autoloads request-autoloads
go-mode-autoloads with-editor-autoloads compat-autoloads rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer
select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x
multi-tty make-network-process emacs)

Memory information:
((conses 16 2130427 878885)
 (symbols 48 73462 42)
 (strings 32 282795 97172)
 (string-bytes 1 8624592)
 (vectors 16 155045)
 (vector-slots 8 3400812 1380653)
 (floats 8 2279 1708)
 (intervals 56 97409 1611)
 (buffers 984 61))


-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Sun, 25 Dec 2022 15:54:02 GMT) Full text and rfc822 format available.

Message #8 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: help-debbugs <at> gnu.org (GNU bug Tracking System)
Cc: 60312 <at> debbugs.gnu.org
Subject: Re: bug#60312: Acknowledgement (30.0.50; Feature Request: Customize
 yes-or-n-p prompt from elisp:)
Date: Sun, 25 Dec 2022 07:53:13 -0800
Additional note:

At present, yes-or-no-p calls y-or-n-p from within the C layer if
use-short-answers is turned on; this feels convoluted.

Worse the implementation of y-or-n-p  also feels fairly round-about --
perhaps use-short-answers could be handled   in either C or in elisp,
but calling back and forth feels  fragile.

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
74 Id: kg:/m/0285kf1  08




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Mon, 26 Dec 2022 08:21:01 GMT) Full text and rfc822 format available.

Message #11 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: "T.V Raman" <raman <at> google.com>
Cc: 60312 <at> debbugs.gnu.org
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt
 from elisp:
Date: Sun, 25 Dec 2022 20:19:28 +0300
* T.V Raman" via "Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> [2022-12-25 18:24]:
> AUTO_STRING (yes_or_no, "(yes or no) ");
> 
> I'd like to be able to customize this in some cases to something more
> terse  --- hearing "yes or no " each time gets wordy.

It can help to people who use different languages as well.

This implies that also characters y and n shall be customizable.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Tue, 03 Jan 2023 14:53:01 GMT) Full text and rfc822 format available.

Message #14 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: "T.V Raman" <raman <at> google.com>
Cc: Jean Louis <bugs <at> gnu.support>, 60312 <at> debbugs.gnu.org
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p
 prompt from elisp:
Date: Tue, 03 Jan 2023 15:52:47 +0100
>>>>> On Sun, 25 Dec 2022 20:19:28 +0300, Jean Louis <bugs <at> gnu.support> said:

    Jean> * T.V Raman" via "Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> [2022-12-25 18:24]:
    >> AUTO_STRING (yes_or_no, "(yes or no) ");
    >> 
    >> I'd like to be able to customize this in some cases to something more
    >> terse  --- hearing "yes or no " each time gets wordy.

    Jean> It can help to people who use different languages as well.

    Jean> This implies that also characters y and n shall be customizable.

That might be going a bit far.

TV, how does the below work for you? I thought `yes-or-no-p-prompt'
would have been overkill, so I painted this particular bikeshed as
`yes-or-no-prompt'.

Robert
-- 

diff --git i/doc/emacs/mini.texi w/doc/emacs/mini.texi
index 90e50a41d53..e4ec4cd3785 100644
--- i/doc/emacs/mini.texi
+++ w/doc/emacs/mini.texi
@@ -953,12 +953,14 @@ Yes or No Prompts
 @end smallexample
 
 @cindex yes or no prompt
+@vindex yes-or-no-prompt
   The second type of yes-or-no query is typically employed if giving
 the wrong answer would have serious consequences; it thus features a
-longer prompt ending with @samp{(yes or no)}.  For example, if you
-invoke @kbd{C-x k} (@code{kill-buffer}) on a file-visiting buffer with
-unsaved changes, Emacs activates the minibuffer with a prompt like
-this:
+longer prompt ending with @samp{(yes or no)} (or the value of
+@code{yes-or-no-prompt} if you've customized that).  For example, if
+you invoke @kbd{C-x k} (@code{kill-buffer}) on a file-visiting buffer
+with unsaved changes, Emacs activates the minibuffer with a prompt
+like this:
 
 @smallexample
 Buffer foo.el modified; kill anyway? (yes or no)
diff --git i/doc/lispref/minibuf.texi w/doc/lispref/minibuf.texi
index 332a453619c..546e46813ec 100644
--- i/doc/lispref/minibuf.texi
+++ w/doc/lispref/minibuf.texi
@@ -2233,10 +2233,12 @@ Yes-or-No Queries
 @code{nil} if the user types @samp{no}.  The user must type @key{RET} to
 finalize the response.  Upper and lower case are equivalent.
 
-@code{yes-or-no-p} starts by displaying @var{prompt} in the minibuffer,
-followed by @w{@samp{(yes or no) }}.  The user must type one of the
-expected responses; otherwise, the function responds @samp{Please answer
-yes or no.}, waits about two seconds and repeats the request.
+@vindex yes-or-no-prompt
+@code{yes-or-no-p} starts by displaying @var{prompt} in the
+minibuffer, followed by the value of @code{yes-or-no-prompt} (default
+@w{@samp{(yes or no) }}).  The user must type one of the expected
+responses; otherwise, the function responds @samp{Please answer yes or
+no.}, waits about two seconds and repeats the request.
 
 @code{yes-or-no-p} requires more work from the user than
 @code{y-or-n-p} and is appropriate for more crucial decisions.
diff --git i/lisp/cus-start.el w/lisp/cus-start.el
index d7fb56c9854..197c41c5ebb 100644
--- i/lisp/cus-start.el
+++ w/lisp/cus-start.el
@@ -310,6 +310,7 @@ minibuffer-prompt-properties--setter
                       (const :tag "Off" :value nil)
                       (const :tag "On" :value t)
                       (const :tag "Auto-raise" :value auto-raise)) "26.1")
+             (yes-or-no-prompt menu string "30.1")
 	     ;; fontset.c
 	     ;; FIXME nil is the initial value, fontset.el setqs it.
 	     (vertical-centering-font-regexp display
diff --git i/src/fns.c w/src/fns.c
index eeb65cadf3f..1a7b6b11c44 100644
--- i/src/fns.c
+++ w/src/fns.c
@@ -3173,14 +3173,16 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
 Return t if answer is yes, and nil if the answer is no.
 
 PROMPT is the string to display to ask the question; `yes-or-no-p'
-adds \"(yes or no) \" to it.  It does not need to end in space, but if
-it does up to one space will be removed.
+appends `yes-or-no-prompt' (default \"(yes or no) \") to it.  It does
+not need to end in space, but if it does up to one space will be
+removed.
 
 The user must confirm the answer with RET, and can edit it until it
 has been confirmed.
 
 If the `use-short-answers' variable is non-nil, instead of asking for
-\"yes\" or \"no\", this function will ask for \"y\" or \"n\".
+\"yes\" or \"no\", this function will ask for \"y\" or \"n\" (and
+ignore the value of `yes-or-no-prompt').
 
 If dialog boxes are supported, a dialog box will be used
 if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil.  */)
@@ -3205,8 +3207,7 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
   if (use_short_answers)
     return call1 (intern ("y-or-n-p"), prompt);
 
-  AUTO_STRING (yes_or_no, "(yes or no) ");
-  prompt = CALLN (Fconcat, prompt, yes_or_no);
+  prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt);
 
   specpdl_ref count = SPECPDL_INDEX ();
   specbind (Qenable_recursive_minibuffers, Qt);
@@ -6257,9 +6258,15 @@ syms_of_fns (void)
 We recommend against setting this variable non-nil, because `yes-or-no-p'
 is intended to be used when users are expected not to respond too
 quickly, but to take their time and perhaps think about the answer.
-The same variable also affects the function `read-answer'.  */);
+The same variable also affects the function `read-answer'.  See also
+`yes-or-no-prompt'.  */);
   use_short_answers = false;
 
+  DEFVAR_LISP ("yes-or-no-prompt", Vyes_or_no_prompt,
+    doc: /* String to append when `yes-or-no-p' asks a question.
+For best results this should end in a space.  */);
+  Vyes_or_no_prompt = make_unibyte_string ("(yes or no) ", strlen ("(yes or no) "));
+
   defsubr (&Sidentity);
   defsubr (&Srandom);
   defsubr (&Slength);




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Tue, 03 Jan 2023 15:07:02 GMT) Full text and rfc822 format available.

Message #17 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: rpluim <at> gmail.com
Cc: 60312 <at> debbugs.gnu.org, bugs <at> gnu.support, raman <at> google.com
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt
 from elisp:
Date: Tue, 3 Jan 2023 07:06:24 -0800
this SGTM.
Robert Pluim writes:
 > >>>>> On Sun, 25 Dec 2022 20:19:28 +0300, Jean Louis <bugs <at> gnu.support> said:
 > 
 >     Jean> * T.V Raman" via "Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> [2022-12-25 18:24]:
 >     >> AUTO_STRING (yes_or_no, "(yes or no) ");
 >     >> 
 >     >> I'd like to be able to customize this in some cases to something more
 >     >> terse  --- hearing "yes or no " each time gets wordy.
 > 
 >     Jean> It can help to people who use different languages as well.
 > 
 >     Jean> This implies that also characters y and n shall be customizable.
 > 
 > That might be going a bit far.
 > 
 > TV, how does the below work for you? I thought `yes-or-no-p-prompt'
 > would have been overkill, so I painted this particular bikeshed as
 > `yes-or-no-prompt'.
 > 
 > Robert
 > -- 
 > 
 > diff --git i/doc/emacs/mini.texi w/doc/emacs/mini.texi
 > index 90e50a41d53..e4ec4cd3785 100644
 > --- i/doc/emacs/mini.texi
 > +++ w/doc/emacs/mini.texi
 > @@ -953,12 +953,14 @@ Yes or No Prompts
 >  @end smallexample
 >  
 >  @cindex yes or no prompt
 > +@vindex yes-or-no-prompt
 >    The second type of yes-or-no query is typically employed if giving
 >  the wrong answer would have serious consequences; it thus features a
 > -longer prompt ending with @samp{(yes or no)}.  For example, if you
 > -invoke @kbd{C-x k} (@code{kill-buffer}) on a file-visiting buffer with
 > -unsaved changes, Emacs activates the minibuffer with a prompt like
 > -this:
 > +longer prompt ending with @samp{(yes or no)} (or the value of
 > +@code{yes-or-no-prompt} if you've customized that).  For example, if
 > +you invoke @kbd{C-x k} (@code{kill-buffer}) on a file-visiting buffer
 > +with unsaved changes, Emacs activates the minibuffer with a prompt
 > +like this:
 >  
 >  @smallexample
 >  Buffer foo.el modified; kill anyway? (yes or no)
 > diff --git i/doc/lispref/minibuf.texi w/doc/lispref/minibuf.texi
 > index 332a453619c..546e46813ec 100644
 > --- i/doc/lispref/minibuf.texi
 > +++ w/doc/lispref/minibuf.texi
 > @@ -2233,10 +2233,12 @@ Yes-or-No Queries
 >  @code{nil} if the user types @samp{no}.  The user must type @key{RET} to
 >  finalize the response.  Upper and lower case are equivalent.
 >  
 > -@code{yes-or-no-p} starts by displaying @var{prompt} in the minibuffer,
 > -followed by @w{@samp{(yes or no) }}.  The user must type one of the
 > -expected responses; otherwise, the function responds @samp{Please answer
 > -yes or no.}, waits about two seconds and repeats the request.
 > +@vindex yes-or-no-prompt
 > +@code{yes-or-no-p} starts by displaying @var{prompt} in the
 > +minibuffer, followed by the value of @code{yes-or-no-prompt} (default
 > +@w{@samp{(yes or no) }}).  The user must type one of the expected
 > +responses; otherwise, the function responds @samp{Please answer yes or
 > +no.}, waits about two seconds and repeats the request.
 >  
 >  @code{yes-or-no-p} requires more work from the user than
 >  @code{y-or-n-p} and is appropriate for more crucial decisions.
 > diff --git i/lisp/cus-start.el w/lisp/cus-start.el
 > index d7fb56c9854..197c41c5ebb 100644
 > --- i/lisp/cus-start.el
 > +++ w/lisp/cus-start.el
 > @@ -310,6 +310,7 @@ minibuffer-prompt-properties--setter
 >                        (const :tag "Off" :value nil)
 >                        (const :tag "On" :value t)
 >                        (const :tag "Auto-raise" :value auto-raise)) "26.1")
 > +             (yes-or-no-prompt menu string "30.1")
 >  	     ;; fontset.c
 >  	     ;; FIXME nil is the initial value, fontset.el setqs it.
 >  	     (vertical-centering-font-regexp display
 > diff --git i/src/fns.c w/src/fns.c
 > index eeb65cadf3f..1a7b6b11c44 100644
 > --- i/src/fns.c
 > +++ w/src/fns.c
 > @@ -3173,14 +3173,16 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
 >  Return t if answer is yes, and nil if the answer is no.
 >  
 >  PROMPT is the string to display to ask the question; `yes-or-no-p'
 > -adds \"(yes or no) \" to it.  It does not need to end in space, but if
 > -it does up to one space will be removed.
 > +appends `yes-or-no-prompt' (default \"(yes or no) \") to it.  It does
 > +not need to end in space, but if it does up to one space will be
 > +removed.
 >  
 >  The user must confirm the answer with RET, and can edit it until it
 >  has been confirmed.
 >  
 >  If the `use-short-answers' variable is non-nil, instead of asking for
 > -\"yes\" or \"no\", this function will ask for \"y\" or \"n\".
 > +\"yes\" or \"no\", this function will ask for \"y\" or \"n\" (and
 > +ignore the value of `yes-or-no-prompt').
 >  
 >  If dialog boxes are supported, a dialog box will be used
 >  if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil.  */)
 > @@ -3205,8 +3207,7 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
 >    if (use_short_answers)
 >      return call1 (intern ("y-or-n-p"), prompt);
 >  
 > -  AUTO_STRING (yes_or_no, "(yes or no) ");
 > -  prompt = CALLN (Fconcat, prompt, yes_or_no);
 > +  prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt);
 >  
 >    specpdl_ref count = SPECPDL_INDEX ();
 >    specbind (Qenable_recursive_minibuffers, Qt);
 > @@ -6257,9 +6258,15 @@ syms_of_fns (void)
 >  We recommend against setting this variable non-nil, because `yes-or-no-p'
 >  is intended to be used when users are expected not to respond too
 >  quickly, but to take their time and perhaps think about the answer.
 > -The same variable also affects the function `read-answer'.  */);
 > +The same variable also affects the function `read-answer'.  See also
 > +`yes-or-no-prompt'.  */);
 >    use_short_answers = false;
 >  
 > +  DEFVAR_LISP ("yes-or-no-prompt", Vyes_or_no_prompt,
 > +    doc: /* String to append when `yes-or-no-p' asks a question.
 > +For best results this should end in a space.  */);
 > +  Vyes_or_no_prompt = make_unibyte_string ("(yes or no) ", strlen ("(yes or no) "));
 > +
 >    defsubr (&Sidentity);
 >    defsubr (&Srandom);
 >    defsubr (&Slength);

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Tue, 03 Jan 2023 15:13:02 GMT) Full text and rfc822 format available.

Message #20 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: "T.V Raman" <raman <at> google.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, bugs <at> gnu.support, 60312 <at> debbugs.gnu.org
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p
 prompt from elisp:
Date: Tue, 03 Jan 2023 16:12:31 +0100
>>>>> On Tue, 3 Jan 2023 07:06:24 -0800, "T.V Raman" <raman <at> google.com> said:

    TV> this SGTM.

Thanks. Iʼll work on getting it out to master this week (assuming Eli
has no objections)

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Tue, 03 Jan 2023 15:33:02 GMT) Full text and rfc822 format available.

Message #23 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 60312 <at> debbugs.gnu.org, bugs <at> gnu.support, raman <at> google.com
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p
 prompt from elisp:
Date: Tue, 03 Jan 2023 17:32:09 +0200
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: bugs <at> gnu.support,  60312 <at> debbugs.gnu.org,
>     Eli Zaretskii <eliz <at> gnu.org>
> Date: Tue, 03 Jan 2023 16:12:31 +0100
> 
> >>>>> On Tue, 3 Jan 2023 07:06:24 -0800, "T.V Raman" <raman <at> google.com> said:
> 
>     TV> this SGTM.
> 
> Thanks. Iʼll work on getting it out to master this week (assuming Eli
> has no objections)

None.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60312; Package emacs. (Mon, 23 Jan 2023 08:24:02 GMT) Full text and rfc822 format available.

Message #26 received at 60312 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: raman <at> google.com, bugs <at> gnu.support, 60312 <at> debbugs.gnu.org
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p
 prompt from elisp:
Date: Mon, 23 Jan 2023 09:23:21 +0100
tags 60312 fixed
close 60312 30.1
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Robert Pluim <rpluim <at> gmail.com>
>> Cc: bugs <at> gnu.support,  60312 <at> debbugs.gnu.org,
>>     Eli Zaretskii <eliz <at> gnu.org>
>> Date: Tue, 03 Jan 2023 16:12:31 +0100
>> 
>> >>>>> On Tue, 3 Jan 2023 07:06:24 -0800, "T.V Raman" <raman <at> google.com> said:
>> 
>>     TV> this SGTM.
>> 
>> Thanks. Iʼll work on getting it out to master this week (assuming Eli
>> has no objections)
>
> None.
>
> Thanks.

Closing.
Committed as 26ef5c09e0

Thanks

Robert
-- 




Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 10 Sep 2023 17:36:02 GMT) Full text and rfc822 format available.

Notification sent to "T.V Raman" <raman <at> google.com>:
bug acknowledged by developer. (Sun, 10 Sep 2023 17:36:02 GMT) Full text and rfc822 format available.

Message #31 received at 60312-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 60312-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, bugs <at> gnu.support,
 raman <at> google.com
Subject: Re: bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt
 from elisp:
Date: Sun, 10 Sep 2023 10:35:30 -0700
Robert Pluim <rpluim <at> gmail.com> writes:

> tags 60312 fixed
> close 60312 30.1
> quit

This was left open by accident, so I'm closing it now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 Oct 2023 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.