summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-09-22 04:40:37 +0000
committerRichard M. Stallman <rms@gnu.org>1996-09-22 04:40:37 +0000
commit59e5cf4d344972833f455ac43079ccc78efb6b95 (patch)
treee114bb839a3105dc65ac0f35051d79a6eeef2494
parent56f3aa0bcf0d7231dc7983888dd67f735854f170 (diff)
downloademacs-59e5cf4d344972833f455ac43079ccc78efb6b95.tar.gz
(with-current-buffer): New macro.
-rw-r--r--lisp/subr.el7
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