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.
(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."