all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Arthur Miller <arthur.miller@live.com>
Cc: emacs-devel@gnu.org
Subject: Re: Q: Invisible text spec + define minor mode macro
Date: Wed, 21 Apr 2021 21:25:58 +0200	[thread overview]
Message-ID: <871rb3s9dq.fsf@gnu.org> (raw)
In-Reply-To: <AM9PR09MB49777398761E2C3D60E9C23F96479@AM9PR09MB4977.eurprd09.prod.outlook.com>

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



  parent reply	other threads:[~2021-04-21 19:25 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 [this message]
2021-04-21 20:14       ` Arthur Miller
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

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

  git send-email \
    --in-reply-to=871rb3s9dq.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=arthur.miller@live.com \
    --cc=emacs-devel@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 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.