summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorRomain Francoise <romain@orebokech.com>2008-09-23 17:26:40 +0000
committerRomain Francoise <romain@orebokech.com>2008-09-23 17:26:40 +0000
commit86ec740ec46b10860776c4ac73d55ad5fcde90b1 (patch)
tree641b6f30bf7c7ced121b8e724c95e8cd774f6ae7 /lisp/subr.el
parentb05f4920d5bd6c951ac10826bef6b945f171ffd5 (diff)
downloademacs-86ec740ec46b10860776c4ac73d55ad5fcde90b1.tar.gz
(with-output-to-string): Make sure that the temporary buffer gets
killed.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el13
1 files changed, 7 insertions, 6 deletions
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.