From 86ec740ec46b10860776c4ac73d55ad5fcde90b1 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Tue, 23 Sep 2008 17:26:40 +0000 Subject: [PATCH] (with-output-to-string): Make sure that the temporary buffer gets killed. --- lisp/ChangeLog | 9 +++++++-- lisp/subr.el | 13 +++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68c237ee0f4..319ec8c2442 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-09-23 Romain Francoise + + * subr.el (with-output-to-string): Make sure that the temporary + buffer gets killed. + 2008-09-23 Markus Sauermann (tiny change) * emacs-lisp/emacslisp-mode.el (calculate-lisp-indent): Fix @@ -34,7 +39,7 @@ 2008-09-20 David De La Harpe Golden - * files.el (move-file-to-trash): Avoid recursive trashing if + * files.el (move-file-to-trash): Avoid recursive trashing if rename-file calls delete-file. 2008-09-20 Glenn Morris @@ -111,7 +116,7 @@ 2008-09-17 Jay Belanger - * calc/calc-units.el (calc-convert-temperature): Use default + * calc/calc-units.el (calc-convert-temperature): Use default units when appropriate. 2008-09-16 Markus Triska diff --git a/lisp/subr.el b/lisp/subr.el index 2aa802cd03e..2ce6b234e60 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2586,12 +2586,13 @@ See also `with-temp-file' and `with-output-to-string'." (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. -- 2.39.5