Subject: bug#77197: 31.0.50; forward-word fails after yanking into summary line of *vc-log*

From: "Paul D. Nelson" <[email-masked]>
Date: Sun, 23 Mar 2025 16:08:20 +0100

The issue seems to concern the function

(defun log-edit--make-header-line (header &optional value)
  ;; Make \\`C-a' work like it does in other buffers with header names.
  (concat (propertize (concat header ": ")
                      'field 'header
                      'rear-nonsticky t)
          value
          "\n"))

The relevant commit 2f3cf7ffe3c9ce986caf6d093b880fed6046b7ec reads:

    * lisp/vc/log-edit.el (log-edit-insert-message-template): Fieldify
    headers so that `C-a' takes us to the start of the string, not the
    line (bug#15645).

I took "start of the string" to mean before "text" in "Summary: text".

It's possible that I have misunderstood and that the intent was actually
to make the full header line "Subject: text" a field, with the field
boundary serving to divide the header of the email from the body, but
this seems contrary to my reading of the commit message.

Assuming that I haven't misunderstood:

If I do C-x v v and type "text", then the field boundary comes after
"text" rather than after "Summary: ".  This seems at odds with the
advertised behavior, which suggested that it should introduce a field
boundary after "Summary :".

In more detail, after C-x v v:

1. With point after "Summary: ", the text properties at point (C-u C-x =)
do not contain the header field.

2. With point after "Summary:", the properties contain the header field.

3. If I type a character after "Summary: " and do backward-char, then
the properties at point contain the header field.

This behavior seem contrary to what is expected with rear-nonsticky:

  Insertion after a character inherits those of its properties that are
  “rear-sticky”.

So as far as I can tell, rear-nonsticky text properties are being
propagated when they shouldn't, resulting in the full header line being
a single field (which then gets broken up when we yank).