unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Tassilo Horn <tsdh@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Q: Invisible text spec + define minor mode macro
Date: Wed, 21 Apr 2021 22:14:07 +0200	[thread overview]
Message-ID: <DB9PR09MB4986FE5DE2B4502A5FC768E596479@DB9PR09MB4986.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <871rb3s9dq.fsf@gnu.org> (Tassilo Horn's message of "Wed, 21 Apr 2021 21:25:58 +0200")

Tassilo Horn <tsdh@gnu.org> writes:

> Arthur Miller <arthur.miller@live.com> 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½ screen pages are processed.  Has
>> 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

Thank you very much for looking through it and clarifying what
happens. Eli also explained in the bug repport what is going on.

I will try with custom visibility spec instead and see if I can keep my
property that way :).

Thanks!



  reply	other threads:[~2021-04-21 20:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21  8:04 Q: Invisible text spec + define minor mode macro Arthur Miller
2021-04-21  9:16 ` Eli Zaretskii
2021-04-21  9:55   ` Arthur Miller
2021-04-21 17:19   ` Arthur Miller
2021-04-21 17:46     ` Eli Zaretskii
2021-04-21 19:25     ` Tassilo Horn
2021-04-21 20:14       ` Arthur Miller [this message]
2021-04-21  9:36 ` Joost Kremers
2021-04-21 10:02   ` Arthur Miller

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB9PR09MB4986FE5DE2B4502A5FC768E596479@DB9PR09MB4986.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=tsdh@gnu.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).