unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72341: VC: CVS template lines not stripped when committing
@ 2024-07-28 12:32 Christoph Badura
  2024-07-28 17:49 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Badura @ 2024-07-28 12:32 UTC (permalink / raw)
  To: 72341

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-28 12:32 bug#72341: VC: CVS template lines not stripped when committing Christoph Badura
@ 2024-07-28 17:49 ` Eli Zaretskii
  2024-07-28 19:48   ` Christoph Badura
       [not found]   ` <20240728192115.GY9440@irregular-apocalypse.k.bsd.de>
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2024-07-28 17:49 UTC (permalink / raw)
  To: Christoph Badura; +Cc: 72341

> Date: Sun, 28 Jul 2024 14:32:57 +0200
> From: Christoph Badura <bad@bsd.de>
> 
> 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'm confused by your description.  At the beginning you say:

  CVS strips all lines beginning with "CVS: " after editing the commit
  message.

But later you say:

  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.

If "cvs ci -m" doesn't strip the "CVS: " lines, then when and how does
the stripping you describe at the beginning happens?  And what does
the last part of the last sentence above, about the template file
being loaded when CVS invokes an editor, has to do with this issue?

Thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-28 17:49 ` Eli Zaretskii
@ 2024-07-28 19:48   ` Christoph Badura
       [not found]   ` <20240728192115.GY9440@irregular-apocalypse.k.bsd.de>
  1 sibling, 0 replies; 10+ messages in thread
From: Christoph Badura @ 2024-07-28 19:48 UTC (permalink / raw)
  To: 72341

Resending the message, because debbugs.gnu.org wasn't cc'ed on the
original reply.

On Sun, Jul 28, 2024 at 08:49:15PM +0300, Eli Zaretskii wrote:
> I'm confused by your description.  At the beginning you say:
> 
>   CVS strips all lines beginning with "CVS: " after editing the commit
>   message.
> 
> But later you say:
> 
>   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.

CVS only adds the template file and later strips the "CVS: " lines if
you actually edit the commit message in an editor (which is invoked by
cvs).  I.e. if you do not pass a commit message via "cvs ci -m'message'"
or "cvs ci -F messagefile".

> If "cvs ci -m" doesn't strip the "CVS: " lines, then when and how does
> the stripping you describe at the beginning happens?  And what does
> the last part of the last sentence above, about the template file
> being loaded when CVS invokes an editor, has to do with this issue?

When invoked as "cvs ci -m" (or "cvs ci -F") cvs uses the commit message
*as is*.  With either option, cvs itself doesn't add the template file to
the commit message and hence doesn't have to do any stripping.

log-edit-insert-cvs-template adds the CVS template file to the commit
message outside of cvs.  Therefore log-edit has to strip the "CVS: " lines
outside of cvs too.

Is that clearer?

--chris

--chris






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
       [not found]   ` <20240728192115.GY9440@irregular-apocalypse.k.bsd.de>
@ 2024-07-29  2:26     ` Eli Zaretskii
  2024-07-29  9:53       ` Christoph Badura
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-07-29  2:26 UTC (permalink / raw)
  To: Christoph Badura; +Cc: 72341

> Date: Sun, 28 Jul 2024 21:21:15 +0200
> From: Christoph Badura <bad@bsd.de>
> 
> CVS only adds the template file and later strips the "CVS: " lines if
> you actually edit the commit message in an editor (which is invoked by
> cvs).  I.e. if you do not pass a commit message via "cvs ci -m'message'"
> or "cvs ci -F messagefile".
> 
> > If "cvs ci -m" doesn't strip the "CVS: " lines, then when and how does
> > the stripping you describe at the beginning happens?  And what does
> > the last part of the last sentence above, about the template file
> > being loaded when CVS invokes an editor, has to do with this issue?
> 
> When invoked as "cvs ci -m" (or "cvs ci -F") cvs uses the commit message
> *as is*.  With either option, cvs itself doesn't add the template file to
> the commit message and hence doesn't have to do any stripping.
> 
> log-edit-insert-cvs-template adds the CVS template file to the commit
> message outside of cvs.  Therefore log-edit has to strip the "CVS: " lines
> outside of cvs too.
> 
> Is that clearer?

Somewhat clearer, thanks.  I don't see this stripping feature
documented in the CVS manual; did I miss something?

And one more questions: where do those "CVS:" lines come from when you
use the template file?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-29  2:26     ` Eli Zaretskii
@ 2024-07-29  9:53       ` Christoph Badura
  2024-07-29 12:34         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Badura @ 2024-07-29  9:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72341

On Mon, Jul 29, 2024 at 05:26:50AM +0300, Eli Zaretskii wrote:
> Somewhat clearer, thanks.  I don't see this stripping feature
> documented in the CVS manual; did I miss something?

I didn't see it documented either.  The closest thing that comes to
documentation of that feature is the documentation for rcsinfo:
https://www.gnu.org/software/trans-coord/manual/cvs/html_node/rcsinfo.html#rcsinfo

It is implemented in src/logmsg.c:do_editor().

> And one more questions: where do those "CVS:" lines come from when you
> use the template file?

They have to be be in the template file.

I figure the idea is that the template files can contain "mandatory" text
that will be part of the actuall log message and "explanatory" text,
prefixed with "CVS: ", that will be stripped after the commit message has
been edited.

As an example, here's the default template for the NetBSD repositories:
----------------8<------------------8<------------------8<-----------------
CVS: ----------------------------------------------------------------------
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
----------------8<------------------8<------------------8<-----------------

I'm only aware of the NetBSD and pkgsrc repositories that make use of CVS
templates.  And their template files contain only lines prefixed with
"CVS: ".

Off topic and speaking of documentation.
I noticed that
https://www.gnu.org/software/emacs/manual/html_node/emacs/Log-Buffer.html
doesn't document C-c C-k and doesn't explain how the region is set up so
that an initial C-w will kill from point to the end of the buffer.  log-edit's
documentation is also not correct with regard to this (i.e. the entire log
buffer isn't emptied as point is after the Summary: header).

Is that worth reporting separately?

--chris





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-29  9:53       ` Christoph Badura
@ 2024-07-29 12:34         ` Eli Zaretskii
  2024-07-29 15:02           ` Christoph Badura
  2024-07-30 13:35           ` Dmitry Gutov
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2024-07-29 12:34 UTC (permalink / raw)
  To: Christoph Badura, Dmitry Gutov; +Cc: 72341

> Date: Mon, 29 Jul 2024 11:53:13 +0200
> From: Christoph Badura <bad@bsd.de>
> Cc: 72341@debbugs.gnu.org
> 
> On Mon, Jul 29, 2024 at 05:26:50AM +0300, Eli Zaretskii wrote:
> > Somewhat clearer, thanks.  I don't see this stripping feature
> > documented in the CVS manual; did I miss something?
> 
> I didn't see it documented either.  The closest thing that comes to
> documentation of that feature is the documentation for rcsinfo:
> https://www.gnu.org/software/trans-coord/manual/cvs/html_node/rcsinfo.html#rcsinfo

This says nothing about the "CVS: " prefix, AFAICT.

> It is implemented in src/logmsg.c:do_editor().
> 
> > And one more questions: where do those "CVS:" lines come from when you
> > use the template file?
> 
> They have to be be in the template file.
> 
> I figure the idea is that the template files can contain "mandatory" text
> that will be part of the actuall log message and "explanatory" text,
> prefixed with "CVS: ", that will be stripped after the commit message has
> been edited.
> 
> As an example, here's the default template for the NetBSD repositories:
> ----------------8<------------------8<------------------8<-----------------
> CVS: ----------------------------------------------------------------------
> CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
> CVS: please use "PR category/123" to have the commitmsg appended to PR 123
> ----------------8<------------------8<------------------8<-----------------
> 
> I'm only aware of the NetBSD and pkgsrc repositories that make use of CVS
> templates.  And their template files contain only lines prefixed with
> "CVS: ".

I think I see what's happening.  This is basically an undocumented
feature.  The removal of "CVS: " lines is there for when CVS itself
invokes the editor: in that case, it injects instructions into the
temporary file that it submits to the editor, and those instructions
all start with "CVS: ", so that they could be later removed.  IOW,
this prefix is basically an agreement between CVS and itself.

Now, nothing in the documentation of CVS/Template file says anything
about "CVS: ", but the code processes the temporary file, which
includes the template, the same as it processes the lines injected by
CVS, and thus every line that begins with "CVS: " in the template will
be removed.

IOW, NetBSD piggy-backs this feature to include their own instructions
in the template.

I'm unsure how to proceed with this.  My bother is that this is a
definite change in behavior wrt what VC did until now.  Users of VC
might be unaware of this removal, and could start some log lines with
the prefix, which will mysteriously disappear from the log message.

Dmitry, WDYT?  Maybe we should add this removal guarded by a user
option, by default off?  Or maybe we can identify where the template
starts and ends, and only remove in that region?

> Off topic and speaking of documentation.
> I noticed that
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Log-Buffer.html
> doesn't document C-c C-k and doesn't explain how the region is set up so
> that an initial C-w will kill from point to the end of the buffer.  log-edit's
> documentation is also not correct with regard to this (i.e. the entire log
> buffer isn't emptied as point is after the Summary: header).
> 
> Is that worth reporting separately?

Yes, probably.  IMO, documenting "C-c C-k" should be accompanied with
the description of log-edit-comment-ring and its usage, otherwise the
command will not make sense to the users.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-29 12:34         ` Eli Zaretskii
@ 2024-07-29 15:02           ` Christoph Badura
  2024-07-30 13:35           ` Dmitry Gutov
  1 sibling, 0 replies; 10+ messages in thread
From: Christoph Badura @ 2024-07-29 15:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Gutov, 72341

On Mon, Jul 29, 2024 at 03:34:32PM +0300, Eli Zaretskii wrote:
> > Date: Mon, 29 Jul 2024 11:53:13 +0200
> > From: Christoph Badura <bad@bsd.de>
> > Cc: 72341@debbugs.gnu.org
> > 
> > On Mon, Jul 29, 2024 at 05:26:50AM +0300, Eli Zaretskii wrote:
> > > Somewhat clearer, thanks.  I don't see this stripping feature
> > > documented in the CVS manual; did I miss something?
> > 
> > I didn't see it documented either.  The closest thing that comes to
> > documentation of that feature is the documentation for rcsinfo:
> > https://www.gnu.org/software/trans-coord/manual/cvs/html_node/rcsinfo.html#rcsinfo
> 
> This says nothing about the "CVS: " prefix, AFAICT.
> 
> > It is implemented in src/logmsg.c:do_editor().
> > 
> > > And one more questions: where do those "CVS:" lines come from when you
> > > use the template file?
> > 
> > They have to be be in the template file.
> > 
> > I figure the idea is that the template files can contain "mandatory" text
> > that will be part of the actuall log message and "explanatory" text,
> > prefixed with "CVS: ", that will be stripped after the commit message has
> > been edited.
> > 
> > As an example, here's the default template for the NetBSD repositories:
> > ----------------8<------------------8<------------------8<-----------------
> > CVS: ----------------------------------------------------------------------
> > CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
> > CVS: please use "PR category/123" to have the commitmsg appended to PR 123
> > ----------------8<------------------8<------------------8<-----------------
> > 
> > I'm only aware of the NetBSD and pkgsrc repositories that make use of CVS
> > templates.  And their template files contain only lines prefixed with
> > "CVS: ".
> 
> I think I see what's happening.  This is basically an undocumented
> feature.  The removal of "CVS: " lines is there for when CVS itself
> invokes the editor: in that case, it injects instructions into the
> temporary file that it submits to the editor, and those instructions
> all start with "CVS: ", so that they could be later removed.  IOW,
> this prefix is basically an agreement between CVS and itself.
> 
> Now, nothing in the documentation of CVS/Template file says anything
> about "CVS: ", but the code processes the temporary file, which
> includes the template, the same as it processes the lines injected by
> CVS, and thus every line that begins with "CVS: " in the template will
> be removed.
> 
> IOW, NetBSD piggy-backs this feature to include their own instructions
> in the template.

That pretty much sums it up.

However, while this behaviour isn't mentioned in the documentation, it is
mentioned in every commit message file that cvs creates when it invokes an
editor.  E.g.:

CVS: ----------------------------------------------------------------------
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS: 
CVS: Committing in .
CVS: 
CVS: Modified Files:
CVS: 	test.txt 
CVS: ----------------------------------------------------------------------

I have to admit, that after 30+ years of using cvs outside of emacs, my
brain filters out that bit of the commit message.  Anyway, it's clearly
advertised even if it isn't documented in the manual.

Note though, that when cvs invokes an editor itself to enter the commit
message, it is impossible to disable this behaviour.  That is, lines
starting with "CVS: " are always removed.

> I'm unsure how to proceed with this.  My bother is that this is a
> definite change in behavior wrt what VC did until now.  Users of VC
> might be unaware of this removal, and could start some log lines with
> the prefix, which will mysteriously disappear from the log message.

I've thought about that.  Clearly it is a change in behaviour.  The
interesting question is, will users notice?

My experience with this is that when I took up using emacs again after a
very long hiatus this behaviour of VC tripped me up on my first commit.
That was very annyoing indeed.  A friend suggested to M-x erase-buffer on
every commit.  Obviously he wasn't aware of that C-w would have the
desired effect.  Neither did I.  And that is not documented in the manual.

This was enough of a bother to not use VC again until this weekend and
then dig into why that is happending and not when I use "cvs ci file"
outside emacs (and have it invoke emacsclient).

If you work in an environment where other uses are using cvs outside of
emacs VC, the only way to have lines starting with "CVS: " in the stored
commit message is to require that the other users use "cvs ci -m" or
prepare a commit message separately in a file and use "cvs ci -F".
Frankly, a policy that requires stored commit messages containing lines
starting with "CVS: " is not practical.

Would VC users notice the change in behaviour?  I'd say they are
already using erase-buffer or C-w to clear the cvs template lines.  Or
they dug into the code and created a log-edit-done-hook similar to what
I proposed.  And they can continue to do so with no change to observed
behaviour.

And how many users that would be affected are there anyway?  I think it is
likely that there are very few or you would have got complaints in the
last decades.

Anyway, IMHO it is fine to add such a hook function by default to
log-edit-done-hook.  People could customize it away if it really
interferes with their work.

It's also not a big deal to fix up the commit messages with "cvs admin".
I'd imagine people would notice quickly.

--chris





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-29 12:34         ` Eli Zaretskii
  2024-07-29 15:02           ` Christoph Badura
@ 2024-07-30 13:35           ` Dmitry Gutov
  2024-08-02  7:19             ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry Gutov @ 2024-07-30 13:35 UTC (permalink / raw)
  To: Eli Zaretskii, Christoph Badura; +Cc: 72341

On 29/07/2024 15:34, Eli Zaretskii wrote:
> I'm unsure how to proceed with this.  My bother is that this is a
> definite change in behavior wrt what VC did until now.  Users of VC
> might be unaware of this removal, and could start some log lines with
> the prefix, which will mysteriously disappear from the log message.
> 
> Dmitry, WDYT?  Maybe we should add this removal guarded by a user
> option, by default off?  Or maybe we can identify where the template
> starts and ends, and only remove in that region?

If we do this, we'd only remove the lines starting with "CVS:". We could 
also add special syntax highlighting for them. That would probably be 
enough.

Then vc-cvs-checkin would additionally process the commit message string 
returned by log-edit-extract-headers.

Note that it seems we only handle "templates" for CVS and RCS, so there 
is no prior art for implementing this feature.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-07-30 13:35           ` Dmitry Gutov
@ 2024-08-02  7:19             ` Eli Zaretskii
  2024-08-09 15:11               ` Christoph Badura
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-08-02  7:19 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: bad, 72341

> Date: Tue, 30 Jul 2024 16:35:29 +0300
> Cc: 72341@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 29/07/2024 15:34, Eli Zaretskii wrote:
> > I'm unsure how to proceed with this.  My bother is that this is a
> > definite change in behavior wrt what VC did until now.  Users of VC
> > might be unaware of this removal, and could start some log lines with
> > the prefix, which will mysteriously disappear from the log message.
> > 
> > Dmitry, WDYT?  Maybe we should add this removal guarded by a user
> > option, by default off?  Or maybe we can identify where the template
> > starts and ends, and only remove in that region?
> 
> If we do this, we'd only remove the lines starting with "CVS:". We could 
> also add special syntax highlighting for them. That would probably be 
> enough.

Agreed.

> Then vc-cvs-checkin would additionally process the commit message string 
> returned by log-edit-extract-headers.
> 
> Note that it seems we only handle "templates" for CVS and RCS, so there 
> is no prior art for implementing this feature.

Right.  Patches welcome to implement this.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#72341: VC: CVS template lines not stripped when committing
  2024-08-02  7:19             ` Eli Zaretskii
@ 2024-08-09 15:11               ` Christoph Badura
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Badura @ 2024-08-09 15:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Gutov, 72341

Sorry for the delay.

On Fri, Aug 02, 2024 at 10:19:30AM +0300, Eli Zaretskii wrote:
> > Date: Tue, 30 Jul 2024 16:35:29 +0300
> > Cc: 72341@debbugs.gnu.org
> > From: Dmitry Gutov <dmitry@gutov.dev>
> > 
> > On 29/07/2024 15:34, Eli Zaretskii wrote:
> > > I'm unsure how to proceed with this.  My bother is that this is a
> > > definite change in behavior wrt what VC did until now.  Users of VC
> > > might be unaware of this removal, and could start some log lines with
> > > the prefix, which will mysteriously disappear from the log message.
> > > 
> > > Dmitry, WDYT?  Maybe we should add this removal guarded by a user
> > > option, by default off?  Or maybe we can identify where the template
> > > starts and ends, and only remove in that region?
> > 
> > If we do this, we'd only remove the lines starting with "CVS:". We could 
> > also add special syntax highlighting for them. That would probably be 
> > enough.
> Agreed.

I'm afraid my emacs-fu isn't strong enough for that.

> > Then vc-cvs-checkin would additionally process the commit message string 
> > returned by log-edit-extract-headers.
> > 
> > Note that it seems we only handle "templates" for CVS and RCS, so there 
> > is no prior art for implementing this feature.
> 
> Right.  Patches welcome to implement this.

Cool.  I'll get back to this.  But probably not this month.  I'm extremly
busy right now.

--chris





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-08-09 15:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-28 12:32 bug#72341: VC: CVS template lines not stripped when committing Christoph Badura
2024-07-28 17:49 ` Eli Zaretskii
2024-07-28 19:48   ` Christoph Badura
     [not found]   ` <20240728192115.GY9440@irregular-apocalypse.k.bsd.de>
2024-07-29  2:26     ` Eli Zaretskii
2024-07-29  9:53       ` Christoph Badura
2024-07-29 12:34         ` Eli Zaretskii
2024-07-29 15:02           ` Christoph Badura
2024-07-30 13:35           ` Dmitry Gutov
2024-08-02  7:19             ` Eli Zaretskii
2024-08-09 15:11               ` Christoph Badura

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).