From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Newsgroups: gmane.emacs.bugs Subject: bug#30204: 27.0.50; Changing major mode resets non-default invisibility spec Date: Sat, 4 Sep 2021 20:35:11 +0200 Message-ID: <97574057-8212-4812-93CF-0C2EC7EA8B39@gmail.com> References: <87lf55cxvj.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20983"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 30204@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 04 20:36:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMaWX-0005Dy-Dv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Sep 2021 20:36:17 +0200 Original-Received: from localhost ([::1]:49710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMaWV-0002Yt-VC for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Sep 2021 14:36:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMaWI-0002XE-Q4 for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 14:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMaWI-0006tz-Iu for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 14:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mMaWI-0004Bu-EO for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 14:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Sep 2021 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30204 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 30204-submit@debbugs.gnu.org id=B30204.163078052016032 (code B ref 30204); Sat, 04 Sep 2021 18:36:02 +0000 Original-Received: (at 30204) by debbugs.gnu.org; 4 Sep 2021 18:35:20 +0000 Original-Received: from localhost ([127.0.0.1]:48555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMaVc-0004AV-HQ for submit@debbugs.gnu.org; Sat, 04 Sep 2021 14:35:20 -0400 Original-Received: from mail-wr1-f54.google.com ([209.85.221.54]:36522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMaVa-0004AG-ES for 30204@debbugs.gnu.org; Sat, 04 Sep 2021 14:35:18 -0400 Original-Received: by mail-wr1-f54.google.com with SMTP id q14so3461151wrp.3 for <30204@debbugs.gnu.org>; Sat, 04 Sep 2021 11:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2GdZCeiokNsMcTmN5VohNbRLatPwNaFDwX+mDFoFJmg=; b=lOfzFCdtL9PBvdjS1ZRc6oF85We0LXERPx5NAB9PNGyd39INg7mxcaIAq3tUSrAUsW B/YdY/QQczFAFfKvHnxXLyohkgXJ2vyhdivd/Q6bd90rwlWhVeGy34MgWp5BzN7kcNYI uv9ODt0PJeiqAVSXO5GSXNNXueZe8HFK6p/8WUII30iraFDOpiwdH4H9kjVOuO0D5/zM n8W+/KOJFJYpEUURIlT5YnWtd/bNJPcFdV5M/PYHoCN2X7yEAVIO+0r0V6/ZldflvXpT x/zKOBEkNfRfEj5rTBhStW0e9I3oZqWwwfcl9M5PvmaUWR8RTuI514DDDqgLTXL9TkP9 ZTNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2GdZCeiokNsMcTmN5VohNbRLatPwNaFDwX+mDFoFJmg=; b=MrNm7Wfjpo8mVU1O26HQTlbJEkQkdtBDwLo+l2WdWa4C1H3MV99lQmuzHXKYUs/eIQ fzABaqYmMadt3n1Tz2Av0/A6jtll3I+tV4dgUGL0PYaSbjfTzDhcF0vk3Z6vfI50v4JJ uHuM2ogW2RMBEyJbm5l8kMGk4LqA+v2uhqS//JK4FYSV8Px8n0GZbpi7ydpDa3kSJLTl gvqh3vWlmEMbOnvtadqZu/Uj4IVYIrpOdDnSvqIzEC7B0GOuogzlaYYSC5OPppLhv1g/ PcM+/CZmyUc2aBgE2qj15H0HgXtWrUIoRSLDdZuMjGtu4j5in6uwNCL/C0KrGY/4iKlJ d9PA== X-Gm-Message-State: AOAM533Xuf9gYjPwab/qxL0Dw3+ObLFMdKFeSqpIs4fRhcM2y/twGWEq 3v+lKU6nq1gSRm8NIEBki2k= X-Google-Smtp-Source: ABdhPJyfdXYe9aMMYl60DFYOA9m8+AGu84dWFzdHVeIjeVArSFTrnwzNZskEhlVJ/0M82qvfDN98/A== X-Received: by 2002:a05:6000:344:: with SMTP id e4mr5167786wre.423.1630780512386; Sat, 04 Sep 2021 11:35:12 -0700 (PDT) Original-Received: from smtpclient.apple ([46.128.209.111]) by smtp.gmail.com with ESMTPSA id t14sm2844163wrw.59.2021.09.04.11.35.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Sep 2021 11:35:11 -0700 (PDT) In-Reply-To: <87lf55cxvj.fsf@gnus.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:213429 Archived-At: > Am 13.08.2021 um 14:50 schrieb Lars Ingebrigtsen : >=20 > Philipp Stephani writes: >=20 >> C-x b *foo* RET >> M-: (progn (add-to-invisibility-spec 'bar) (insert (propertize "foo" = 'invisible 'foo))) >>=20 >> Now "foo" is visible, as it should be. >>=20 >> M-x fundamental-mode =3D> "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. >=20 > 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. >=20 > 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. >=20 >> Why can't you make buffer-invisibility-spec be a permanent-local >> variable in the cases where that is TRT? >>=20 >> Hmm, yes, that sounds like a good idea. Let me try that.=20 >>=20 >> I don't think this works: The permanent-local property is a global = symbol >> property, but I'd need it to be per-buffer.=20 >=20 > 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. >=20 >=20 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?