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: Thu, 1 Oct 2015 16:43:11 -0400

On Tue, Sep 15, 2015 at 2:53 AM, Eli Zaretskii <[email-masked]> wrote:
>
> I think you should be able to extend the face by using a display
> property with :align-to value.  The value should be computed to go all
> the way to the edge of the window.

We tried something like this:

(let ((align `(space :align-to (+ (,(window-body-width nil t))
                                  ,(window-hscroll)))))
  (ov rbeg eol 'face (list :overline color)
      'after-string (propertize "\s" 'face face 'display align)))

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.

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.

> I cannot do anything about these issues besides explaining how they
> harm Emacs maintenance, and asking people to look for alternative
> solutions.

Well you *could* refuse to fix bugs like this, i.e. declare that
creating overlays with newlines invokes undefined behaviour. As it
stands, the best way to get the effect we want is to use an overlayed
newline, especially now that you've fixed this bug.