Mercurial > emacs
comparison lisp/simple.el @ 27298:dbaaa90ea0eb
(with-syntax-table): Moved to subr.el.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 12 Jan 2000 03:05:14 +0000 |
parents | bf32d38f9721 |
children | 1cb6c18c3163 |
comparison
equal
deleted
inserted
replaced
27297:f5713c397636 | 27298:dbaaa90ea0eb |
---|---|
4130 ;; for cloning to work properly). | 4130 ;; for cloning to work properly). |
4131 (run-hooks 'clone-buffer-hook)) | 4131 (run-hooks 'clone-buffer-hook)) |
4132 (if display-flag (pop-to-buffer new)) | 4132 (if display-flag (pop-to-buffer new)) |
4133 new)) | 4133 new)) |
4134 | 4134 |
4135 | |
4136 (defmacro with-syntax-table (table &rest body) | |
4137 "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. | |
4138 The syntax table of the current buffer is saved, BODY is evaluated, and the | |
4139 saved table is restored, even in case of an abnormal exit. | |
4140 Value is what BODY returns." | |
4141 (let ((old-table (gensym)) | |
4142 (old-buffer (gensym))) | |
4143 `(let ((,old-table (syntax-table)) | |
4144 (,old-buffer (current-buffer))) | |
4145 (unwind-protect | |
4146 (progn | |
4147 (set-syntax-table (copy-syntax-table ,table)) | |
4148 ,@body) | |
4149 (save-current-buffer | |
4150 (set-buffer ,old-buffer) | |
4151 (set-syntax-table ,old-table)))))) | |
4152 | |
4153 (put 'with-syntax-table 'lisp-indent-function 1) | |
4154 (put 'with-syntax-table 'edebug-form-spec '(form body)) | |
4155 | |
4156 ;;; simple.el ends here | 4135 ;;; simple.el ends here |