diff options
| author | Stefan Monnier | 2008-03-29 22:50:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-03-29 22:50:11 +0000 |
| commit | 4a5e18325acc15d065ccff1a70552161cfd6c7b2 (patch) | |
| tree | 2b16d008ecda615a28fe436d717b359c32b48528 | |
| parent | d9ce91aecbf87ac6c6ce91e5f0d219cf3e60b15c (diff) | |
| download | emacs-4a5e18325acc15d065ccff1a70552161cfd6c7b2.tar.gz emacs-4a5e18325acc15d065ccff1a70552161cfd6c7b2.zip | |
(with-temp-buffer): Assume kill-buffer can change current-buffer.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/subr.el | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 50d418df4a2..4e1ed6f6996 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2008-03-29 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-03-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * subr.el (with-temp-buffer): Assume kill-buffer can change cur-buf. | ||
| 4 | |||
| 3 | * textmodes/remember.el (remember-diary-convert-entry): Prefer boundp | 5 | * textmodes/remember.el (remember-diary-convert-entry): Prefer boundp |
| 4 | to with-no-warnings. | 6 | to with-no-warnings. |
| 5 | 7 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index b23ca358060..b656d2ed203 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2557,11 +2557,12 @@ See also `with-temp-file' and `with-output-to-string'." | |||
| 2557 | (declare (indent 0) (debug t)) | 2557 | (declare (indent 0) (debug t)) |
| 2558 | (let ((temp-buffer (make-symbol "temp-buffer"))) | 2558 | (let ((temp-buffer (make-symbol "temp-buffer"))) |
| 2559 | `(let ((,temp-buffer (generate-new-buffer " *temp*"))) | 2559 | `(let ((,temp-buffer (generate-new-buffer " *temp*"))) |
| 2560 | (unwind-protect | 2560 | ;; FIXME: kill-buffer can change current-buffer in some odd cases. |
| 2561 | (with-current-buffer ,temp-buffer | 2561 | (with-current-buffer ,temp-buffer |
| 2562 | ,@body) | 2562 | (unwind-protect |
| 2563 | (and (buffer-name ,temp-buffer) | 2563 | (progn ,@body) |
| 2564 | (kill-buffer ,temp-buffer)))))) | 2564 | (and (buffer-name ,temp-buffer) |
| 2565 | (kill-buffer ,temp-buffer))))))) | ||
| 2565 | 2566 | ||
| 2566 | (defmacro with-output-to-string (&rest body) | 2567 | (defmacro with-output-to-string (&rest body) |
| 2567 | "Execute BODY, return the text it sent to `standard-output', as a string." | 2568 | "Execute BODY, return the text it sent to `standard-output', as a string." |