]> git.eshelyaron.com Git - emacs.git/commitdiff
(with-temp-buffer): Assume kill-buffer can change current-buffer.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 29 Mar 2008 22:50:11 +0000 (22:50 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 29 Mar 2008 22:50:11 +0000 (22:50 +0000)
lisp/ChangeLog
lisp/subr.el

index 50d418df4a21e097b2e40cb9d44dd993db082768..4e1ed6f6996a2c26569c1e13a4061b5903415a55 100644 (file)
@@ -1,5 +1,7 @@
 2008-03-29  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * 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.
 
index b23ca358060a43c9677b2d6d05671498fa71a6f1..b656d2ed203e05d7b55f96d24c21513a6ff43fda 100644 (file)
@@ -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."