Subject: 29.4; VC annotate does not display tabs properly

From: Tom Tromey <[email-masked]>
Date: Wed, 02 Apr 2025 10:30:57 -0600

Some projects I work on use tab characters for indentation.
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

One simple fix would be to ensure that the margin text is always a
multiple of 8.  However, a more sophisticated approach may be possible
as well.

In GNU Emacs 29.4 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2025-03-13 built on
 0cbb79ebeb714371b64bef3269323882
System Description: Fedora Linux 41 (Workstation Edition)

Configured using:
 'configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-cairo --with-dbus --with-gif
 --with-gpm=no --with-harfbuzz --with-jpeg --with-json --with-modules
 --with-native-compilation=aot --with-pgtk --with-png --with-rsvg
 --with-sqlite3 --with-tiff --with-tree-sitter --with-webp --with-xpm
 build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu
 CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects
 -fexceptions -g -grecord-gcc-switches -pipe -Wall
 -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64
 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
 -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed
 -Wl,-z,pack-relative-relocs -Wl,-z,now
 -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1
 -specs=/usr/lib/rpm/redhat/redhat-package-notes '
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig CXX=g++
 'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g
 -grecord-gcc-switches -pipe -Wall -Werror=format-security
 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64
 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
 -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer ''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Annotate

Minor modes in effect:
  shell-dirtrack-mode: t
  which-function-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  server-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/tromey/.emacs.d/elpa/ggtags-0.9.0/ggtags hides /home/tromey/.emacs.d/elpa/ggtags-0.8.13/ggtags
/home/tromey/.emacs.d/elpa/ggtags-0.9.0/ggtags-pkg hides /home/tromey/.emacs.d/elpa/ggtags-0.8.13/ggtags-pkg
/home/tromey/.emacs.d/elpa/ggtags-0.9.0/ggtags-autoloads hides /home/tromey/.emacs.d/elpa/ggtags-0.8.13/ggtags-autoloads

Features:
(shadow bbdb-message mailalias mail-hist emacsbug sh-script smie
executable dabbrev goto-addr log-edit python ada-ts-mode-lspclient-eglot
ada-ts-mode ada-ts-indentation ada-ts-casing eglot external-completion
array jsonrpc ert debug backtrace flymake-proc flymake
ada-ts-mode-lspclient treesit ada-ts-mode-autoloads noutline outline
ggtags-autoloads loaddefs-gen tar-mode arc-mode archive-mode cus-edit
cus-start package-vc lisp-mnt url-http url-auth url-gw
display-line-numbers gud vc-annotate copyright vc-hg vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs log-view pcvs-util conf-mode term/xterm
xterm mule-util ggtags hippie-exp etags fileloop generator xref project
bug-reference vc-git cc-mode cc-fonts cc-guess cc-menus cc-cmds add-log
flow-fill smerge-mode diff diff-mode gnus-html url-queue help-fns
radix-tree url-cache mm-url sort smiley gnus-cite mm-archive mail-extr
textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check gnus-bcklg gnus-async qp gnus-ml disp-table misearch
multi-isearch gnus-topic nndraft nnmh nnfolder utf-7 bbdb-gnus bbdb-mua
bbdb-com crm network-stream nsm gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig nntp gnus-cache gnus-sum shr pixel-fill kinsoku
url-file svg dom gnus-group gnus-undo smtpmail gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util mail-utils range mm-util mail-prsvr
display-fill-column-indicator flyspell ispell diminish appt diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete
parse-time which-func imenu autorevert filenotify desktop frameset
cus-load git-link erc-track erc-notify erc-desktop-notifications
erc-match erc-services notifications dbus erc-hl-nicks color erc-button
erc-fill erc-stamp wid-edit erc-goodies erc iso8601 time-date thingatpt
pp format-spec erc-backend erc-networks erc-common erc-compat compat
erc-loaddefs dired-aux dired-x dired dired-loaddefs comp comp-cstr
cl-extra warnings icons advice vc-dir ewoc vc vc-dispatcher flycheck
easy-mmode find-func help-mode rx dash cl pcase jka-compr compile
text-property-search cc-styles cc-align cc-engine cc-vars cc-defs bbdb
derived bbdb-site timezone ange-ftp comint ansi-osc ansi-color ring
server savehist finder-inf clang-rename clang-include-fixer let-alist
clang-format xml info package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1300064 422488)
 (symbols 48 57113 1)
 (strings 32 496408 8613)
 (string-bytes 1 13434307)
 (vectors 16 168369)
 (vector-slots 8 3590796 73717)
 (floats 8 506 768)
 (intervals 56 34255 18946)
 (buffers 984 93))