From 4a5e18325acc15d065ccff1a70552161cfd6c7b2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 29 Mar 2008 22:50:11 +0000 Subject: [PATCH] (with-temp-buffer): Assume kill-buffer can change current-buffer. --- lisp/ChangeLog | 2 ++ 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 @@ 2008-03-29 Stefan Monnier + * subr.el (with-temp-buffer): Assume kill-buffer can change cur-buf. + * textmodes/remember.el (remember-diary-convert-entry): Prefer boundp to with-no-warnings. 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'." (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." -- 2.11.4.GIT