emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q: Invisible text spec + define minor mode macro


From: Arthur Miller
Subject: Re: Q: Invisible text spec + define minor mode macro
Date: Wed, 21 Apr 2021 12:02:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)

Joost Kremers <joostkremers@fastmail.fm> writes:

> On Wed, Apr 21 2021, Arthur Miller wrote:
>> I am not sure what is going on here. I have this minor mode defined,
>> as shown yesterday, where I just iterate through a buffer and try to
>> make certain lines invisible.
>
> Wouldn't it be easier to use the font lock mechanism for this? That way, you
> basically only need to worry about getting the regexp right. Finding matches, 
> updating the display, etc. is all handled by Emacs.
>
> The `invisible' property is not normally handled by font lock, I guess, but
> there is a variable `font-lock-extra-managed-props', which, by the looks of 
> it,
> should be able to remedy that.
>
> Mind you, I only understand the basics of the font lock mechanism and I 
> haven't
> tried this, so it's possible this is a silly suggestion. It's just the first
> thing I'd try...

I don't think it is a silly, but I think it would be more complicated. I
don't know to be honest, I am not so acquinted with font-lock mechanism
and I don't wanna dive into that one.

I really just need to find each #+begin|end_src which usually start at
line beginning and put the invisible property to 't. That is really
simple. If you check the code, it is almost trivial. I am embarassed I
can't spot what is wrong there :-). The regex in the source file
works. I checked, I counted all matches and got 401 for 200 src blocks.
I think it should be 400, but I am good with 401 :-).

But thanks for the suggestion anyway.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]