GNU bug report logs - #30171
27.0.50; {add-to,remove-from}-invisibility-spec don't treat t specially

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Fri, 19 Jan 2018 13:36:01 UTC

Severity: normal

Tags: confirmed, fixed

Found in version 27.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: p.stephani2 <at> gmail.com, 30171 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#30171: 27.0.50; {add-to,remove-from}-invisibility-spec don't treat t specially
Date: Wed, 18 Apr 2018 13:34:42 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi <at> gnus.org>
>> Date: Tue, 17 Apr 2018 22:39:29 +0200
>> Cc: 30171 <at> debbugs.gnu.org
>> 
>> In any case, perhaps calling `remove-from-invisibility-spec' that's not
>> in the spec anyway shouldn't alter it?  It's certainly surprising.
>
> If the only problem is the surprising behavior, I'd prefer to document
> it rather than potentially open a can of worms.

The change below is the cause of this odd feature set, and I wonder
whether Stefan (who made the change) meant for it to do what it does.
The relevant bit commit message seems to be "Handle the t case".

Stefan, the issue is that t and `(t)' mean wildly differing things: `t'
means "hide everything that has an invisibility spec" and `(t)' means
"hide the things that has an invisibility spec `eq' to `t'."

So if the spec was t, and you remove `foo', you end up with `(t)', which
means that if you had invisible text that was `eq' to `bar', that
suddenly becomes visible.

If you understand what I mean.  :-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 5d40aaae41..535fa2d3d0 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4066,9 +4066,10 @@ add-to-invisibility-spec
 
 (defun remove-from-invisibility-spec (element)
   "Remove ELEMENT from `buffer-invisibility-spec'."
-  (if (consp buffer-invisibility-spec)
-      (setq buffer-invisibility-spec
-	    (delete element 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




This bug report was last modified 7 years and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.