unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Q: Invisible text spec + define minor mode macro
@ 2021-04-21  8:04 Arthur Miller
  2021-04-21  9:16 ` Eli Zaretskii
  2021-04-21  9:36 ` Joost Kremers
  0 siblings, 2 replies; 9+ messages in thread
From: Arthur Miller @ 2021-04-21  8:04 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: ob-hide-markers.el --]
[-- Type: application/emacs-lisp, Size: 3424 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test.org --]
[-- Type: text/x-org, Size: 9299 bytes --]

* Test
** Block 1
#+begin_src emacs-lisp

#+end_src
** Block 2
#+begin_src emacs-lisp

#+end_src
** Block 3
#+begin_src emacs-lisp

#+end_src
** Block 4
#+begin_src emacs-lisp

#+end_src
** Block 5
#+begin_src emacs-lisp

#+end_src
** Block 6
#+begin_src emacs-lisp

#+end_src
** Block 7
#+begin_src emacs-lisp

#+end_src
** Block 8
#+begin_src emacs-lisp

#+end_src
** Block 9
#+begin_src emacs-lisp

#+end_src
** Block 10
#+begin_src emacs-lisp

#+end_src
** Block 11
#+begin_src emacs-lisp

#+end_src
** Block 12
#+begin_src emacs-lisp

#+end_src
** Block 13
#+begin_src emacs-lisp

#+end_src
** Block 14
#+begin_src emacs-lisp

#+end_src
** Block 15
#+begin_src emacs-lisp

#+end_src
** Block 16
#+begin_src emacs-lisp

#+end_src
** Block 17
#+begin_src emacs-lisp

#+end_src
** Block 18
#+begin_src emacs-lisp

#+end_src
** Block 19
#+begin_src emacs-lisp

#+end_src
** Block 20
#+begin_src emacs-lisp

#+end_src
** Block 21
#+begin_src emacs-lisp

#+end_src
** Block 22
#+begin_src emacs-lisp

#+end_src
** Block 23
#+begin_src emacs-lisp

#+end_src
** Block 24
#+begin_src emacs-lisp

#+end_src
** Block 25
#+begin_src emacs-lisp

#+end_src
** Block 26
#+begin_src emacs-lisp

#+end_src
** Block 27
#+begin_src emacs-lisp

#+end_src
** Block 28
#+begin_src emacs-lisp

#+end_src
** Block 29
#+begin_src emacs-lisp

#+end_src
** Block 30
#+begin_src emacs-lisp

#+end_src
** Block 31
#+begin_src emacs-lisp

#+end_src
** Block 32
#+begin_src emacs-lisp

#+end_src
** Block 33
#+begin_src emacs-lisp

#+end_src
** Block 34
#+begin_src emacs-lisp

#+end_src
** Block 35
#+begin_src emacs-lisp

#+end_src
** Block 36
#+begin_src emacs-lisp

#+end_src
** Block 37
#+begin_src emacs-lisp

#+end_src
** Block 38
#+begin_src emacs-lisp

#+end_src
** Block 39
#+begin_src emacs-lisp

#+end_src
** Block 40
#+begin_src emacs-lisp

#+end_src
** Block 41
#+begin_src emacs-lisp

#+end_src
** Block 42
#+begin_src emacs-lisp

#+end_src
** Block 43
#+begin_src emacs-lisp

#+end_src
** Block 44
#+begin_src emacs-lisp

#+end_src
** Block 45
#+begin_src emacs-lisp

#+end_src
** Block 46
#+begin_src emacs-lisp

#+end_src
** Block 47
#+begin_src emacs-lisp

#+end_src
** Block 48
#+begin_src emacs-lisp

#+end_src
** Block 49
#+begin_src emacs-lisp

#+end_src
** Block 50
#+begin_src emacs-lisp

#+end_src
** Block 51
#+begin_src emacs-lisp

#+end_src
** Block 52
#+begin_src emacs-lisp

#+end_src
** Block 53
#+begin_src emacs-lisp

#+end_src
** Block 54
#+begin_src emacs-lisp

#+end_src
** Block 55
#+begin_src emacs-lisp

#+end_src
** Block 56
#+begin_src emacs-lisp

#+end_src
** Block 57
#+begin_src emacs-lisp

#+end_src
** Block 58
#+begin_src emacs-lisp

#+end_src
** Block 59
#+begin_src emacs-lisp

#+end_src
** Block 60
#+begin_src emacs-lisp

#+end_src
** Block 61
#+begin_src emacs-lisp

#+end_src
** Block 62
#+begin_src emacs-lisp

#+end_src
** Block 63
#+begin_src emacs-lisp

#+end_src
** Block 64
#+begin_src emacs-lisp

#+end_src
** Block 65
#+begin_src emacs-lisp

#+end_src
** Block 66
#+begin_src emacs-lisp

#+end_src
** Block 67
#+begin_src emacs-lisp

#+end_src
** Block 68
#+begin_src emacs-lisp

#+end_src
** Block 69
#+begin_src emacs-lisp

#+end_src
** Block 70
#+begin_src emacs-lisp

#+end_src
** Block 71
#+begin_src emacs-lisp

#+end_src
** Block 72
#+begin_src emacs-lisp

#+end_src
** Block 73
#+begin_src emacs-lisp

#+end_src
** Block 74
#+begin_src emacs-lisp

#+end_src
** Block 75
#+begin_src emacs-lisp

#+end_src
** Block 76
#+begin_src emacs-lisp

#+end_src
** Block 77
#+begin_src emacs-lisp

#+end_src
** Block 78
#+begin_src emacs-lisp

#+end_src
** Block 79
#+begin_src emacs-lisp

#+end_src
** Block 80
#+begin_src emacs-lisp

#+end_src
** Block 81
#+begin_src emacs-lisp

#+end_src
** Block 82
#+begin_src emacs-lisp

#+end_src
** Block 83
#+begin_src emacs-lisp

#+end_src
** Block 84
#+begin_src emacs-lisp

#+end_src
** Block 85
#+begin_src emacs-lisp

#+end_src
** Block 86
#+begin_src emacs-lisp

#+end_src
** Block 87
#+begin_src emacs-lisp

#+end_src
** Block 88
#+begin_src emacs-lisp

#+end_src
** Block 89
#+begin_src emacs-lisp

#+end_src
** Block 90
#+begin_src emacs-lisp

#+end_src
** Block 91
#+begin_src emacs-lisp

#+end_src
** Block 92
#+begin_src emacs-lisp

#+end_src
** Block 93
#+begin_src emacs-lisp

#+end_src
** Block 94
#+begin_src emacs-lisp

#+end_src
** Block 95
#+begin_src emacs-lisp

#+end_src
** Block 96
#+begin_src emacs-lisp

#+end_src
** Block 97
#+begin_src emacs-lisp

#+end_src
** Block 98
#+begin_src emacs-lisp

#+end_src
** Block 99
#+begin_src emacs-lisp

#+end_src
** Block 100
#+begin_src emacs-lisp

#+end_src
** Block 101
#+begin_src emacs-lisp

#+end_src
** Block 102
#+begin_src emacs-lisp

#+end_src
** Block 103
#+begin_src emacs-lisp

#+end_src
** Block 104
#+begin_src emacs-lisp

#+end_src
** Block 105
#+begin_src emacs-lisp

#+end_src
** Block 106
#+begin_src emacs-lisp

#+end_src
** Block 107
#+begin_src emacs-lisp

#+end_src
** Block 108
#+begin_src emacs-lisp

#+end_src
** Block 109
#+begin_src emacs-lisp

#+end_src
** Block 110
#+begin_src emacs-lisp

#+end_src
** Block 111
#+begin_src emacs-lisp

#+end_src
** Block 112
#+begin_src emacs-lisp

#+end_src
** Block 113
#+begin_src emacs-lisp

#+end_src
** Block 114
#+begin_src emacs-lisp

#+end_src
** Block 115
#+begin_src emacs-lisp

#+end_src
** Block 116
#+begin_src emacs-lisp

#+end_src
** Block 117
#+begin_src emacs-lisp

#+end_src
** Block 118
#+begin_src emacs-lisp

#+end_src
** Block 119
#+begin_src emacs-lisp

#+end_src
** Block 120
#+begin_src emacs-lisp

#+end_src
** Block 121
#+begin_src emacs-lisp

#+end_src
** Block 122
#+begin_src emacs-lisp

#+end_src
** Block 123
#+begin_src emacs-lisp

#+end_src
** Block 124
#+begin_src emacs-lisp

#+end_src
** Block 125
#+begin_src emacs-lisp

#+end_src
** Block 126
#+begin_src emacs-lisp

#+end_src
** Block 127
#+begin_src emacs-lisp

#+end_src
** Block 128
#+begin_src emacs-lisp

#+end_src
** Block 129
#+begin_src emacs-lisp

#+end_src
** Block 130
#+begin_src emacs-lisp

#+end_src
** Block 131
#+begin_src emacs-lisp

#+end_src
** Block 132
#+begin_src emacs-lisp

#+end_src
** Block 133
#+begin_src emacs-lisp

#+end_src
** Block 134
#+begin_src emacs-lisp

#+end_src
** Block 135
#+begin_src emacs-lisp

#+end_src
** Block 136
#+begin_src emacs-lisp

#+end_src
** Block 137
#+begin_src emacs-lisp

#+end_src
** Block 138
#+begin_src emacs-lisp

#+end_src
** Block 139
#+begin_src emacs-lisp

#+end_src
** Block 140
#+begin_src emacs-lisp

#+end_src
** Block 141
#+begin_src emacs-lisp

#+end_src
** Block 142
#+begin_src emacs-lisp

#+end_src
** Block 143
#+begin_src emacs-lisp

#+end_src
** Block 144
#+begin_src emacs-lisp

#+end_src
** Block 145
#+begin_src emacs-lisp

#+end_src
** Block 146
#+begin_src emacs-lisp

#+end_src
** Block 147
#+begin_src emacs-lisp

#+end_src
** Block 148
#+begin_src emacs-lisp

#+end_src
** Block 149
#+begin_src emacs-lisp

#+end_src
** Block 150
#+begin_src emacs-lisp

#+end_src
** Block 151
#+begin_src emacs-lisp

#+end_src
** Block 152
#+begin_src emacs-lisp

#+end_src
** Block 153
#+begin_src emacs-lisp

#+end_src
** Block 154
#+begin_src emacs-lisp

#+end_src
** Block 155
#+begin_src emacs-lisp

#+end_src
** Block 156
#+begin_src emacs-lisp

#+end_src
** Block 157
#+begin_src emacs-lisp

#+end_src
** Block 158
#+begin_src emacs-lisp

#+end_src
** Block 159
#+begin_src emacs-lisp

#+end_src
** Block 160
#+begin_src emacs-lisp

#+end_src
** Block 161
#+begin_src emacs-lisp

#+end_src
** Block 162
#+begin_src emacs-lisp

#+end_src
** Block 163
#+begin_src emacs-lisp

#+end_src
** Block 164
#+begin_src emacs-lisp

#+end_src
** Block 165
#+begin_src emacs-lisp

#+end_src
** Block 166
#+begin_src emacs-lisp

#+end_src
** Block 167
#+begin_src emacs-lisp

#+end_src
** Block 168
#+begin_src emacs-lisp

#+end_src
** Block 169
#+begin_src emacs-lisp

#+end_src
** Block 170
#+begin_src emacs-lisp

#+end_src
** Block 171
#+begin_src emacs-lisp

#+end_src
** Block 172
#+begin_src emacs-lisp

#+end_src
** Block 173
#+begin_src emacs-lisp

#+end_src
** Block 174
#+begin_src emacs-lisp

#+end_src
** Block 175
#+begin_src emacs-lisp

#+end_src
** Block 176
#+begin_src emacs-lisp

#+end_src
** Block 177
#+begin_src emacs-lisp

#+end_src
** Block 178
#+begin_src emacs-lisp

#+end_src
** Block 179
#+begin_src emacs-lisp

#+end_src
** Block 180
#+begin_src emacs-lisp

#+end_src
** Block 181
#+begin_src emacs-lisp

#+end_src
** Block 182
#+begin_src emacs-lisp

#+end_src
** Block 183
#+begin_src emacs-lisp

#+end_src
** Block 184
#+begin_src emacs-lisp

#+end_src
** Block 185
#+begin_src emacs-lisp

#+end_src
** Block 186
#+begin_src emacs-lisp

#+end_src
** Block 187
#+begin_src emacs-lisp

#+end_src
** Block 188
#+begin_src emacs-lisp

#+end_src
** Block 189
#+begin_src emacs-lisp

#+end_src
** Block 190
#+begin_src emacs-lisp

#+end_src
** Block 191
#+begin_src emacs-lisp

#+end_src
** Block 192
#+begin_src emacs-lisp

#+end_src
** Block 193
#+begin_src emacs-lisp

#+end_src
** Block 194
#+begin_src emacs-lisp

#+end_src
** Block 195
#+begin_src emacs-lisp

#+end_src
** Block 196
#+begin_src emacs-lisp

#+end_src
** Block 197
#+begin_src emacs-lisp

#+end_src
** Block 198
#+begin_src emacs-lisp

#+end_src
** Block 199
#+begin_src emacs-lisp

#+end_src
** Block 200
#+begin_src emacs-lisp

#+end_src

[-- Attachment #3: Type: text/plain, Size: 974 bytes --]


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.

It seems that visibility property updates only for about 2 ~ 3 pages of
text. When I bring text into visible portion of screen and re-run the
mode, it is updated as it should. Does it have to do something with how
invisible text is rendered? I think it shouldn't but I don't understand
what is going on here? The search seems to properly find all src markers
in entire buffer, and all lines are "equal" (machine generated), so
there is no reason why some parts should work and others dont.

Another issue is with minor mode definition. I am trying to use
mode-variable to toggle on/off as I understand the docs it should be
used, but I have to call it twice in org file. Do I need to use
another boolean value to check on, or could I use mode-variable for this
purpose? I thought it was ment for this.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  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  9:36 ` Joost Kremers
  1 sibling, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2021-04-21  9:16 UTC (permalink / raw)
  To: Arthur Miller; +Cc: emacs-devel

> From: Arthur Miller <arthur.miller@live.com>
> Date: Wed, 21 Apr 2021 10:04:17 +0200
> 
> 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.
> 
> It seems that visibility property updates only for about 2 ~ 3 pages of
> text. When I bring text into visible portion of screen and re-run the
> mode, it is updated as it should. Does it have to do something with how
> invisible text is rendered?

In general, text being invisible or not has nothing to do with
rendering it, it only has to do with the exact form of the invisible
property and buffer's invisibility spec.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  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:36 ` Joost Kremers
  2021-04-21 10:02   ` Arthur Miller
  1 sibling, 1 reply; 9+ messages in thread
From: Joost Kremers @ 2021-04-21  9:36 UTC (permalink / raw)
  To: Arthur Miller; +Cc: emacs-devel


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...


-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  2021-04-21  9:16 ` Eli Zaretskii
@ 2021-04-21  9:55   ` Arthur Miller
  2021-04-21 17:19   ` Arthur Miller
  1 sibling, 0 replies; 9+ messages in thread
From: Arthur Miller @ 2021-04-21  9:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Date: Wed, 21 Apr 2021 10:04:17 +0200
>> 
>> 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.
>> 
>> It seems that visibility property updates only for about 2 ~ 3 pages of
>> text. When I bring text into visible portion of screen and re-run the
>> mode, it is updated as it should. Does it have to do something with how
>> invisible text is rendered?
>
> In general, text being invisible or not has nothing to do with
> rendering it, it only has to do with the exact form of the invisible
> property and buffer's invisibility spec.

Ok, that is how I understood the docs. I haven't mixed with the
invisibility spec, I have just put 'visibility' property to 't' which
should with default spec make text invisible. It works, but just for a
part of text. If I scroll to the part of buffer where it didn't work,
and disable/enable mode then that part will work, inclusive all the
previously "seen" parts. I see no logic in that. You can check yourself
the code and test file I attached. It is embarassingly simple, I don't
understand what would be wrong there :-(, but maybe I missunderstand
something.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  2021-04-21  9:36 ` Joost Kremers
@ 2021-04-21 10:02   ` Arthur Miller
  0 siblings, 0 replies; 9+ messages in thread
From: Arthur Miller @ 2021-04-21 10:02 UTC (permalink / raw)
  To: Joost Kremers; +Cc: emacs-devel

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.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  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
  1 sibling, 2 replies; 9+ messages in thread
From: Arthur Miller @ 2021-04-21 17:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Date: Wed, 21 Apr 2021 10:04:17 +0200
>> 
>> 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.
>> 
>> It seems that visibility property updates only for about 2 ~ 3 pages of
>> text. When I bring text into visible portion of screen and re-run the
>> mode, it is updated as it should. Does it have to do something with how
>> invisible text is rendered?
>
> In general, text being invisible or not has nothing to do with
> rendering it, it only has to do with the exact form of the invisible
> property and buffer's invisibility spec.

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? 


[-- Attachment #2: ob-hide-markers.el --]
[-- Type: application/emacs-lisp, Size: 3837 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: test.org --]
[-- Type: text/x-org, Size: 9299 bytes --]

* Test
** Block 1
#+begin_src emacs-lisp

#+end_src
** Block 2
#+begin_src emacs-lisp

#+end_src
** Block 3
#+begin_src emacs-lisp

#+end_src
** Block 4
#+begin_src emacs-lisp

#+end_src
** Block 5
#+begin_src emacs-lisp

#+end_src
** Block 6
#+begin_src emacs-lisp

#+end_src
** Block 7
#+begin_src emacs-lisp

#+end_src
** Block 8
#+begin_src emacs-lisp

#+end_src
** Block 9
#+begin_src emacs-lisp

#+end_src
** Block 10
#+begin_src emacs-lisp

#+end_src
** Block 11
#+begin_src emacs-lisp

#+end_src
** Block 12
#+begin_src emacs-lisp

#+end_src
** Block 13
#+begin_src emacs-lisp

#+end_src
** Block 14
#+begin_src emacs-lisp

#+end_src
** Block 15
#+begin_src emacs-lisp

#+end_src
** Block 16
#+begin_src emacs-lisp

#+end_src
** Block 17
#+begin_src emacs-lisp

#+end_src
** Block 18
#+begin_src emacs-lisp

#+end_src
** Block 19
#+begin_src emacs-lisp

#+end_src
** Block 20
#+begin_src emacs-lisp

#+end_src
** Block 21
#+begin_src emacs-lisp

#+end_src
** Block 22
#+begin_src emacs-lisp

#+end_src
** Block 23
#+begin_src emacs-lisp

#+end_src
** Block 24
#+begin_src emacs-lisp

#+end_src
** Block 25
#+begin_src emacs-lisp

#+end_src
** Block 26
#+begin_src emacs-lisp

#+end_src
** Block 27
#+begin_src emacs-lisp

#+end_src
** Block 28
#+begin_src emacs-lisp

#+end_src
** Block 29
#+begin_src emacs-lisp

#+end_src
** Block 30
#+begin_src emacs-lisp

#+end_src
** Block 31
#+begin_src emacs-lisp

#+end_src
** Block 32
#+begin_src emacs-lisp

#+end_src
** Block 33
#+begin_src emacs-lisp

#+end_src
** Block 34
#+begin_src emacs-lisp

#+end_src
** Block 35
#+begin_src emacs-lisp

#+end_src
** Block 36
#+begin_src emacs-lisp

#+end_src
** Block 37
#+begin_src emacs-lisp

#+end_src
** Block 38
#+begin_src emacs-lisp

#+end_src
** Block 39
#+begin_src emacs-lisp

#+end_src
** Block 40
#+begin_src emacs-lisp

#+end_src
** Block 41
#+begin_src emacs-lisp

#+end_src
** Block 42
#+begin_src emacs-lisp

#+end_src
** Block 43
#+begin_src emacs-lisp

#+end_src
** Block 44
#+begin_src emacs-lisp

#+end_src
** Block 45
#+begin_src emacs-lisp

#+end_src
** Block 46
#+begin_src emacs-lisp

#+end_src
** Block 47
#+begin_src emacs-lisp

#+end_src
** Block 48
#+begin_src emacs-lisp

#+end_src
** Block 49
#+begin_src emacs-lisp

#+end_src
** Block 50
#+begin_src emacs-lisp

#+end_src
** Block 51
#+begin_src emacs-lisp

#+end_src
** Block 52
#+begin_src emacs-lisp

#+end_src
** Block 53
#+begin_src emacs-lisp

#+end_src
** Block 54
#+begin_src emacs-lisp

#+end_src
** Block 55
#+begin_src emacs-lisp

#+end_src
** Block 56
#+begin_src emacs-lisp

#+end_src
** Block 57
#+begin_src emacs-lisp

#+end_src
** Block 58
#+begin_src emacs-lisp

#+end_src
** Block 59
#+begin_src emacs-lisp

#+end_src
** Block 60
#+begin_src emacs-lisp

#+end_src
** Block 61
#+begin_src emacs-lisp

#+end_src
** Block 62
#+begin_src emacs-lisp

#+end_src
** Block 63
#+begin_src emacs-lisp

#+end_src
** Block 64
#+begin_src emacs-lisp

#+end_src
** Block 65
#+begin_src emacs-lisp

#+end_src
** Block 66
#+begin_src emacs-lisp

#+end_src
** Block 67
#+begin_src emacs-lisp

#+end_src
** Block 68
#+begin_src emacs-lisp

#+end_src
** Block 69
#+begin_src emacs-lisp

#+end_src
** Block 70
#+begin_src emacs-lisp

#+end_src
** Block 71
#+begin_src emacs-lisp

#+end_src
** Block 72
#+begin_src emacs-lisp

#+end_src
** Block 73
#+begin_src emacs-lisp

#+end_src
** Block 74
#+begin_src emacs-lisp

#+end_src
** Block 75
#+begin_src emacs-lisp

#+end_src
** Block 76
#+begin_src emacs-lisp

#+end_src
** Block 77
#+begin_src emacs-lisp

#+end_src
** Block 78
#+begin_src emacs-lisp

#+end_src
** Block 79
#+begin_src emacs-lisp

#+end_src
** Block 80
#+begin_src emacs-lisp

#+end_src
** Block 81
#+begin_src emacs-lisp

#+end_src
** Block 82
#+begin_src emacs-lisp

#+end_src
** Block 83
#+begin_src emacs-lisp

#+end_src
** Block 84
#+begin_src emacs-lisp

#+end_src
** Block 85
#+begin_src emacs-lisp

#+end_src
** Block 86
#+begin_src emacs-lisp

#+end_src
** Block 87
#+begin_src emacs-lisp

#+end_src
** Block 88
#+begin_src emacs-lisp

#+end_src
** Block 89
#+begin_src emacs-lisp

#+end_src
** Block 90
#+begin_src emacs-lisp

#+end_src
** Block 91
#+begin_src emacs-lisp

#+end_src
** Block 92
#+begin_src emacs-lisp

#+end_src
** Block 93
#+begin_src emacs-lisp

#+end_src
** Block 94
#+begin_src emacs-lisp

#+end_src
** Block 95
#+begin_src emacs-lisp

#+end_src
** Block 96
#+begin_src emacs-lisp

#+end_src
** Block 97
#+begin_src emacs-lisp

#+end_src
** Block 98
#+begin_src emacs-lisp

#+end_src
** Block 99
#+begin_src emacs-lisp

#+end_src
** Block 100
#+begin_src emacs-lisp

#+end_src
** Block 101
#+begin_src emacs-lisp

#+end_src
** Block 102
#+begin_src emacs-lisp

#+end_src
** Block 103
#+begin_src emacs-lisp

#+end_src
** Block 104
#+begin_src emacs-lisp

#+end_src
** Block 105
#+begin_src emacs-lisp

#+end_src
** Block 106
#+begin_src emacs-lisp

#+end_src
** Block 107
#+begin_src emacs-lisp

#+end_src
** Block 108
#+begin_src emacs-lisp

#+end_src
** Block 109
#+begin_src emacs-lisp

#+end_src
** Block 110
#+begin_src emacs-lisp

#+end_src
** Block 111
#+begin_src emacs-lisp

#+end_src
** Block 112
#+begin_src emacs-lisp

#+end_src
** Block 113
#+begin_src emacs-lisp

#+end_src
** Block 114
#+begin_src emacs-lisp

#+end_src
** Block 115
#+begin_src emacs-lisp

#+end_src
** Block 116
#+begin_src emacs-lisp

#+end_src
** Block 117
#+begin_src emacs-lisp

#+end_src
** Block 118
#+begin_src emacs-lisp

#+end_src
** Block 119
#+begin_src emacs-lisp

#+end_src
** Block 120
#+begin_src emacs-lisp

#+end_src
** Block 121
#+begin_src emacs-lisp

#+end_src
** Block 122
#+begin_src emacs-lisp

#+end_src
** Block 123
#+begin_src emacs-lisp

#+end_src
** Block 124
#+begin_src emacs-lisp

#+end_src
** Block 125
#+begin_src emacs-lisp

#+end_src
** Block 126
#+begin_src emacs-lisp

#+end_src
** Block 127
#+begin_src emacs-lisp

#+end_src
** Block 128
#+begin_src emacs-lisp

#+end_src
** Block 129
#+begin_src emacs-lisp

#+end_src
** Block 130
#+begin_src emacs-lisp

#+end_src
** Block 131
#+begin_src emacs-lisp

#+end_src
** Block 132
#+begin_src emacs-lisp

#+end_src
** Block 133
#+begin_src emacs-lisp

#+end_src
** Block 134
#+begin_src emacs-lisp

#+end_src
** Block 135
#+begin_src emacs-lisp

#+end_src
** Block 136
#+begin_src emacs-lisp

#+end_src
** Block 137
#+begin_src emacs-lisp

#+end_src
** Block 138
#+begin_src emacs-lisp

#+end_src
** Block 139
#+begin_src emacs-lisp

#+end_src
** Block 140
#+begin_src emacs-lisp

#+end_src
** Block 141
#+begin_src emacs-lisp

#+end_src
** Block 142
#+begin_src emacs-lisp

#+end_src
** Block 143
#+begin_src emacs-lisp

#+end_src
** Block 144
#+begin_src emacs-lisp

#+end_src
** Block 145
#+begin_src emacs-lisp

#+end_src
** Block 146
#+begin_src emacs-lisp

#+end_src
** Block 147
#+begin_src emacs-lisp

#+end_src
** Block 148
#+begin_src emacs-lisp

#+end_src
** Block 149
#+begin_src emacs-lisp

#+end_src
** Block 150
#+begin_src emacs-lisp

#+end_src
** Block 151
#+begin_src emacs-lisp

#+end_src
** Block 152
#+begin_src emacs-lisp

#+end_src
** Block 153
#+begin_src emacs-lisp

#+end_src
** Block 154
#+begin_src emacs-lisp

#+end_src
** Block 155
#+begin_src emacs-lisp

#+end_src
** Block 156
#+begin_src emacs-lisp

#+end_src
** Block 157
#+begin_src emacs-lisp

#+end_src
** Block 158
#+begin_src emacs-lisp

#+end_src
** Block 159
#+begin_src emacs-lisp

#+end_src
** Block 160
#+begin_src emacs-lisp

#+end_src
** Block 161
#+begin_src emacs-lisp

#+end_src
** Block 162
#+begin_src emacs-lisp

#+end_src
** Block 163
#+begin_src emacs-lisp

#+end_src
** Block 164
#+begin_src emacs-lisp

#+end_src
** Block 165
#+begin_src emacs-lisp

#+end_src
** Block 166
#+begin_src emacs-lisp

#+end_src
** Block 167
#+begin_src emacs-lisp

#+end_src
** Block 168
#+begin_src emacs-lisp

#+end_src
** Block 169
#+begin_src emacs-lisp

#+end_src
** Block 170
#+begin_src emacs-lisp

#+end_src
** Block 171
#+begin_src emacs-lisp

#+end_src
** Block 172
#+begin_src emacs-lisp

#+end_src
** Block 173
#+begin_src emacs-lisp

#+end_src
** Block 174
#+begin_src emacs-lisp

#+end_src
** Block 175
#+begin_src emacs-lisp

#+end_src
** Block 176
#+begin_src emacs-lisp

#+end_src
** Block 177
#+begin_src emacs-lisp

#+end_src
** Block 178
#+begin_src emacs-lisp

#+end_src
** Block 179
#+begin_src emacs-lisp

#+end_src
** Block 180
#+begin_src emacs-lisp

#+end_src
** Block 181
#+begin_src emacs-lisp

#+end_src
** Block 182
#+begin_src emacs-lisp

#+end_src
** Block 183
#+begin_src emacs-lisp

#+end_src
** Block 184
#+begin_src emacs-lisp

#+end_src
** Block 185
#+begin_src emacs-lisp

#+end_src
** Block 186
#+begin_src emacs-lisp

#+end_src
** Block 187
#+begin_src emacs-lisp

#+end_src
** Block 188
#+begin_src emacs-lisp

#+end_src
** Block 189
#+begin_src emacs-lisp

#+end_src
** Block 190
#+begin_src emacs-lisp

#+end_src
** Block 191
#+begin_src emacs-lisp

#+end_src
** Block 192
#+begin_src emacs-lisp

#+end_src
** Block 193
#+begin_src emacs-lisp

#+end_src
** Block 194
#+begin_src emacs-lisp

#+end_src
** Block 195
#+begin_src emacs-lisp

#+end_src
** Block 196
#+begin_src emacs-lisp

#+end_src
** Block 197
#+begin_src emacs-lisp

#+end_src
** Block 198
#+begin_src emacs-lisp

#+end_src
** Block 199
#+begin_src emacs-lisp

#+end_src
** Block 200
#+begin_src emacs-lisp

#+end_src

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  2021-04-21 17:19   ` Arthur Miller
@ 2021-04-21 17:46     ` Eli Zaretskii
  2021-04-21 19:25     ` Tassilo Horn
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2021-04-21 17:46 UTC (permalink / raw)
  To: Arthur Miller; +Cc: emacs-devel

> From: Arthur Miller <arthur.miller@live.com>
> Cc: emacs-devel@gnu.org
> Date: Wed, 21 Apr 2021 19:19:25 +0200
> 
> > In general, text being invisible or not has nothing to do with
> > rendering it, it only has to do with the exact form of the invisible
> > property and buffer's invisibility spec.
> 
> 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? 

At this point I don't know.  Please submit a bug report with the
minimal recipe for reproducing the problem in "emacs -Q", and someone
will take a look.

Thanks.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Tassilo Horn @ 2021-04-21 19:25 UTC (permalink / raw)
  To: Arthur Miller; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Q: Invisible text spec + define minor mode macro
  2021-04-21 19:25     ` Tassilo Horn
@ 2021-04-21 20:14       ` Arthur Miller
  0 siblings, 0 replies; 9+ messages in thread
From: Arthur Miller @ 2021-04-21 20:14 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-devel

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!



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-04-21 20:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-04-21  9:36 ` Joost Kremers
2021-04-21 10:02   ` Arthur Miller

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).