From a7f284ec37ed130beef182a6cc6e9e6a79f8b83e Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 22 Sep 1996 04:40:37 +0000 Subject: [PATCH] (with-current-buffer): New macro. --- lisp/subr.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/subr.el b/lisp/subr.el index fb4901711cc..9d576fa3dce 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 -- 2.39.2