GNU bug report logs -
#30204
27.0.50; Changing major mode resets non-default invisibility spec
Previous Next
Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>
Date: Mon, 22 Jan 2018 09:52:02 UTC
Severity: minor
Tags: moreinfo
Found in version 27.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #22 received at 30204 <at> debbugs.gnu.org (full text, mbox):
> Am 13.08.2021 um 14:50 schrieb Lars Ingebrigtsen <larsi <at> gnus.org>:
>
> Philipp Stephani <p.stephani2 <at> gmail.com> writes:
>
>> C-x b *foo* RET
>> M-: (progn (add-to-invisibility-spec 'bar) (insert (propertize "foo" 'invisible 'foo)))
>>
>> Now "foo" is visible, as it should be.
>>
>> M-x fundamental-mode => "foo" becomes invisible, because
>> `kill-all-local-variables' has reset `buffer-invisibility-spec' to t.
>> This can be confusing for modes that use conditional invisibility
>> properties such as markdown-mode.
>
> I'm not quite sure I understand the problem here -- if you have a buffer
> in markdown-mode (that's set these properties), why would you change to
> fundamental-mode?
Why not? Changing the major mode of a buffer is a supported operation. For example, maybe I decide mid-way while writing a Markdown document that I'd rather want a plain text file without special syntax.
>
> And I think this is correct behaviour -- if you've switched to
> fundamental-mode, then you don't want these remnants from markdown-mode
> to survive, I think?
Yes, but they do survive, i.e. once markdown-mode has made some text conditionally-visible (which it does for URLs etc.), I'd expect it to become unconditionally-visible instead of unconditionally-invisible when changing the major mode.
>
>> Why can't you make buffer-invisibility-spec be a permanent-local
>> variable in the cases where that is TRT?
>>
>> Hmm, yes, that sounds like a good idea. Let me try that.
>>
>> I don't think this works: The permanent-local property is a global symbol
>> property, but I'd need it to be per-buffer.
>
> Yes, I don't think we have any mechanism that says "this buffer-local
> value should survive if you change major mode, but only this one". And
> I think that's probably a good idea, because it sounds like a confusing
> interface.
>
>
Yes, and probably it's difficult to define a reasonably generic API for this.
Maybe we should aim for a more specific solution: For example, Emacs could make all conditionally-visible text unconditionally-visible when changing major modes? Or have a way for major modes to declare which invisibility specifiers are mode-specific and should be undone when leaving the mode?
This bug report was last modified 3 years and 226 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.