diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-02-04 10:15:18 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-02-04 10:15:18 +0200 |
commit | 3a64f81ebc153ad26331d9d43659a56bed3247bd (patch) | |
tree | bb8a27bbd9c998511996841a164e2f1835b1544a /lisp | |
parent | 4c765d93ab3dd646c1b9722bdd5a91da525d06f2 (diff) | |
download | emacs-3a64f81ebc153ad26331d9d43659a56bed3247bd.tar.gz emacs-3a64f81ebc153ad26331d9d43659a56bed3247bd.tar.bz2 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)
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/subr.el | 14 |
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)." (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) "" " ") (if dialog "" - (substitute-command-keys - (if help-form - (format "(\\`y', \\`n' or \\`%s') " - (key-description - (vector help-char))) - "(\\`y' or \\`n') "))))))) + ;; Don't clobber caller's match data. + (save-match-data + (substitute-command-keys + (if help-form + (format "(\\`y', \\`n' or \\`%s') " + (key-description + (vector help-char))) + "(\\`y' or \\`n') ")))))))) ;; Preserve the actual command that eventually called ;; `y-or-n-p' (otherwise `repeat' will be repeating ;; `exit-minibuffer'). |