diff lisp/subr.el @ 98315:5053145089c9

(with-output-to-string): Make sure that the temporary buffer gets killed.
author Romain Francoise <romain@orebokech.com>
date Tue, 23 Sep 2008 17:26:40 +0000
parents c94db6d7eda9
children c05c152df43c
line wrap: on
line diff
--- a/lisp/subr.el	Tue Sep 23 11:32:25 2008 +0000
+++ b/lisp/subr.el	Tue Sep 23 17:26:40 2008 +0000
@@ -2586,12 +2586,13 @@
   (declare (indent 0) (debug t))
   `(let ((standard-output
 	  (get-buffer-create (generate-new-buffer-name " *string-output*"))))
-     (let ((standard-output standard-output))
-       ,@body)
-     (with-current-buffer standard-output
-       (prog1
-	   (buffer-string)
-	 (kill-buffer nil)))))
+     (unwind-protect
+	 (progn
+	   (let ((standard-output standard-output))
+	     ,@body)
+	   (with-current-buffer standard-output
+	     (buffer-string)))
+       (kill-buffer standard-output))))
 
 (defmacro with-local-quit (&rest body)
   "Execute BODY, allowing quits to terminate BODY but not escape further.