diff options
| author | Richard M. Stallman | 1996-09-22 04:40:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-22 04:40:37 +0000 |
| commit | a7f284ec37ed130beef182a6cc6e9e6a79f8b83e (patch) | |
| tree | 7e49d4d9665d04fcee28fd45ed2e2f09a061fd65 | |
| parent | 2754fefaecfd856ff9e0972d0589e02b3c66eaa8 (diff) | |
| download | emacs-a7f284ec37ed130beef182a6cc6e9e6a79f8b83e.tar.gz emacs-a7f284ec37ed130beef182a6cc6e9e6a79f8b83e.zip | |
(with-current-buffer): New macro.
| -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." | |||
| 740 | (start-process name buffer shell-file-name shell-command-switch | 740 | (start-process name buffer shell-file-name shell-command-switch |
| 741 | (mapconcat 'identity args " "))))) | 741 | (mapconcat 'identity args " "))))) |
| 742 | 742 | ||
| 743 | (defmacro with-current-buffer (buffer &rest body) | ||
| 744 | "Execute the forms in BODY with BUFFER as the current buffer. | ||
| 745 | The value returned is the value of the last form in BODY." | ||
| 746 | `(save-current-buffer | ||
| 747 | (set-buffer ,buffer) | ||
| 748 | . ,body)) | ||
| 749 | |||
| 743 | (defvar save-match-data-internal) | 750 | (defvar save-match-data-internal) |
| 744 | 751 | ||
| 745 | ;; We use save-match-data-internal as the local variable because | 752 | ;; We use save-match-data-internal as the local variable because |