Subject: bug#19307: 24.4.51; Ellipsis created with `invisible' removes highlighting from overlay after-string after it

From: Dmitry Gutov <[email-masked]>
Date: Tue, 03 Feb 2015 05:33:02 +0200

On 02/02/2015 06:29 PM, Eli Zaretskii wrote:

> This bug was introduced in Emacs 23, 10 years(!) ago.

Don't know your feelings on this subject, but I'm kinda proud. :)

 > Now fixed in
> commit 27e11c0 on the emacs-24 branch.

Thanks, but it introduced a regression. Insert some text at the end, and 
"xxx" will get displayed twice:

(defun test2 ()
   (interactive)
   (ignore-errors
     (kill-buffer "test"))
   (pop-to-buffer "test")
   (add-to-invisibility-spec '(... . t))
   (insert (propertize "foo" 'invisible '...))
   (let ((ov (make-overlay (point) (point))))
     (overlay-put ov 'invisible t)
     (overlay-put ov 'window (selected-window))
     (overlay-put ov 'after-string
                  (propertize "xxx" 'face 'highlight)))
   (insert " "))

>> And here's a somewhat related scenario, with a surprising result:
>>
...
> This is unrelated, AFAICT, and is not a bug: what you have here is 2
> chunks of invisible text, one after another.  The display engine skips
> all of that, and never examines any additional properties or overlays
> in the middle of the invisible text.  Emacs always worked like that.

I see. Well, that unfortunate. I can only say that it goes against my 
expectations.

> Is there some important real-life use case that bumped into this
> surprise?  If so, please describe it.

Not into the second one, so far. But the first example caused the 
Company tooltip lose color when displayed after an outline.

Not to diminish your efforts, but I've noticed that the fix for each 
display problem I've reported lately involved move added lines than 
removed ones. Which looks like adding more special cases. That's worrying.