Subject: bug#72341: VC: CVS template lines not stripped when committing

From: Christoph Badura <[email-masked]>
Date: Sun, 28 Jul 2024 14:32:57 +0200

CVS strips all lines beginning with "CVS: " after editing the commit
message.  This is not done when using VC.

Specifically log-edit-hook's default includes log-edit-insert-cvs-template
causing the CVS/Template file to be inserted.  However, the lines starting
with "CVS: " aren't stripped out when log-edit-done is called.  The change
is then committed with "cvs ci -m" which does not strip these line, as the
template file is only loaded when cvs invokes an editor to edit the commit
message.

This behaviour is very annoying when working in a project that makes use of
CVS templates (e.g. NetBSD).  It would be nice, if VC behaved by default
like CVS does.

I guess on could work around this be defining a log-editdone-hook like
this:

(defun my/log-edit-done-strip-cvs-lines ()
  "Strip lines beginning with \"CVS: \" from commit log message."
  (let ((search-upper-case nil))
    (goto-char (point-min))
    (flush-lines "^CVS: ")))

Not sure that's right, though.

I've looked at the latest version of log-mode.el in emacs git and the
behaviour doesn't seem to have changed.

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo
version 1.16.0)
 of 2024-06-25, modified by Debian built on x86-conova-01 Windowing system
distributor 'The X.Org Foundation', version 11.0.12101006 System
Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec localstatedir=/var/lib
 ----infodir=/usr/share/info mandir=/usr/share/man --with-libsystemd
 ----with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils with-native-compilation
 ----build x86_64-linux-gnu --prefix=/usr sharedstatedir=/var/lib
 ----libexecdir=/usr/libexec localstatedir=/var/lib
 ----infodir=/usr/share/info mandir=/usr/share/man --with-libsystemd
 ----with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils with-native-compilation
 ----with-cairo --with-x=yes with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 --'CFLAGS=-g -O2
 -ffile-prefix-map=/build/reproducible-path/emacs-28.2+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM
GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2
M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_CTYPE: C.utf8 value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  paredit-mode: t global-company-mode: t company-mode: t persp-mode: t
  editorconfig-mode: t direnv-mode: t savehist-mode: t save-place-mode: t
  ido-everywhere: t override-global-mode: t tooltip-mode: t
  global-eldoc-mode: t 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 blink-cursor-mode: t
  auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t
  line-number-mode: t indent-tabs-mode: t transient-mark-mode: t

Load-path shadows: /usr/share/emacs/site-lisp/elpa/htmlize-1.56/htmlize-pkg
hides /usr/share/emacs/site-lisp/elpa-src/htmlize-1.56/htmlize-pkg
/usr/share/emacs/site-lisp/elpa/htmlize-1.56/htmlize-autoloads hides
/usr/share/emacs/site-lisp/elpa-src/htmlize-1.56/htmlize-autoloads
/usr/share/emacs/site-lisp/elpa/htmlize-1.56/htmlize hides
/usr/share/emacs/site-lisp/elpa-src/htmlize-1.56/htmlize
/home/bad/.emacs.d/elpa/transient-20240311.1638/transient hides
/usr/share/emacs/28.2/lisp/transient /home/bad/.emacs.d/elpa/seq-2.24/seq
hides /usr/share/emacs/28.2/lisp/emacs-lisp/seq

Features: (shadow sort mail-extr emacsbug message rmc puny rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
macrostep-c cmacexp macrostep NetBSD cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs dired-aux dired
dired-loaddefs vc-git paredit cus-start company-oddmuse company-keywords
company-etags etags fileloop generator xref company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template company-bbdb
company server dim init-tex init-markdown persp-mode finder-inf init-python
init-scheme init-erc erc-goodies erc erc-backend iso8601 time-date thingatpt
erc-loaddefs init-jabber init-circe init-yaml init-jsonnet init-json
init-golang reformatter project comp comp-cstr warnings editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch rg files-x
vc vc-dispatcher rg-info-hack rg-menu transient seq seq-25 loadhist
format-spec compat compat-29 rg-ibuffer rg-result wgrep-rg wgrep rg-history
rg-header ibuf-ext ibuffer ibuffer-loaddefs grep compile
text-property-search comint ansi-color ring cus-edit pp wid-edit
init-flyspell advice direnv diff-mode dash better-defaults savehist
saveplace ido init-company diminish cl-extra help-mode use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core desktop frameset
cus-load tex-site rx edmacro kmacro pcase slime-autoloads info package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x
map url-vars byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-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 cl-generic 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 simple abbrev obarray cl-preloaded
nadvice button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo move-toolbar
gtk x-toolkit x multi-tty make-network-process native-compile emacs)

Memory information: ((conses 16 555286 88165)
 (symbols 48 28058 4) (strings 32 169614 14216) (string-bytes 1 4737597)
 (vectors 16 48599) (vector-slots 8 844310 114128) (floats 8 120 281)
 (intervals 56 726 187) (buffers 992 16))