From: Philipp <p.stephani2@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 30204@debbugs.gnu.org
Subject: bug#30204: 27.0.50; Changing major mode resets non-default invisibility spec
Date: Sat, 4 Sep 2021 20:35:11 +0200 [thread overview]
Message-ID: <97574057-8212-4812-93CF-0C2EC7EA8B39@gmail.com> (raw)
In-Reply-To: <87lf55cxvj.fsf@gnus.org>
> Am 13.08.2021 um 14:50 schrieb Lars Ingebrigtsen <larsi@gnus.org>:
>
> Philipp Stephani <p.stephani2@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?
next prev parent reply other threads:[~2021-09-04 18:35 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 9:51 bug#30204: 27.0.50; Changing major mode resets non-default invisibility spec Philipp Stephani
2018-01-22 15:56 ` Eli Zaretskii
2018-01-22 20:42 ` Philipp Stephani
2018-01-22 20:47 ` Philipp Stephani
2021-08-13 12:50 ` Lars Ingebrigtsen
2021-09-04 18:35 ` Philipp [this message]
2021-09-05 8:53 ` Lars Ingebrigtsen
2021-09-05 9:34 ` Eli Zaretskii
2021-09-05 9:43 ` Lars Ingebrigtsen
2021-09-05 9:50 ` Eli Zaretskii
2021-09-05 10:12 ` Lars Ingebrigtsen
2021-09-05 10:32 ` Eli Zaretskii
2021-09-05 10:44 ` Lars Ingebrigtsen
2021-10-06 10:55 ` Lars Ingebrigtsen
2021-10-07 22:21 ` Richard Stallman
2021-10-07 22:25 ` Lars Ingebrigtsen
2021-10-08 21:56 ` Richard Stallman
2021-10-09 11:20 ` Lars Ingebrigtsen
2021-10-10 16:50 ` Juri Linkov
2021-10-10 18:07 ` Eli Zaretskii
2021-10-11 21:12 ` Richard Stallman
2021-10-10 23:26 ` Richard Stallman
2021-10-11 3:01 ` Phil Sainty
2021-10-11 8:19 ` Lars Ingebrigtsen
2021-10-11 9:14 ` Kévin Le Gouguec
2021-10-11 10:05 ` Robert Pluim
2021-10-11 21:14 ` Richard Stallman
2021-10-11 10:53 ` Phil Sainty
2021-10-13 21:38 ` Tomas Nordin
2021-10-11 21:15 ` Richard Stallman
2021-10-12 12:04 ` Lars Ingebrigtsen
2021-10-12 22:43 ` Richard Stallman
2021-10-09 10:55 ` Robert Pluim
2021-10-09 11:10 ` Lars Ingebrigtsen
2021-10-09 11:15 ` Robert Pluim
2021-10-09 11:28 ` Lars Ingebrigtsen
2021-10-10 15:59 ` Robert Pluim
2021-10-10 16:06 ` Stefan Monnier
2021-10-10 16:15 ` Robert Pluim
2021-09-06 10:22 ` jakanakaevangeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=97574057-8212-4812-93CF-0C2EC7EA8B39@gmail.com \
--to=p.stephani2@gmail.com \
--cc=30204@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.