diff options
| author | Richard M. Stallman | 1996-11-09 21:46:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-11-09 21:46:35 +0000 |
| commit | 2ec9c94e21e908bd2d7825aa13b1a4664a07aa3b (patch) | |
| tree | a4b9940b2fb6e37c27763a034948a9de4806c0fc | |
| parent | c2c5ed2c10a2f6115c596206a02cbee0a28be23f (diff) | |
| download | emacs-2ec9c94e21e908bd2d7825aa13b1a4664a07aa3b.tar.gz emacs-2ec9c94e21e908bd2d7825aa13b1a4664a07aa3b.zip | |
(combine-after-change-calls): New macro.
| -rw-r--r-- | lisp/subr.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 83cc198040d..0634ce21be7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -783,6 +783,24 @@ See also `with-temp-file' and `with-output-to-string'." | |||
| 783 | (prog1 | 783 | (prog1 |
| 784 | (buffer-string) | 784 | (buffer-string) |
| 785 | (kill-buffer nil))))) | 785 | (kill-buffer nil))))) |
| 786 | |||
| 787 | (defmacro combine-after-change-calls (&rest body) | ||
| 788 | "Execute BODY, but don't call the after-change functions till the end. | ||
| 789 | If BODY makes changes in the buffer, they are recorded | ||
| 790 | and the functions on `after-change-functions' are called several times | ||
| 791 | when BODY is finished. | ||
| 792 | The return value is rthe value of the last form in BODY. | ||
| 793 | |||
| 794 | If `before-change-functions' is non-nil, then calls to the after-change | ||
| 795 | functions can't be deferred, so in that case this macro has no effect. | ||
| 796 | |||
| 797 | Do not alter `after-change-functions' or `before-change-functions' | ||
| 798 | in BODY." | ||
| 799 | `(unwind-protect | ||
| 800 | (let ((combine-after-change-calls t)) | ||
| 801 | . ,body) | ||
| 802 | (combine-after-change-execute))) | ||
| 803 | |||
| 786 | 804 | ||
| 787 | (defvar save-match-data-internal) | 805 | (defvar save-match-data-internal) |
| 788 | 806 | ||