From: Richard M. Stallman Date: Sun, 22 Sep 1996 04:40:37 +0000 (+0000) Subject: (with-current-buffer): New macro. X-Git-Tag: emacs-20.1~3667 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/a7f284ec37ed130beef182a6cc6e9e6a79f8b83e (with-current-buffer): New macro. --- diff --git a/lisp/subr.el b/lisp/subr.el index fb4901711c..9d576fa3dc 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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