Subject: bug#21468: 24.5; When next-line (visual) crosses overlay with before-string="\n" point goes to column 0

From: Noam Postavsky <[email-masked]>
Date: Fri, 2 Oct 2015 15:58:08 -0400

On Fri, Oct 2, 2015 at 6:01 AM, Eli Zaretskii <[email-masked]> wrote:
>> But when moving point to end of line this causes the cursor to appear
>> at the edge of the window instead of at the "real" end of line. I
>> guess it's because the aligned space pushes the newline character to
>> the edge of the window.
>
> Yes.  But why is that a problem?

Because we want the lines to be just visual effects that don't affect
cursor movement, i.e. the cursor should act the same whether or not
the lines are visible.

>
> If you dislike that, you could make the stretch one column shorter,

Which of course just means that the cursor appears at one column
before the edge of the window instead of at the "real" end of line.

>   (let* ((align (list 'space :align-to `(+ (,(- (window-body-width nil t)
>                                                 (default-font-width)))
>                                            ,(window-hscroll))))
>
> (Btw, I think adding window-hscroll is incorrect here, as its value is
> in columns, while window-body-width returns the width in pixels.)

window-body-width is inside a list indicating pixel value, and
window-hscroll is a plain integer indicating a multiple of the font
width, so it should work, no? That was my reading of "37.16.3 Pixel
Specification for Spaces" in the elisp manual.

From: Noam Postavsky <[email-masked]>
> For a self-contained example do "emacs -Q overlay.el -f eval-buffer -f
> set-mark-command -f move-end-of-line" with attached overlay.el.

By the way, I noticed this is wrong (for some reason it works in 24.5
even though functions are being called with the wrong number of
arguments), it should be called like

    emacs -Q overlay.el --eval "(progn (switch-to-buffer
\"overlay.el\") (eval-buffer) (set-mark-command nil) (move-end-of-line
nil))"