changeset 16277:bbddbc86b82b

(with-current-buffer): New macro.
author Richard M. Stallman <rms@gnu.org>
date Sun, 22 Sep 1996 04:40:37 +0000
parents f98b8c0b6414
children 37408c6b96fd
files lisp/subr.el
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sun Sep 22 04:38:36 1996 +0000
+++ b/lisp/subr.el	Sun Sep 22 04:40:37 1996 +0000
@@ -740,6 +740,13 @@
     (start-process name buffer shell-file-name shell-command-switch
 		   (mapconcat 'identity args " ")))))
 
+(defmacro with-current-buffer (buffer &rest body)
+  "Execute the forms in BODY with BUFFER as the current buffer.
+The value returned is the value of the last form in BODY."
+  `(save-current-buffer
+    (set-buffer ,buffer)
+    . ,body))
+
 (defvar save-match-data-internal)
 
 ;; We use save-match-data-internal as the local variable because