diff options
| author | Richard M. Stallman | 1996-08-28 22:44:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-28 22:44:18 +0000 |
| commit | c7ca41e69f379b1c1a21e255d1798c9a712803df (patch) | |
| tree | e5df191abf9f2a83759c89d9849d812b6ea30fed | |
| parent | b26e6764f08ee3c0253b1739e89c6dbf1041ba4f (diff) | |
| download | emacs-c7ca41e69f379b1c1a21e255d1798c9a712803df.tar.gz emacs-c7ca41e69f379b1c1a21e255d1798c9a712803df.zip | |
(save-match-data): Use save-match-data-internal
as the local variable, instead of an uninterned symbol.
| -rw-r--r-- | lisp/subr.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index b68876b66da..31f9e05377f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -740,13 +740,18 @@ Wildcards and redirection are handled as usual in the shell." | |||
| 740 | (start-process name buffer shell-file-name shell-command-switch | 740 | (start-process name buffer shell-file-name shell-command-switch |
| 741 | (mapconcat 'identity args " "))))) | 741 | (mapconcat 'identity args " "))))) |
| 742 | 742 | ||
| 743 | (defvar save-match-data-internal) | ||
| 744 | |||
| 745 | ;; We use save-match-data-internal as the local variable because | ||
| 746 | ;; that works ok in practice (people should not use that variable elsewhere). | ||
| 747 | ;; We used to use an uninterned symbol; the compiler handles that properly | ||
| 748 | ;; now, but it generates slower code. | ||
| 743 | (defmacro save-match-data (&rest body) | 749 | (defmacro save-match-data (&rest body) |
| 744 | "Execute the BODY forms, restoring the global value of the match data." | 750 | "Execute the BODY forms, restoring the global value of the match data." |
| 745 | (let ((original (make-symbol "match-data"))) | 751 | `(let ((save-match-data-variable '(match-data))) |
| 746 | (list 'let (list (list original '(match-data))) | 752 | (unwind-protect |
| 747 | (list 'unwind-protect | 753 | (progn ,@body) |
| 748 | (cons 'progn body) | 754 | (store-match-data save-match-data-variable))))) |
| 749 | (list 'store-match-data original))))) | ||
| 750 | 755 | ||
| 751 | (defun match-string (num &optional string) | 756 | (defun match-string (num &optional string) |
| 752 | "Return string of text matched by last search. | 757 | "Return string of text matched by last search. |