diff options
| author | Gerd Moellmann | 1999-11-17 21:09:57 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-11-17 21:09:57 +0000 |
| commit | aad9b36243379091af9b783ea69fd7b04db0463e (patch) | |
| tree | 632c23e2416d2ad7d39d02be31a520fe1a1b5089 | |
| parent | 5d7e4a2c3cff0f46fec0e77529a7360ef8789799 (diff) | |
| download | emacs-aad9b36243379091af9b783ea69fd7b04db0463e.tar.gz emacs-aad9b36243379091af9b783ea69fd7b04db0463e.zip | |
(with-syntax-table): Save buffer explicitly instead of
using save-excursion.
| -rw-r--r-- | lisp/simple.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 279a76ad713..084bf39e8cc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4139,16 +4139,19 @@ after it has been set up properly in other respects." | |||
| 4139 | 4139 | ||
| 4140 | (defmacro with-syntax-table (table &rest body) | 4140 | (defmacro with-syntax-table (table &rest body) |
| 4141 | "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. | 4141 | "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. |
| 4142 | Point, mark, current buffer, and syntax table are saved, BODY is | 4142 | Current buffer and syntax table are saved, BODY is evaluated, and the |
| 4143 | evaluated, and the saved values are restored, even in case of an | 4143 | saved values are restored, even in case of an abnormal exit. |
| 4144 | abnormal exit. Value is what BODY returns." | 4144 | Value is what BODY returns." |
| 4145 | (let ((old-table (gensym))) | 4145 | (let ((old-table (gensym)) |
| 4146 | '(let ((,old-table (syntax-table))) | 4146 | (old-buffer (gensym))) |
| 4147 | '(let ((,old-table (syntax-table)) | ||
| 4148 | (,old-buffer (current-buffer))) | ||
| 4147 | (unwind-protect | 4149 | (unwind-protect |
| 4148 | (save-excursion | 4150 | (progn |
| 4149 | (set-syntax-table (copy-syntax-table ,table)) | 4151 | (set-syntax-table (copy-syntax-table ,table)) |
| 4150 | ,@body) | 4152 | ,@body) |
| 4151 | (set-syntax-table ,old-table))))) | 4153 | (set-buffer ,old-buffer) |
| 4154 | (set-syntax-table ,old-table))))) | ||
| 4152 | 4155 | ||
| 4153 | (put 'with-syntax-table 'lisp-indent-function 1) | 4156 | (put 'with-syntax-table 'lisp-indent-function 1) |
| 4154 | (put 'with-syntax-table 'edebug-form-spec '(form body)) | 4157 | (put 'with-syntax-table 'edebug-form-spec '(form body)) |