diff options
| author | Gerd Moellmann | 1999-11-16 13:29:51 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-11-16 13:29:51 +0000 |
| commit | d01a33cf8d8855f935b5e93145ab8e5cfb99f598 (patch) | |
| tree | 36eaf980db91ebfd0413baea93dad2e5696631cd | |
| parent | 0a936fe0eea70582d4e48333ff684eaa2dda5601 (diff) | |
| download | emacs-d01a33cf8d8855f935b5e93145ab8e5cfb99f598.tar.gz emacs-d01a33cf8d8855f935b5e93145ab8e5cfb99f598.zip | |
(with-syntax-table): New.
| -rw-r--r-- | lisp/simple.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index b65e8b2ff99..279a76ad713 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -27,6 +27,10 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (eval-when-compile | ||
| 31 | (require 'cl)) | ||
| 32 | |||
| 33 | |||
| 30 | (defgroup killing nil | 34 | (defgroup killing nil |
| 31 | "Killing and yanking commands" | 35 | "Killing and yanking commands" |
| 32 | :group 'editing) | 36 | :group 'editing) |
| @@ -4132,4 +4136,21 @@ after it has been set up properly in other respects." | |||
| 4132 | (if display-flag (pop-to-buffer new)) | 4136 | (if display-flag (pop-to-buffer new)) |
| 4133 | new)) | 4137 | new)) |
| 4134 | 4138 | ||
| 4139 | |||
| 4140 | (defmacro with-syntax-table (table &rest body) | ||
| 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 | ||
| 4143 | evaluated, and the saved values are restored, even in case of an | ||
| 4144 | abnormal exit. Value is what BODY returns." | ||
| 4145 | (let ((old-table (gensym))) | ||
| 4146 | '(let ((,old-table (syntax-table))) | ||
| 4147 | (unwind-protect | ||
| 4148 | (save-excursion | ||
| 4149 | (set-syntax-table (copy-syntax-table ,table)) | ||
| 4150 | ,@body) | ||
| 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 | |||
| 4135 | ;;; simple.el ends here | 4156 | ;;; simple.el ends here |