diff options
author | Stefan Monnier <[email protected]> | 2008-03-29 22:50:11 +0000 |
---|---|---|
committer | Stefan Monnier <[email protected]> | 2008-03-29 22:50:11 +0000 |
commit | 4a5e18325acc15d065ccff1a70552161cfd6c7b2 (patch) | |
tree | 2b16d008ecda615a28fe436d717b359c32b48528 /lisp/subr.el | |
parent | d9ce91aecbf87ac6c6ce91e5f0d219cf3e60b15c (diff) |
(with-temp-buffer): Assume kill-buffer can change current-buffer.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index b23ca35806..b656d2ed20 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2557,11 +2557,12 @@ See also `with-temp-file' and `with-output-to-string'." (declare (indent 0) (debug t)) (let ((temp-buffer (make-symbol "temp-buffer"))) `(let ((,temp-buffer (generate-new-buffer " *temp*"))) - (unwind-protect - (with-current-buffer ,temp-buffer - ,@body) - (and (buffer-name ,temp-buffer) - (kill-buffer ,temp-buffer)))))) + ;; FIXME: kill-buffer can change current-buffer in some odd cases. + (with-current-buffer ,temp-buffer + (unwind-protect + (progn ,@body) + (and (buffer-name ,temp-buffer) + (kill-buffer ,temp-buffer))))))) (defmacro with-output-to-string (&rest body) "Execute BODY, return the text it sent to `standard-output', as a string." |