Skip to contentSkip to conversation

git-blame.el: show the when, who and what in the minibuffer.

PATCH In review Junichi Uekawa 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-blame.el: show the when, who and what in the minibuffer.

Change the default operation to show 'when (day the commit was made), who (who made the commit), what (what the commit log was)' in the minibuffer instead of SHA1 and title of the commit log.

Since the user may prefer other displaying options, it is made as a user-configurable option.

---
 contrib/emacs/git-blame.el |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
contrib/emacs/git-blame.el +9 -1
index bb671d5..99e2b6f 100644
@@ -105,6 +105,13 @@ selected element from l."
      (setq ,l (remove e ,l))
      e))
 
+(defvar git-blame-log-oneline-format
+  "format:[%cr] %cn: %s"
+  "*Formatting option used for describing current line in the minibuffer.
+
+This option is used to pass to git log --pretty= command-line option, 
+and describe which commit the current line was made.")
+
 (defvar git-blame-dark-colors
   (git-blame-color-scale "0c" "04" "24" "1c" "2c" "34" "14" "3c")
   "*List of colors (format #RGB) to use in a dark environment.
@@ -371,7 +378,8 @@ See also function `git-blame-mode'."
 (defun git-describe-commit (hash)
   (with-temp-buffer
     (call-process "git" nil t nil
-                  "log" "-1" "--pretty=oneline"
+                  "log" "-1" 
+		  (concat "--pretty=" git-blame-log-oneline-format)
                   hash)
     (buffer-substring (point-min) (1- (point-max)))))
 
Signature · 1 line
1.5.3.8
#1 lore raw
Quoted 6 lines · Junichi Uekawa

Change the default operation to show 'when (day the commit was made), who (who made the commit), what (what the commit log was)' in the minibuffer instead of SHA1 and title of the commit log.

Since the user may prefer other displaying options, it is made as a user-configurable option.

Good idea.

Quoted 31 lines
---
 contrib/emacs/git-blame.el |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
contrib/emacs/git-blame.el +9 -1
index bb671d5..99e2b6f 100644
@@ -105,6 +105,13 @@ selected element from l."
      (setq ,l (remove e ,l))
      e))
 
+(defvar git-blame-log-oneline-format
+  "format:[%cr] %cn: %s"
+  "*Formatting option used for describing current line in the minibuffer.
+
+This option is used to pass to git log --pretty= command-line option, 
+and describe which commit the current line was made.")
+
 (defvar git-blame-dark-colors
   (git-blame-color-scale "0c" "04" "24" "1c" "2c" "34" "14" "3c")
   "*List of colors (format #RGB) to use in a dark environment.
@@ -371,7 +378,8 @@ See also function `git-blame-mode'."
 (defun git-describe-commit (hash)
   (with-temp-buffer
     (call-process "git" nil t nil
-                  "log" "-1" "--pretty=oneline"
+                  "log" "-1" 
+		  (concat "--pretty=" git-blame-log-oneline-format)
                   hash)
     (buffer-substring (point-min) (1- (point-max)))))
Signature · 1 line
David Kågedal
#2 lore raw
In reply to Junichi Uekawa

Hi,

Change the default operation to show 'when (day the commit was made), who (who made the commit), what (what the commit log was)' in the minibuffer instead of SHA1 and title of the commit log.

Love this even more with the user configurable option.

Xavier

Signature · 3 lines
http://www.gnu.org
http://www.april.org
http://www.lolica.org