diff options
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 7 |
1 files changed, 7 insertions, 0 deletions
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 |