git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "David Kågedal" <davidk@lysator.liu.se>
Cc: "Jakub Narebski" <jnareb@gmail.com>,
	"Alexandre Julliard" <julliard@winehq.org>,
	git@vger.kernel.org, "Kevin Ryde" <user42@zip.com.au>,
	"Sergei Organov" <osv@javad.com>,
	"Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
Subject: [PATCH/RFC] git-blame.el: truncate author to avoid jagged left edge of code
Date: Sun, 10 Jun 2012 03:24:37 -0500	[thread overview]
Message-ID: <20120610082437.GA29674@burratino> (raw)
In-Reply-To: <20110211022928.GA24775@elie>

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

	822a7d <ramsay@ramsay1.demon.co.uk>:const char git_usage_
	f2dd8c <jon.seymour@gmail.com>: "git [--version] [--exec-
	a1bea2 <josh@joshtriplett.org>: "           [-p|--paginat
	a1bea2 <josh@joshtriplett.org>: "           [--git-dir=<p
	293b07 <trast@student.ethz.ch>: "           [-c name=valu
	62b469 <stepan.nemec@gmail.com>:        "           <comm
	822a7d <ramsay@ramsay1.demon.co.uk>:

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@gmail.com>: "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@zip.com.au>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
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

  parent reply	other threads:[~2012-06-10  8:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 16:21 git-blame.el: what is format-spec? Sergei Organov
2009-12-04 16:38 ` Andreas Schwab
2009-12-04 16:59   ` Sergei Organov
2009-12-04 17:36     ` David Kågedal
2009-12-04 20:54       ` Sergei Organov
2009-12-06 18:43         ` David Kågedal
2009-12-07  8:36           ` Sergei Organov
2009-12-07  9:05             ` David Kågedal
2010-05-14 13:13           ` Alex Unleashed
2010-05-25 13:44             ` [PATCH] git-blame.el: Add (require 'format-spec) David Kågedal
2010-10-29  3:38               ` [PATCH resend] " Jonathan Nieder
2011-02-04  1:43           ` git-blame.el: does not show one-line summary in echo area Jonathan Nieder
2011-02-04  9:53             ` David Kågedal
2011-02-04 10:03               ` Jakub Narebski
2011-02-04 10:15                 ` David Kågedal
2011-02-04 12:26                   ` David Kågedal
2011-02-11  2:29                     ` Jonathan Nieder
2011-02-11  6:42                       ` git-blame.el: format of date strings Jonathan Nieder
2011-02-11  7:56                         ` Martin Nordholts
2012-06-10  8:24                       ` Jonathan Nieder [this message]
2013-01-29 20:17                         ` [PATCH/RFC] git-blame.el: truncate author to avoid jagged left edge of code David Kågedal
2011-02-04 21:49                   ` git-blame.el: does not show one-line summary in echo area Kevin Ryde
2009-12-04 17:42     ` git-blame.el: what is format-spec? Andreas Schwab
2009-12-04 18:18       ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120610082437.GA29674@burratino \
    --to=jrnieder@gmail.com \
    --cc=davidk@lysator.liu.se \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=julliard@winehq.org \
    --cc=osv@javad.com \
    --cc=ruediger@c-plusplus.de \
    --cc=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).