aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2017-11-08 12:21:37 +0100
committerJonas Bernoulli <jonas@bernoul.li>2017-11-09 17:30:52 +0100
commitcfed6f5be863296bbdae531f1f4c62d2cbab3b39 (patch)
tree1b179646c26a7f989a0f33b9da33027dfb383ce3
parentb13b0482f81030373ae6ff157df94b8998b3a043 (diff)
Bind RET to magit-show-commit on commit messages in rev buffers
Closes #2949.
-rw-r--r--Documentation/RelNotes/2.12.0.txt5
-rw-r--r--lisp/magit-diff.el8
2 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/RelNotes/2.12.0.txt b/Documentation/RelNotes/2.12.0.txt
index af68d4e..a34b60a 100644
--- a/Documentation/RelNotes/2.12.0.txt
+++ b/Documentation/RelNotes/2.12.0.txt
@@ -135,6 +135,11 @@ Changes since v2.11.0
no corresponding local branch exists, and a new branch name that
doesn't match the name of any existing local or remote branch. #2906
+* The command `magit-show-commit' now offers the revision at point as
+ the default completion choice if the less generic mechanisms used to
+ determine the "current" revision fail. This is useful for visiting
+ revisions mentioned in commit messages. #2949
+
Fixes since v2.11.0
-------------------
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index d0880f1..b184001 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1868,9 +1868,15 @@ or a ref which is not a branch, then it inserts nothing."
(goto-char (point-max))
(insert ?\n))))
+(defvar magit-commit-message-section-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [remap magit-visit-thing] 'magit-show-commit)
+ map)
+ "Keymap for `commit-message' sections.")
+
(defun magit-insert-revision-message (rev)
"Insert the commit message into a revision buffer."
- (magit-insert-section (message)
+ (magit-insert-section (commit-message)
(let ((beg (point)))
(magit-rev-insert-format "%B" rev)
(if (= (point) (+ beg 2))