Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

git-blame.el: format of date strings

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:32
Subsystem: the rest · Maintainer: Linus Torvalds

Jonathan Nieder wrote:
 - The time format (%c) is rather verbose.  I think I prefer %D
   (so maybe this is a potential tweakable?).
Here's what that might look like.  Sadly, format-time-string does not
seem to have an equivalent to git log's %ar format.

Signed-off-by: Jonathan Nieder <redacted>
---
 contrib/emacs/git-blame.el |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 9f60a6f..a43981e 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -121,6 +121,12 @@ mode. See `git-blame-format' for more information.
 `git-blame' mode. See `git-blame-format' for more information."
   :group 'git-blame)
 
+(defcustom git-blame-date-format
+  "%c"
+  "The format of dates specified with %t or %T passed to `git-blame-format'.
+See `format-time-string' for more information."
+  :group 'git-blame)
+
 (defun git-blame-format (info format)
   "Use format-spec to format the blame info in INFO with the following keys:
 
@@ -146,10 +152,10 @@ mode. See `git-blame-format' for more information.
                    (?H . ,(car info))
                    (?a . ,(git-blame-get-info info 'author))
                    (?A . ,(git-blame-get-info info 'author-mail))
-                   (?t . ,(format-time-string "%c" author-time))
+                   (?t . ,(format-time-string git-blame-date-format author-time))
                    (?c . ,(git-blame-get-info info 'committer))
                    (?C . ,(git-blame-get-info info 'committer-mail))
-                   (?T . ,(format-time-string "%c" committer-time))
+                   (?T . ,(format-time-string git-blame-date-format committer-time))
                    (?s . ,(git-blame-get-info info 'summary))))))
 
 (defun git-blame-color-scale (&rest elements)
-- 
1.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help