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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Martin Nordholts <martinn@xxxxxxxxxxxxx>
---
 contrib/emacs/git-blame.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 4fa70c5..443ebce 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -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)
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]