aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Hållberg <gustav@gmail.com>2012-04-06 21:32:33 +0200
committerGustav Hållberg <gustav@gmail.com>2012-04-09 09:23:20 +0200
commitaceb7d00cba100e19dde4632f8815d0275982724 (patch)
treec27521a85deaa8ec36d9fba5c602d35dec64d8c0
parentf46c584ebe5232dbd6c43144e747e01293966c46 (diff)
downloadstgit-aceb7d00cba100e19dde4632f8815d0275982724.tar.gz
stgit.el: Change stgit-capture-output to return what its body returned
Signed-off-by: Gustav Hållberg <gustav@gmail.com>
-rw-r--r--contrib/stgit.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el
index b11f8e4..6138bf9 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -398,7 +398,7 @@ Argument DIR is the repository path."
(defmacro stgit-capture-output (name &rest body)
"Capture StGit output and, if there was any output, show it in a window
at the end.
-Returns nil if there was no output."
+Returns the result of the last form in BODY."
(declare (debug ([&or stringp null] body))
(indent 1))
`(let ((output-buf (get-buffer-create ,(or name "*StGit output*")))
@@ -409,13 +409,14 @@ Returns nil if there was no output."
(erase-buffer)
(setq default-directory stgit-dir)
(setq buffer-read-only t))
- (let ((standard-output output-buf))
- ,@body)
- (with-current-buffer output-buf
- (set-buffer-modified-p nil)
- (setq buffer-read-only t)
- (if (< (point-min) (point-max))
- (display-buffer output-buf t)))))
+ (prog1
+ (let ((standard-output output-buf))
+ ,@body)
+ (with-current-buffer output-buf
+ (set-buffer-modified-p nil)
+ (setq buffer-read-only t)
+ (if (< (point-min) (point-max))
+ (display-buffer output-buf t))))))
(defun stgit-make-run-args (args)
"Return a copy of ARGS with its elements converted to strings."