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

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

Re: How to solve overlay conflict between invisible and display?


From: Tassilo Horn
Subject: Re: How to solve overlay conflict between invisible and display?
Date: Fri, 19 Jul 2024 09:02:25 +0200

Eli Zaretskii <eliz@gnu.org> writes:

> What do you mean by "nested"?  If the invisible property starts
> _before_ the display property, the invisible property "wins".  This
> variant of your text program:
>
> (defun th/overlay-invisible-and-display-test ()
>   (interactive)
>   (save-excursion
>     (goto-char 1)
>     (while (re-search-forward "foo" nil t)
>       (let ((o1 (make-overlay (match-beginning 0) (match-end 0)))
>           (o2 (make-overlay (1+ (match-beginning 0)) (1- (match-end 0)))))
>         (overlay-put o1 'invisible t)
>         (overlay-put o2 'display "ยง")))))
>
> when run from *scratch*, completely removes "foo" from display,
> showing only the quotes, which means the invisible property "won".

Ok, I see.  I assumed that when both overlays start xor end at the same
position, that would still count as "one is nested in the other".

>> In my scenario, I would like that the outer invisible overlay also
>> hides the nested display overlays.
>
> Then make the invisible property start before display.

I guess the invisible property overlay could start one char earlier
(covering the newline before) and additionally add a before-string
property with that newline.  I'll try that.

Thanks a lot,
  Tassilo



reply via email to

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