git-blame.el: format of date strings

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

 



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 <jrnieder@xxxxxxxxx>
---
 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

--
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]