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

From: Christoph Badura <[email-masked]>
Date: Mon, 27 Jan 2025 20:24:47 +0100

On Mon, Jan 27, 2025 at 02:21:39PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 27 Jan 2025 00:08:26 +0100
> > From: Christoph Badura <[email-masked]>
> > 
> > It would be nice if this would end up in emacs-30.1.
> 
> As Sean says, it's too late for that.  But we could perhaps consider
> it for backporting into Emacs 30.2, provided that it will cause no
> complaints while on master.

No worries.  I just thought it would be nice to have this show up in a
release soonich.  But I guess I will be dragging along my local
implementation of the hook for years in my init.el anyway until all the
emacsen installed by default on the machines I use will have caughtup.

> > I guess I need to add an entry to the NEWS file.
> Yes, because the user option changed.

How about:

  ---
  ** VC mode
  *** New function 'log-edit-done-strip-cvs-lines'.
  This function strips all lines beginning with "CVS:" from the buffer.
  It is intended to be added to the 'log-edit-done-hook' so that
  'vc-cvs-checkin' behaves like "cvs commit" from the command line.

Or perhaps:

  It is intended to be added to the 'log-edit-done-hook' so that checking
  in a commit under CVS behaves like "cvs commit" from the command line.

> > -(defcustom log-edit-done-hook nil
> > +(defcustom log-edit-done-hook '(log-edit-done-strip-cvs-lines)
> >    "Hook run before doing the actual commit.
> >  This hook can be used to cleanup the message, enforce various
> >  conventions, or to allow recording the message in some other database,
> >  such as a bug-tracking system.  The list of files about to be committed
> >  can be obtained from `log-edit-files'."
> > +  :version "30.1"
> 
> The :version should change to 31.1.

OK.  But as the default value now isn't going to change that's not needed
anymore.

> Also, I'm not sure we can turn this on by default, as I explained in
> the previous discussions.

OK.  That begs the question what the criteria for enabling this by
default are.  But let's discuss that separately.

> > +(defun log-edit-done-strip-cvs-lines ()
> > +  "Strip lines starting with \"CVS:\" from commit log message.
> > +When not interactively do this only when the VC backend is CVS."
> 
> Please add here a short description of the rationale for this
> functionality.  CVS being used as infrequently nowadays as it is, I'm
> fairly sure most people won't understand the purpose of this without
> some help.

How about:

  "Strip lines starting with \"CVS:\" from commit log message.
  When not interactively do this only when the VC backend is CVS.
  This mimicks what CVS does when invoked 'cvs commit [files...]'"

> Last, but not least: you don't seem to have a copyright assignment on
> file, without which we cannot accept a contribution of this size.

I've already started the paperwork.  I've turned in the signed assignement
on Jan 6th but haven't heard back yet.  I did reply to the ticket
yesterday so see what is up.

--chris