Subject: Re: bug#40821: Margin strings are displayed in reverse order of overlay priority (low-priority specs hide high-priority ones)

From: Clément Pit-Claudel <[email-masked]>
Date: Wed, 13 May 2020 11:58:26 -0400

On 25/04/2020 03.58, Eli Zaretskii wrote:
> The strings are not concatenated, they are displayed one after
> another, in the order they are processed by the display engine.

I wonder if this should be its separate issue, but the order of strings in the margins changes as the point moves around in the buffer:

(with-current-buffer (get-buffer-create "overlay props")
  (erase-buffer)
  (delete-all-overlays)
  (setq-local left-margin-width 5)
  (save-excursion (insert "test\ntest\n"))
  (let ((ov1 (make-overlay (point-min) (point-max)))
        (ov2 (make-overlay (point-min) (point-at-eol))))
    (overlay-put
     ov1
     'before-string
     #("!" 0 1 (display
                ((margin left-margin) "c"))))
    (overlay-put
     ov2
     'before-string
     #("!" 0 1 (display
                ((margin left-margin) "3")))))
  (display-buffer (current-buffer)))

In this example, moving the point back and forth between point-min and 1+ point-min causes the margins to display alternatively "c3" and "3c".
Is this a bug?