From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Q: Invisible text spec + define minor mode macro Date: Wed, 21 Apr 2021 21:25:58 +0200 Message-ID: <871rb3s9dq.fsf@gnu.org> References: <83eef4q9or.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4328"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.11; emacs 28.0.50 Cc: emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 21 21:54:29 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lZIvc-00011X-Rr for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Apr 2021 21:54:28 +0200 Original-Received: from localhost ([::1]:32966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZIvb-0006RG-Pv for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Apr 2021 15:54:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZItu-0005rh-0H for emacs-devel@gnu.org; Wed, 21 Apr 2021 15:52:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34418) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZIts-0006EU-WB; Wed, 21 Apr 2021 15:52:41 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:57747) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1lZIts-0007ts-OK; Wed, 21 Apr 2021 15:52:40 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 2FBE327C0054; Wed, 21 Apr 2021 15:52:40 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 21 Apr 2021 15:52:40 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtkedgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvffuffgjkfggtgfgsehtqhertddtreejnecuhfhrohhmpefvrghs shhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnh epiedugffhhfejveevvdfhffegteelleejffefgefgueeggeelheefieeujefhheegnecu kfhppeekjedrudeifedrfedurdduheegnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhn rghlihhthidqkeeijeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrgh esfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from thinkpad-t440p (p57a31f9a.dip0.t-ipconnect.de [87.163.31.154]) by mail.messagingengine.com (Postfix) with ESMTPA id E96C8240054; Wed, 21 Apr 2021 15:52:38 -0400 (EDT) In-reply-to: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268252 Archived-At: Arthur Miller writes: Hi Arthur, > After playing a bit more: if I scroll through entire file before I > enable my mode, then entire file is processed correctly. But if file > is not scrolled through, then only 3=C2=BD screen pages are processed. H= as > nothing to do with regex I use, just with text being shown on screen > or not. I don't find anything in docs about that. A bug? Or > undocumented behaviour? Or something else I am missing here? I've tried it and can confirm your observations. Your code is correct, though. The funcion `hbm--update-line' is called 400 times at the right positions and puts the 'invisible text property there. Then I augmented that function to spit out the `buffer-substring' where it puts the property, and that showed that lines became invisible where the text was already fontified such as #("#+end_src" 0 4 (fontified t font-lock-fontified t font-lock-multiline t face org-block-end-line wrap-prefix #("#" 0 1 (face org-block-end-line font-lock-multiline t font-lock-fontified t fontified t))) 4 9 (fontified t font-lock-fontified t font-lock-multiline t face org-block-end-line wrap-prefix #("#" 0 1 (face org-block-end-line font-lock-multiline t font-lock-fontified t fontified t)))) and stopped working at the next line #("#+begin_src emacs-lisp" 0 22 (fontified nil)) which is not yet fontified. And indeed, as soon as you disable `font-lock-mode' your minor mode starts working fine. (With `font-lock-mode', you can "unhide" a line also by editing in it which will trigger refontification of that region.) The problem is in Org: it has tons of fontification functions such as `org-fontify-meta-lines-and-blocks' which calls `org-fontify-meta-lines-and-blocks-1' which removes `display', `invisible', and `intangible' text properties. So it seems you cannot use those properties in a sensible way in org files... Bye, Tassilo