Subject: Re: bug#9034: point adjustment after `end-of-visual-line' moves to the next line

From: Dmitry Kurochkin <[email-masked]>
Date: Mon, 11 Jul 2011 12:27:18 +0400

On Mon, 11 Jul 2011 00:16:31 -0400, Stefan Monnier <[email-masked]> wrote:
> > If a line ends with invisible text, point adjustment moves to the next
> > line after `end-of-visual-line'.  To reproduce run:
> 
> >   (progn (switch-to-buffer "test")
> >          (insert "aline1\nbline2\ncline3\n")
> >          (put-text-property 7 14 'invisible t) ; region [\nbline2]
> >          (goto-char (point-min)))
> 
> > After that in the test buffer do M-: (progn (end-of-visual-line)
> > (point)).  `end-of-visual-line' moves point to position 14 as expected.
> > But after that the point is adjusted to position 15, as can be checked
> > by C-x =.
> 
> > Sometimes the point is not adjusted to position 15 the first time you
> > run `end-of-visual-line'.  But it is if you run it more than once.
> > Perhaps it is related to the last point position.
> 
> I can reproduce it with M-: (progn (goto-char 14) > (point))
> 

indeed

> > Also, `move-end-of-line` always behaves correctly, so it it something
> > specific to `end-of-visual-line' or `vertical-motion'.
> 
> Apparently not since I can reproduce the problem with just goto-char.

If visual-line-mode is enabled (so that C-e is mapped to
`end-of-visual-line' instead of `move-end-of-line'),
`end-of-visual-line' works correctly when run with C-e.

> Maybe it has to do with the use of M-: instead.
> 

Seems plausible.

Regards,
  Dmitry

>         Stefan