Skip to contentSkip to conversation

git-blame.el: Add `git-blame-show-full-message'

PATCH New Martin Nordholts 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-blame.el: Add `git-blame-show-full-message'

Add an interactively callable function `git-blame-show-full-message' that shows the full commit message with --pretty=full in the echo area.

The purpose of the function is to allow a user of git-blame.el to browse around in a file until an interesting commit oneliner is shown, at which point the user can invoke `git-blame-show-full-message' to get more verbose information.

---
 contrib/emacs/git-blame.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
contrib/emacs/git-blame.el +10 -4
index 4fa70c5..443ebce 100644
@@ -40,7 +40,8 @@
 ;; turn it on while viewing a file, the editor buffer will be updated by
 ;; setting the background of individual lines to a color that reflects
 ;; which commit it comes from.  And when you move around the buffer, a
-;; one-line summary will be shown in the echo area.
+;; one-line summary will be shown in the echo area.  To get the complete
+;; commit message, invoke `git-blame-show-full-message'.
 
 ;;; Installation:
 ;;
@@ -340,7 +341,7 @@ See also function `git-blame-mode'."
 			 (git-blame-random-pop git-blame-colors)
 		       git-blame-ancient-color)))
           (setq info (list hash src-line res-line num-lines
-                           (git-describe-commit hash)
+                           (git-describe-commit hash git-blame-log-oneline-format)
                            (cons 'color color))))
         (puthash hash info git-blame-cache))
       (goto-line res-line)
@@ -375,11 +376,11 @@ See also function `git-blame-mode'."
         (car info)
       (error "No commit info"))))
 
-(defun git-describe-commit (hash)
+(defun git-describe-commit (hash pretty-format)
   (with-temp-buffer
     (call-process "git" nil t nil
                   "log" "-1"
-		  (concat "--pretty=" git-blame-log-oneline-format)
+		  (concat "--pretty=" pretty-format)
                   hash)
     (buffer-substring (point-min) (point-max))))
 
@@ -392,6 +393,11 @@ See also function `git-blame-mode'."
       (message "%s" (nth 4 info))
       (setq git-blame-last-identification info))))
 
+(defun git-blame-show-full-message  ()
+  "Show full log message about current commit"
+  (interactive)
+  (message (git-describe-commit (git-blame-current-commit) "full")))
+
 ;; (defun git-blame-after-save ()
 ;;   (when git-blame-mode
 ;;     (git-blame-cleanup)
Signature · 1 line
1.6.2.5