* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: @ 2022-12-25 15:22 T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors [not found] ` <handler.60312.B.167198177811134.ack@debbugs.gnu.org> 2022-12-25 17:19 ` bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: Jean Louis 0 siblings, 2 replies; 9+ messages in thread From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-25 15:22 UTC (permalink / raw) To: 60312 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 🦮 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <handler.60312.B.167198177811134.ack@debbugs.gnu.org>]
* bug#60312: Acknowledgement (30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp:) [not found] ` <handler.60312.B.167198177811134.ack@debbugs.gnu.org> @ 2022-12-25 15:53 ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors 0 siblings, 0 replies; 9+ messages in thread From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-25 15:53 UTC (permalink / raw) To: 60312 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=gb18030, Size: 441 bytes --] 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) 7©4 Id: kg:/m/0285kf1 0Ü8 ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2022-12-25 15:22 bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors [not found] ` <handler.60312.B.167198177811134.ack@debbugs.gnu.org> @ 2022-12-25 17:19 ` Jean Louis 2023-01-03 14:52 ` Robert Pluim 1 sibling, 1 reply; 9+ messages in thread From: Jean Louis @ 2022-12-25 17:19 UTC (permalink / raw) To: T.V Raman; +Cc: 60312 * T.V Raman" via "Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@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/ ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2022-12-25 17:19 ` bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: Jean Louis @ 2023-01-03 14:52 ` Robert Pluim 2023-01-03 15:06 ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors 0 siblings, 1 reply; 9+ messages in thread From: Robert Pluim @ 2023-01-03 14:52 UTC (permalink / raw) To: T.V Raman; +Cc: Jean Louis, 60312 >>>>> On Sun, 25 Dec 2022 20:19:28 +0300, Jean Louis <bugs@gnu.support> said: Jean> * T.V Raman" via "Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@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); ^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2023-01-03 14:52 ` Robert Pluim @ 2023-01-03 15:06 ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors 2023-01-03 15:12 ` Robert Pluim 0 siblings, 1 reply; 9+ messages in thread From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-03 15:06 UTC (permalink / raw) To: rpluim; +Cc: 60312, bugs, raman this SGTM. Robert Pluim writes: > >>>>> On Sun, 25 Dec 2022 20:19:28 +0300, Jean Louis <bugs@gnu.support> said: > > Jean> * T.V Raman" via "Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@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 🦮 ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2023-01-03 15:06 ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-03 15:12 ` Robert Pluim 2023-01-03 15:32 ` Eli Zaretskii 0 siblings, 1 reply; 9+ messages in thread From: Robert Pluim @ 2023-01-03 15:12 UTC (permalink / raw) To: T.V Raman; +Cc: Eli Zaretskii, bugs, 60312 >>>>> On Tue, 3 Jan 2023 07:06:24 -0800, "T.V Raman" <raman@google.com> said: TV> this SGTM. Thanks. Iʼll work on getting it out to master this week (assuming Eli has no objections) Robert -- ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2023-01-03 15:12 ` Robert Pluim @ 2023-01-03 15:32 ` Eli Zaretskii 2023-01-23 8:23 ` Robert Pluim 0 siblings, 1 reply; 9+ messages in thread From: Eli Zaretskii @ 2023-01-03 15:32 UTC (permalink / raw) To: Robert Pluim; +Cc: 60312, bugs, raman > From: Robert Pluim <rpluim@gmail.com> > Cc: bugs@gnu.support, 60312@debbugs.gnu.org, > Eli Zaretskii <eliz@gnu.org> > Date: Tue, 03 Jan 2023 16:12:31 +0100 > > >>>>> On Tue, 3 Jan 2023 07:06:24 -0800, "T.V Raman" <raman@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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2023-01-03 15:32 ` Eli Zaretskii @ 2023-01-23 8:23 ` Robert Pluim 2023-09-10 17:35 ` Stefan Kangas 0 siblings, 1 reply; 9+ messages in thread From: Robert Pluim @ 2023-01-23 8:23 UTC (permalink / raw) To: Eli Zaretskii; +Cc: raman, bugs, 60312 tags 60312 fixed close 60312 30.1 quit Eli Zaretskii <eliz@gnu.org> writes: >> From: Robert Pluim <rpluim@gmail.com> >> Cc: bugs@gnu.support, 60312@debbugs.gnu.org, >> Eli Zaretskii <eliz@gnu.org> >> Date: Tue, 03 Jan 2023 16:12:31 +0100 >> >> >>>>> On Tue, 3 Jan 2023 07:06:24 -0800, "T.V Raman" <raman@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 -- ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: 2023-01-23 8:23 ` Robert Pluim @ 2023-09-10 17:35 ` Stefan Kangas 0 siblings, 0 replies; 9+ messages in thread From: Stefan Kangas @ 2023-09-10 17:35 UTC (permalink / raw) To: Robert Pluim; +Cc: 60312-done, Eli Zaretskii, bugs, raman Robert Pluim <rpluim@gmail.com> writes: > tags 60312 fixed > close 60312 30.1 > quit This was left open by accident, so I'm closing it now. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-09-10 17:35 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-12-25 15:22 bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors [not found] ` <handler.60312.B.167198177811134.ack@debbugs.gnu.org> 2022-12-25 15:53 ` bug#60312: Acknowledgement (30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp:) T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors 2022-12-25 17:19 ` bug#60312: 30.0.50; Feature Request: Customize yes-or-n-p prompt from elisp: Jean Louis 2023-01-03 14:52 ` Robert Pluim 2023-01-03 15:06 ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors 2023-01-03 15:12 ` Robert Pluim 2023-01-03 15:32 ` Eli Zaretskii 2023-01-23 8:23 ` Robert Pluim 2023-09-10 17:35 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git 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).