Subject: Re: bug#30171: 27.0.50; {add-to,remove-from}-invisibility-spec don't treat t specially

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 17 Apr 2018 22:39:29 +0200

Philipp Stephani <[email-masked]> writes:

> (with-temp-buffer
>   (insert (propertize " " 'invisible 'foo))
>   (remove-from-invisibility-spec 'what)
>   (invisible-p 1))
>
> is nil.  Commenting out the `remove-from-invisibility-spec' form causes
> it to return t.  I'd expect t with `remove-from-invisibility-spec', but
> that function and `add-to-invisibility-spec' always convert a
> buffer-invisibility-spec of t to (t), which is not the same.

Yes, that's extremely confusing, but poking around, it seems like the
idea is that if you've altered the `buffer-invisibility-spec' in any
way (i.e., made it into a list), then only the properties that are in
the list are the ones that are supposed to be invisible.

In that light, the behaviour here makes sense.

But I'm not sure that's really what's intended here.  Perhaps somebody
who was involved with implementing this could shed some light?

In any case, perhaps calling `remove-from-invisibility-spec' that's not
in the spec anyway shouldn't alter it?  It's certainly surprising.

This definition seems odd to me:

(defun remove-from-invisibility-spec (element)
  "Remove ELEMENT from `buffer-invisibility-spec'."
  (setq buffer-invisibility-spec
        (if (consp buffer-invisibility-spec)
	    (delete element buffer-invisibility-spec)
          (list t))))

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