git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/4] Emacs: git-blame.el fixes and enhancements
@ 2013-07-02 17:34 Michal Sojka
  2013-07-02 17:34 ` [PATCH 1/4] git-blame.el: Fix buffer local declaration Michal Sojka
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michal Sojka @ 2013-07-02 17:34 UTC (permalink / raw)
  To: git
  Cc: David Kågedal, Lawrence Mitchell, Rüdiger Sonderfeld,
	Michal Sojka

Hi all,

following are a few fixes and enhancements to Emacs' git-blame-mode
(contrib/emacs/git-blame.el).

Michal Sojka (4):
  git-blame.el: Fix buffer local declaration
  git-blame.el: Make all line prefixes to have the same length
  git-blame.el: Allow displaying author/commit times
  git-blame.el: Change the default prefix format

 contrib/emacs/git-blame.el | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] git-blame.el: Fix buffer local declaration
  2013-07-02 17:34 [PATCH 0/4] Emacs: git-blame.el fixes and enhancements Michal Sojka
@ 2013-07-02 17:34 ` Michal Sojka
  2013-07-02 17:34 ` [PATCH 2/4] git-blame.el: Make all line prefixes to have the same length Michal Sojka
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Sojka @ 2013-07-02 17:34 UTC (permalink / raw)
  To: git
  Cc: David Kågedal, Lawrence Mitchell, Rüdiger Sonderfeld,
	Michal Sojka

git-blame-cache was declared buffer-local two times and
git-blame-idle-timer is global. The intended meaning was probably to make
git-blame-idle-timer buffer-local.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 contrib/emacs/git-blame.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index e671f6c..18ce241 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -200,7 +200,7 @@ minor mode.")
 
 (defvar git-blame-idle-timer nil
   "An idle timer that updates the blame")
-(make-variable-buffer-local 'git-blame-cache)
+(make-variable-buffer-local 'git-blame-idle-timer)
 
 (defvar git-blame-update-queue nil
   "A queue of update requests")
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] git-blame.el: Make all line prefixes to have the same length
  2013-07-02 17:34 [PATCH 0/4] Emacs: git-blame.el fixes and enhancements Michal Sojka
  2013-07-02 17:34 ` [PATCH 1/4] git-blame.el: Fix buffer local declaration Michal Sojka
@ 2013-07-02 17:34 ` Michal Sojka
  2013-07-02 17:34 ` [PATCH 3/4] git-blame.el: Allow displaying author/commit times Michal Sojka
  2013-07-02 17:34 ` [PATCH 4/4] git-blame.el: Change the default prefix format Michal Sojka
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Sojka @ 2013-07-02 17:34 UTC (permalink / raw)
  To: git
  Cc: David Kågedal, Lawrence Mitchell, Rüdiger Sonderfeld,
	Michal Sojka

Without this patch, the beginning of git-blame.el in emacs buffer looks
like this (note the Messige-ID line):

b52ba1   <jnareb@gmail.com>:;; Authors:    David Kågedal <davidk@lysator.liu.se>
b52ba1   <jnareb@gmail.com>:;; Created:    31 Jan 2007
28389d <davidk@lysator.liu.se>:;; Message-ID: <87iren2vqx.fsf@morpheus.local>
b52ba1   <jnareb@gmail.com>:;; License:    GPL
b52ba1   <jnareb@gmail.com>:;; Keywords:   git, version control, release management

With this patch, all lines are aligned even if email addresses have
different length.

b52ba1   <jnareb@gmail.com>:   ;; Authors:    David Kågedal <davidk@lysator.liu.se>
b52ba1   <jnareb@gmail.com>:   ;; Created:    31 Jan 2007
28389d <davidk@lysator.liu.se> ;; Message-ID: <87iren2vqx.fsf@morpheus.local>
b52ba1   <jnareb@gmail.com>:   ;; License:    GPL
b52ba1   <jnareb@gmail.com>:   ;; Keywords:   git, version control, release management


Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 contrib/emacs/git-blame.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 18ce241..573f408 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -116,6 +116,15 @@ mode. The format is passed to `format-spec' with the following format keys:
 "
   :group 'git-blame)
 
+(defcustom git-blame-prefix-width
+  "%-30.30s "
+  "The format for post-processing the prefix produced according
+to `git-blame-prefix-format'. This format is passed to `format'
+function. The default value ensures that all prefixes have the
+same length, i.e. the it causes the prefix to be either truncated
+or padded to 30 characters.
+"
+  :group 'git-blame)
 (defcustom git-blame-mouseover-format
   "%h %a %A: %s"
   "The format of the description shown when pointing at a line in
@@ -410,8 +419,9 @@ See also function `git-blame-mode'."
               (overlay-put ovl 'face (list :background
                                            (cdr (assq 'color (cdr info))))))
           (overlay-put ovl 'line-prefix
-                       (propertize (format-spec git-blame-prefix-format spec)
-                                   'face 'git-blame-prefix-face)))))))
+                       (propertize (format git-blame-prefix-width
+					   (format-spec git-blame-prefix-format spec))
+					   'face 'git-blame-prefix-face)))))))
 
 (defun git-blame-add-info (info key value)
   (nconc info (list (cons (intern key) value))))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] git-blame.el: Allow displaying author/commit times
  2013-07-02 17:34 [PATCH 0/4] Emacs: git-blame.el fixes and enhancements Michal Sojka
  2013-07-02 17:34 ` [PATCH 1/4] git-blame.el: Fix buffer local declaration Michal Sojka
  2013-07-02 17:34 ` [PATCH 2/4] git-blame.el: Make all line prefixes to have the same length Michal Sojka
@ 2013-07-02 17:34 ` Michal Sojka
  2013-07-02 17:34 ` [PATCH 4/4] git-blame.el: Change the default prefix format Michal Sojka
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Sojka @ 2013-07-02 17:34 UTC (permalink / raw)
  To: git
  Cc: David Kågedal, Lawrence Mitchell, Rüdiger Sonderfeld,
	Michal Sojka

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 contrib/emacs/git-blame.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 573f408..5c8933e 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -110,8 +110,10 @@ mode. The format is passed to `format-spec' with the following format keys:
   %H - the full hash
   %a - the author name
   %A - the author email
+  %t - the author time (see `git-blame-time-format')
   %c - the committer name
   %C - the committer email
+  %T - the committer time (see `git-blame-time-format')
   %s - the commit summary
 "
   :group 'git-blame)
@@ -125,6 +127,14 @@ same length, i.e. the it causes the prefix to be either truncated
 or padded to 30 characters.
 "
   :group 'git-blame)
+
+(defcustom git-blame-time-format
+  "%Y-%m-%d"
+  "The format for date/time values. This format is passed to
+`format-time-string' function.
+"
+  :group 'git-blame)
+
 (defcustom git-blame-mouseover-format
   "%h %a %A: %s"
   "The format of the description shown when pointing at a line in
@@ -135,8 +145,10 @@ with the following format keys:
   %H - the full hash
   %a - the author name
   %A - the author email
+  %t - the author time (see `git-blame-time-format')
   %c - the committer name
   %C - the committer email
+  %T - the committer time (see `git-blame-time-format')
   %s - the commit summary
 "
   :group 'git-blame)
@@ -393,6 +405,9 @@ See also function `git-blame-mode'."
           (puthash hash info git-blame-cache)
           info))))
 
+(defun git-blame-format-time (seconds)
+  (format-time-string git-blame-time-format (seconds-to-time (string-to-number seconds))))
+
 (defun git-blame-create-overlay (info start-line num-lines)
   (with-current-buffer git-blame-file
     (save-excursion
@@ -408,8 +423,10 @@ See also function `git-blame-mode'."
                        (?H . ,hash)
                        (?a . ,(git-blame-get-info info 'author))
                        (?A . ,(git-blame-get-info info 'author-mail))
+                       (?t . ,(git-blame-format-time (git-blame-get-info info 'author-time)))
                        (?c . ,(git-blame-get-info info 'committer))
                        (?C . ,(git-blame-get-info info 'committer-mail))
+                       (?T . ,(git-blame-format-time (git-blame-get-info info 'committer-time)))
                        (?s . ,(git-blame-get-info info 'summary)))))
           (push ovl git-blame-overlays)
           (overlay-put ovl 'git-blame info)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] git-blame.el: Change the default prefix format
  2013-07-02 17:34 [PATCH 0/4] Emacs: git-blame.el fixes and enhancements Michal Sojka
                   ` (2 preceding siblings ...)
  2013-07-02 17:34 ` [PATCH 3/4] git-blame.el: Allow displaying author/commit times Michal Sojka
@ 2013-07-02 17:34 ` Michal Sojka
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Sojka @ 2013-07-02 17:34 UTC (permalink / raw)
  To: git
  Cc: David Kågedal, Lawrence Mitchell, Rüdiger Sonderfeld,
	Michal Sojka

Now, the format resembles more the default format of `git blame`.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 contrib/emacs/git-blame.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 5c8933e..74b1486 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -102,7 +102,7 @@
   :group 'git-blame)
 
 (defcustom git-blame-prefix-format
-  "%h %20A:"
+  "%h %t %a"
   "The format of the prefix added to each line in `git-blame'
 mode. The format is passed to `format-spec' with the following format keys:
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-02 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-02 17:34 [PATCH 0/4] Emacs: git-blame.el fixes and enhancements Michal Sojka
2013-07-02 17:34 ` [PATCH 1/4] git-blame.el: Fix buffer local declaration Michal Sojka
2013-07-02 17:34 ` [PATCH 2/4] git-blame.el: Make all line prefixes to have the same length Michal Sojka
2013-07-02 17:34 ` [PATCH 3/4] git-blame.el: Allow displaying author/commit times Michal Sojka
2013-07-02 17:34 ` [PATCH 4/4] git-blame.el: Change the default prefix format Michal Sojka

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).