From: Mattias EngdegÄrd Date: Wed, 29 Jul 2020 15:47:32 +0000 (+0200) Subject: Preserve match data in 'kbd' X-Git-Tag: emacs-28.0.90~6900 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c48bb7deb88317b6beda4c5944aca7998ff8c37a;p=emacs.git Preserve match data in 'kbd' * lisp/subr.el (kbd): Preserve match data since this function is declared pure (see discussion in bug#42147). --- diff --git a/lisp/subr.el b/lisp/subr.el index 10c37e94134..3c8dbd16146 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -893,8 +893,9 @@ This is the same format used for saving keyboard macros (see For an approximate inverse of this, see `key-description'." ;; Don't use a defalias, since the `pure' property is true only for ;; the calling convention of `kbd'. - (read-kbd-macro keys)) -(put 'kbd 'pure t) + (declare (pure t)) + ;; A pure function is expected to preserve the match data. + (save-match-data (read-kbd-macro keys))) (defun undefined () "Beep to tell the user this binding is undefined."