summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-12-30 21:26:52 -0500
committerKyle Meyer <kyle@kyleam.com>2014-12-30 21:26:52 -0500
commit7a9e2182b044e96d1274ef295527b18602b4e7bc (patch)
treeabe872de5351909750eb5ced022e14282102b6b1
parent9114608625abc893c6ee944a8b88357ba3a01dac (diff)
downloademacs.d-7a9e2182b044e96d1274ef295527b18602b4e7bc.tar.gz
Add display-only version of git-rebase-show-commit
Bind this version to SPC. This is more consistent with behavior in the log buffer, where RET shows the commit and switches to that buffer and SPC just displays the commit. However, the SPC variants still differ in their scrolling behavior. In the log buffer, SPC (magit-diff-show-or-scroll-up) will scroll if the buffer is already displayed, but km/git-rebase-show-commit doesn't support this. While it'd be nice to use magit-diff-show-or-scroll-up directly, this isn't easy to do because magit-diff-show-or-scroll-up doesn't take a revision argument (it pulls it directly from the magit section).
-rw-r--r--lisp/init-git.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 5f1ab82..861d839 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -151,6 +151,20 @@ START-POINT set to the current branch.
(after 'git-commit
(add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell))
+(defun km/git-rebase-show-commit ()
+ "Show the commit on the current line if any.
+Unlike `git-rebase-show-commit', display (but don't switch to)
+the commit buffer. And no dinging."
+ (interactive)
+ (save-excursion
+ (goto-char (line-beginning-position))
+ (--if-let (and (looking-at git-rebase-line)
+ (match-string 2))
+ (magit-show-commit it t))))
+
+(after 'git-rebase
+ (define-key git-rebase-mode-map "\s" 'km/git-rebase-show-commit))
+
(after 'magit
(magit-backup-mode -1)
(add-hook 'magit-find-file-hook 'view-mode)