bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19307: 24.4.51; Ellipsis created with `invisible' removes highlighti


From: Eli Zaretskii
Subject: bug#19307: 24.4.51; Ellipsis created with `invisible' removes highlighting from overlay after-string after it
Date: Mon, 02 Feb 2015 18:29:23 +0200

> Date: Mon, 02 Feb 2015 05:47:11 +0200
> From: Dmitry Gutov <dgutov@yandex.ru>
> 
> Eli,
>
> Could you look into this?

Sorry, I somehow missed your original report.

> In the example below, the `after-string' value is propertized with a
> face.
> 
> But as long as there is ellipsis at its beginning, the after-string is
> rendered using the default face.
> 
> (defun test ()
>   (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))))

This bug was introduced in Emacs 23, 10 years(!) ago.  Now fixed in
commit 27e11c0 on the emacs-24 branch.

> And here's a somewhat related scenario, with a surprising result:
> 
> (defun testt ()
>   (interactive)
>   (ignore-errors
>     (kill-buffer "testt"))
>   (pop-to-buffer "testt")
>   (add-to-invisibility-spec '(... . t))
>   (insert " ")
>   (let ((ov (make-overlay (1- (point)) (point))))
>     (overlay-put ov 'invisible t)
>     (overlay-put ov 'window (selected-window))
>     (overlay-put ov 'after-string
>                  (propertize "xxx" 'face 'highlight)))
>   (insert (propertize "foo" 'invisible '...)))

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.

> If I modify the scenario to make the overlay empty (and maybe omit
> inserting the space at the beginning, though this makes no difference),
> then "xxx" is displayed and even highlighted as expected.

Each one of the measures you describe either removes one of the
invisible chunks of text or makes it visible.  That's why the overlay
string becomes displayed then.  (As for it being highlighted, the
above bug affected the highlight only when the overlay string
_follows_ the ellipsis; if it comes before the ellipsis, the bug won't
rear its ugly head.)

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

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]