[PATCH/RFC] git-blame.el: truncate author to avoid jagged left edge of code

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

 



Without this patch, the author column in git-blame-mode spills
over in some rows:

	822a7d <ramsay@xxxxxxxxxxxxxxxxxxx>:const char git_usage_
	f2dd8c <jon.seymour@xxxxxxxxx>: "git [--version] [--exec-
	a1bea2 <josh@xxxxxxxxxxxxxxxx>: "           [-p|--paginat
	a1bea2 <josh@xxxxxxxxxxxxxxxx>: "           [--git-dir=<p
	293b07 <trast@xxxxxxxxxxxxxxx>: "           [-c name=valu
	62b469 <stepan.nemec@xxxxxxxxx>:        "           <comm
	822a7d <ramsay@xxxxxxxxxxxxxxxxxxx>:

As a result, code meant to line up does not line up correctly and the
colored code area has a jagged left edge.

Specify a maximum width for the autohr email address in the default
blame prefix (i.e., use %20.20A instead of %20A) to fix it.

	822a7d <ramsay@ramsay1.demon.c:const char git_usage_strin
	f2dd8c <jon.seymour@xxxxxxxxx>: "git [--version] [--exec-

The (format) function used to implement format-spec has supported
precision specifiers like ".20" in emacs since 2002-12-09, so this
should be safe.

Helped-by: Kevin Ryde <user42@xxxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
In February of 2011, I wrote:

>  - email addresses are often longer than 20 characters.  Does
>    format-spec provide a way to truncate to a certain length,
>    so the prefixes can line up?

Better late than never, I guess.  Sensible?

 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 d351cfb6..137d5ba9 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 %20.20A:"
   "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.7.10

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