]> git.eshelyaron.com Git - emacs.git/commitdiff
(with-current-buffer): New macro.
authorRichard M. Stallman <rms@gnu.org>
Sun, 22 Sep 1996 04:40:37 +0000 (04:40 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 22 Sep 1996 04:40:37 +0000 (04:40 +0000)
lisp/subr.el

index fb4901711cc041b6e64eda461194af520f191b8f..9d576fa3dce3f193ae4726a1273fcfe01f696d69 100644 (file)
@@ -740,6 +740,13 @@ Wildcards and redirection are handled as usual in the shell."
     (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