aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-02-04 10:15:18 +0200
committerEli Zaretskii2023-02-04 10:15:18 +0200
commit3a64f81ebc153ad26331d9d43659a56bed3247bd (patch)
treebb8a27bbd9c998511996841a164e2f1835b1544a
parent4c765d93ab3dd646c1b9722bdd5a91da525d06f2 (diff)
downloademacs-3a64f81ebc153ad26331d9d43659a56bed3247bd.tar.gz
emacs-3a64f81ebc153ad26331d9d43659a56bed3247bd.zip
Don't clobber match data in 'y-or-n-p'
* lisp/subr.el (y-or-n-p): Avoid clobbering caller's match data. (Bug#61091)
-rw-r--r--lisp/subr.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 0f754fcd31f..32c997425cf 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3573,12 +3573,14 @@ like) while `y-or-n-p' is running)."
3573 (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) 3573 (if (or (zerop l) (eq ?\s (aref prompt (1- l))))
3574 "" " ") 3574 "" " ")
3575 (if dialog "" 3575 (if dialog ""
3576 (substitute-command-keys 3576 ;; Don't clobber caller's match data.
3577 (if help-form 3577 (save-match-data
3578 (format "(\\`y', \\`n' or \\`%s') " 3578 (substitute-command-keys
3579 (key-description 3579 (if help-form
3580 (vector help-char))) 3580 (format "(\\`y', \\`n' or \\`%s') "
3581 "(\\`y' or \\`n') "))))))) 3581 (key-description
3582 (vector help-char)))
3583 "(\\`y' or \\`n') "))))))))
3582 ;; Preserve the actual command that eventually called 3584 ;; Preserve the actual command that eventually called
3583 ;; `y-or-n-p' (otherwise `repeat' will be repeating 3585 ;; `y-or-n-p' (otherwise `repeat' will be repeating
3584 ;; `exit-minibuffer'). 3586 ;; `exit-minibuffer').