GNU bug report logs - #77465
29.4; VC annotate does not display tabs properly

Previous Next

Package: emacs;

Reported by: Tom Tromey <tromey <at> adacore.com>

Date: Wed, 2 Apr 2025 16:32:01 UTC

Severity: normal

Found in version 29.4

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tom Tromey <tromey <at> adacore.com>
Cc: 77465 <at> debbugs.gnu.org
Subject: bug#77465: 29.4; VC annotate does not display tabs properly
Date: Thu, 03 Apr 2025 10:47:17 +0300
> Date: Wed, 02 Apr 2025 10:30:57 -0600
> From:  Tom Tromey via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> Some projects I work on use tab characters for indentation.

Emacs uses TABs mixed with SPCes as a matter of policy.

> I used 'C-x v =' to annotate a file from one of these projects.
> 
> In this case, because the VC-provided margin text is not a multiple of 8
> characters, the tabs are rendered improperly, making the program text
> look strange.
> 
> As an example, open emacs/src/alloc.c and C-x v =
> 
> Then search for the tab character in code (with comments the weirdness
> isn't as pronounced).
> 
> Here's an example from emacs where I've turned the tabs into spaces so
> you can see the effect:
> 
> b88e9cded7ae (Paul Eggert             2016-01-26  226)   else
> b88e9cded7ae (Paul Eggert             2016-01-26  227)     {
> b88e9cded7ae (Paul Eggert             2016-01-26  228)       if (!malloc_using_checking)
> b88e9cded7ae (Paul Eggert             2016-01-26  229)  {
> b88e9cded7ae (Paul Eggert             2016-01-26  230)    /* Work around a bug in glibc's malloc.  MALLOC_CHECK_ must be

AFAICT, "git annotate" produces the same effect when invoked from the
shell prompt.  I'm not sure we should try to be "holier than the Pope"
here.

> One simple fix would be to ensure that the margin text is always a
> multiple of 8.

I don't think this is practical, since Git doesn't guarantee the
prefix of a line to be of a fixed width.  Here's a typical example:

47099d6f7       (Richard M. Stallman    1993-06-06 21:16:51 +0000       27)
4588ec205       (Jim Blandy     1991-07-03 12:10:07 +0000       28)
a08795204       (Richard M. Stallman    1995-11-12 05:20:12 +0000       29)
fd2e066a8       (Geoff Voelker  1995-11-07 07:14:59 +0000       30)
fd2e066a8       (Geoff Voelker  1995-11-07 07:14:59 +0000       31)
e5560ff7d       (Andreas Schwab 2012-06-16 14:24:15 +0200       32)
d43721a22       (Andrew Innes   2000-08-22 22:14:00 +0000       33)
502b9b644       (Jim Blandy     1992-07-13 19:54:34 +0000       34)
428a555ec       (Károly Lőrentey        2004-01-05 05:54:35 +0000       35)
4588ec205       (Jim Blandy     1991-07-03 12:10:07 +0000       36)
4588ec205       (Jim Blandy     1991-07-03 12:10:07 +0000       37)
4588ec205       (Jim Blandy     1991-07-03 12:10:07 +0000       38)
97cf50e75       (Richard M. Stallman    1996-04-23 20:32:58 +0000       39)
58b2bb63f       (Richard M. Stallman    1995-08-21 21:56:40 +0000       40)

> However, a more sophisticated approach may be possible as well.

The only idea I have is to replace each tab with a suitable number of
spaces, but that would probably make this command much slower, since
the buffer created by "C-x v =" is typically very large.

Any other ideas?




This bug report was last modified 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.