]> git.eshelyaron.com Git - emacs.git/commitdiff
(combine-after-change-calls): New macro.
authorRichard M. Stallman <rms@gnu.org>
Sat, 9 Nov 1996 21:46:35 +0000 (21:46 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 9 Nov 1996 21:46:35 +0000 (21:46 +0000)
lisp/subr.el

index 83cc198040d9d52e2e88767cb91877fde37f58c0..0634ce21be771bbbc8c4e234f4530663f83f5eb8 100644 (file)
@@ -783,6 +783,24 @@ See also `with-temp-file' and `with-output-to-string'."
        (prog1
           (buffer-string)
         (kill-buffer nil)))))
+
+(defmacro combine-after-change-calls (&rest body)
+  "Execute BODY, but don't call the after-change functions till the end.
+If BODY makes changes in the buffer, they are recorded
+and the functions on `after-change-functions' are called several times
+when BODY is finished.
+The return value is rthe value of the last form in BODY.
+
+If `before-change-functions' is non-nil, then calls to the after-change
+functions can't be deferred, so in that case this macro has no effect.
+
+Do not alter `after-change-functions' or `before-change-functions'
+in BODY."
+  `(unwind-protect
+       (let ((combine-after-change-calls t))
+        . ,body)
+     (combine-after-change-execute)))
+
 \f
 (defvar save-match-data-internal)