diff lisp/subr.el @ 16277:bbddbc86b82b

(with-current-buffer): New macro.
author Richard M. Stallman <rms@gnu.org>
date Sun, 22 Sep 1996 04:40:37 +0000
parents 9a41bae14122
children 40f7e9a1829c
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