Subject: Re: bug#72420: set-goal-column misbehaves with a line-prefix and visual-line-mode

From: "Martin Edstrom" <[email-masked]>
Date: Tue, 06 Aug 2024 16:10:09 +0200 (CEST)

Alright, I keep being mistaken about the reproducibility of my bug reports, but I'm reasonably sure the following steps are reproducible.

Step 0: Start emacs -Q  (emacs 29.4 if you have that version, Debian sid package version 1:29.4+1-3)

Step 1: Erase the scratch buffer, and paste this text:

* h1
** h2
- a.y.........
- x...........
*** h3
**** h4
- ....w.......
- z...........

Step 2: Use M-: to eval this expression:

(progn
  (add-text-properties 12 13 '(line-prefix "  "))
  (add-text-properties 27 28 '(line-prefix "  "))
  (add-text-properties 57 58 '(line-prefix "    "))
  (add-text-properties 72 73 '(line-prefix "    "))
  (add-text-properties 12 13 '(display "•"))
  (add-text-properties 27 28 '(display "•"))
  (add-text-properties 57 58 '(display "•"))
  (add-text-properties 72 73 '(display "•")))

Step 3: Run M-x visual-line-mode.

Step 4: Move point to "z", inside the last line, and type C-x C-n (set-goal-column). Say yes to the disabled-command prompt.

Now I would expect moving point upwards with C-p any number of times should still make point land on the text after the list bullet, but the goal column actually seems to be offset in some way influenced by the line prefix. Even using C-n to come back to the line that has "z....." does not place point on the same position as when you started out.

(Alternative reproduction steps: instead of step 2, use M-x org-mode RET M-x org-indent-mode RET.  That's how the bug was found.)

Martin Edstrom

On Sun, 04 Aug 2024 11:47:49 +0300, Eli Zaretskii <[email-masked]> wrote:

> > From: "Martin Edström" <[email-masked]>
> > Date: Fri, 02 Aug 2024 12:35:32 +0200 (CEST)
> > 
> > There remains a niggling issue related to bug 61580 ( https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-03/msg00094.html )
> > 
> > Basically, reproduce that same setup. Now turn on M-x visual-line-mode and try to use M-x set-goal-column (C-x C-n).  It does not stick to the goal column you choose.
> 
> Thanks, but please show a full recipe for reproducing this, starting
> from "emacs -Q".  The original setup talks about an Org file(is that
> part necessary?) and some added text properties with absolute buffer
> positions, so I'd rather not guess how to repeat that.  Please also
> describe in more detail what you mean by "does not stick to the goal
> column" -- which commands did you type that didn't honor the goal
> column?