emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c48bb7d: Preserve match data in 'kbd'


From: Mattias Engdegård
Subject: master c48bb7d: Preserve match data in 'kbd'
Date: Wed, 29 Jul 2020 11:49:16 -0400 (EDT)

branch: master
commit c48bb7deb88317b6beda4c5944aca7998ff8c37a
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Preserve match data in 'kbd'
    
    * lisp/subr.el (kbd): Preserve match data since this function is
    declared pure (see discussion in bug#42147).
---
 lisp/subr.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 10c37e9..3c8dbd1 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]