diff options
author | Richard M. Stallman <[email protected]> | 1992-09-13 20:40:20 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 1992-09-13 20:40:20 +0000 |
commit | 715984d3a4be50954a28e9a6fd270986d319826d (patch) | |
tree | 3d2162af685db890d5f6ce84332427cb5cd5dc05 /lisp/subr.el | |
parent | ab94e6e7958295725884bcbe9097cb0eee9721b7 (diff) |
*** empty log message ***
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index d50e5035ff..486a217c76 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -146,6 +146,15 @@ perhaps they ought to be." (setcdr (car keymap) newdef)) (setq keymap (cdr keymap))))) +(defmacro save-match-data (&rest body) + "Execute the BODY forms, restoring the global value of the match data." + (let ((original (make-symbol "match-data"))) + (list + 'let (list (list original '(match-data))) + (list 'unwind-protect + (cons 'progn body) + (list 'store-match-data original))))) + ;; Avoids useless byte-compilation. ;; In the future, would be better to fix byte compiler ;; not to really compile in cases like this, |