Subject: bug#8914: 23.3; Overlay overlapping buffer-invisibility-spec behaves oddly

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 08 Dec 2020 16:03:27 +0100

David Aspinall <[email-masked]> writes:

> Insert the text below into a buffer,
>
>    M-x eval-buffer RET
>    M-x toggle-invis
>
> The smaller area remains visible, although there is a surrounding
> overlay which has an invisibility spec which should cover the revealed
> characters.  
>
> I suppose this is debatable, but intuitively I would expect the whole
> larger region to be made invisible.

(This bug report unfortunately got no response at the time.)

;;;
;;; === Test area for invisibility ===
;;;
(defvar vis nil)

(overlay-put (make-overlay 18 22) 'invisible 'smaller)
(overlay-put (make-overlay 9 43) 'invisible 'larger)

At this point, the entire region is invisible, because the default
invisible spec is t.

(add-to-invisibility-spec '(larger . t))

This makes the `smaller' part visible, because when
buffer-invisibility-spec is a list, only those types that are listed are
made invisible.

However, smaller overlays have priority over larger ones, so the small
part becomes visible.

This sounds confusing, but I think it's working as designed.  If you
want the larger overlay to take priority, you have to add priority specs
explicitly to the larger overlay?

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no