(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)
(erase-buffer)
(insert "Branch: ")
(stgit-run "branch")
- (stgit-run "series")
+ (stgit-run "series" "--description")
(if curpatch
(stgit-goto-patch curpatch)
(goto-line curline))))
(suppress-keymap stgit-mode-map)
(define-key stgit-mode-map "?" 'stgit-help)
(define-key stgit-mode-map "h" 'stgit-help)
+ (define-key stgit-mode-map "p" 'previous-line)
+ (define-key stgit-mode-map "n" 'next-line)
(define-key stgit-mode-map "g" 'stgit-refresh)
(define-key stgit-mode-map "r" 'stgit-rename)
(define-key stgit-mode-map ">" 'stgit-push-next)
(define-key stgit-mode-map "<" 'stgit-pop-next)
(define-key stgit-mode-map "P" 'stgit-push-or-pop)
+ (define-key stgit-mode-map "G" 'stgit-goto)
(define-key stgit-mode-map "=" 'stgit-show))
(defun stgit-mode ()
goal-column 2)
(use-local-map stgit-mode-map)
(set (make-local-variable 'list-buffers-directory) default-directory)
+ (set-variable 'truncate-lines 't)
(run-hooks 'stgit-mode-hook))
(defun stgit-patch-at-point ()
"Return the patch name on the current line"
(save-excursion
(beginning-of-line)
- (if (looking-at "[>+-] \\(.*\\)")
+ (if (looking-at "[>+-] \\([^ ]*\\)")
(match-string 1)
nil)))
"Move point to the line containing PATCH"
(let ((p (point)))
(goto-char (point-min))
- (if (re-search-forward (concat "[>+-] " (regexp-quote patch) "$") nil t)
+ (if (re-search-forward (concat "[>+-] " (regexp-quote patch) " ") nil t)
(progn (move-to-column goal-column)
t)
(goto-char p)
(stgit-run (if applied "pop" "push") patch))
(stgit-refresh)))
+(defun stgit-goto ()
+ "Go to the patch on the current line"
+ (interactive)
+ (let ((patch (stgit-patch-at-point)))
+ (stgit-capture-output nil
+ (stgit-run "goto" patch))
+ (stgit-refresh)))
+
(defun stgit-show ()
"Show the patch on the current line"
(interactive)