[StGit PATCH 09/17] Emacs mode: Improve the output buffer state
- From
David Kågedal <davidk@lysator.liu.se>
- Date
- Dec 14, 2007, 10:58 UTC
- Message-ID
- <20071214105800.18066.28256.stgit@krank>
- In-Reply-To
- <20071214105238.18066.23281.stgit@krank>
Make the output buffer have the correct default-directory, and make it read-only and unmodified.
Signed-off-by: David Kågedal <davidk@lysator.liu.se> ---
contrib/stgit.el | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/contrib/stgit.el b/contrib/stgit.el index ed2fc37..82f0d38 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -41,13 +41,20 @@ Argument DIR is the repository path." (defmacro stgit-capture-output (name &rest body) "Capture StGit output and show it in a window at the end" - `(let ((output-buf (get-buffer-create ,(or name "*StGit output*")))) + `(let ((output-buf (get-buffer-create ,(or name "*StGit output*"))) + (stgit-dir default-directory) + (inhibit-read-only t)) (with-current-buffer output-buf - (erase-buffer)) + (erase-buffer) + (setq default-directory stgit-dir) + (setq buffer-read-only t)) (let ((standard-output output-buf)) ,@body) - (if (with-current-buffer output-buf (< (point-min) (point-max))) - (display-buffer output-buf t)))) + (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))))) (put 'stgit-capture-output 'lisp-indent-function 1) (defun stgit-run (&rest args)