emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
@ 2021-11-11 11:40 Max Nikulin
  2021-11-11 13:07 ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Max Nikulin @ 2021-11-11 11:40 UTC (permalink / raw)
  To: emacs-orgmode

Another case of

Warning (emacs): org-element--cache: Unregistered buffer modifications 
detected. Resetting.
If this warning appears regularly, please report it to Org mode mailing 
list (M-x org-submit-bug-report).
The buffer is: c-star.org
  Current command: nil
  Backtrace:
nil

Org main, Emacs-26.3

c-star.org file:
---- >8 ----
Ф Put cursor on this line and hit =C-c C-*= to make it a heading
---- 8< ----

Notice a Cyrillic letter that causes a problem with `org-ctrl-c-star'.



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

* Re: C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-11 11:40 C-c C-* causes "org-element--cache: Unregistered buffer modifications detected." Max Nikulin
@ 2021-11-11 13:07 ` Ihor Radchenko
  2021-11-14  7:59   ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2021-11-11 13:07 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Org main, Emacs-26.3
>
> c-star.org file:
> ---- >8 ----
> Ф Put cursor on this line and hit =C-c C-*= to make it a heading
> ---- 8< ----
>
> Notice a Cyrillic letter that causes a problem with `org-ctrl-c-star'.

Confirmed
However, I can only trigger the warning up to Emacs 27. Emacs 28 and
later has no issue.

Need to investigate further.

Best,
Ihor


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

* Re: C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-11 13:07 ` Ihor Radchenko
@ 2021-11-14  7:59   ` Ihor Radchenko
  2021-11-18 14:55     ` [BUG] " Max Nikulin
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2021-11-14  7:59 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

> Confirmed
> However, I can only trigger the warning up to Emacs 27. Emacs 28 and
> later has no issue.
>
> Need to investigate further.

Fixed via c3f457375. This is another case when Emacs internals
(replace-match) increase buffer-chars-modified-tick. Eventually, this
warning should be disabled and we need to make a patch for Emacs to
trigger cache updates regardless of inhibit-modification-hooks. See
https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01069.html

Best,
Ihor


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

* [BUG] C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-14  7:59   ` Ihor Radchenko
@ 2021-11-18 14:55     ` Max Nikulin
  2021-11-21  8:35       ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Max Nikulin @ 2021-11-18 14:55 UTC (permalink / raw)
  To: emacs-orgmode

On 14/11/2021 14:59, Ihor Radchenko wrote:
> Ihor Radchenko writes:
> 
>> Confirmed
>> However, I can only trigger the warning up to Emacs 27. Emacs 28 and
>> later has no issue.
>>
>> Need to investigate further.
> 
> Fixed via c3f457375. This is another case when Emacs internals
> (replace-match) increase buffer-chars-modified-tick. Eventually, this
> warning should be disabled and we need to make a patch for Emacs to
> trigger cache updates regardless of inhibit-modification-hooks. See
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01069.html

Ihor, I am sorry, but I am still getting the error

LANG=en_US.UTF-8 emacs -Q -L ~/src/emacs/org-mode/lisp/ new.org

C-\ russian-computer RET
A
C-*

Latin "A" to type Cyrillic "Ф"

Org 58db28db04 + Emacs-26.3




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

* Re: [BUG] C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-18 14:55     ` [BUG] " Max Nikulin
@ 2021-11-21  8:35       ` Ihor Radchenko
  2021-11-30 11:59         ` Max Nikulin
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2021-11-21  8:35 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Ihor, I am sorry, but I am still getting the error
>
> LANG=en_US.UTF-8 emacs -Q -L ~/src/emacs/org-mode/lisp/ new.org
>
> C-\ russian-computer RET
> A
> C-*
>
> Latin "A" to type Cyrillic "Ф"

Apparently, C-* on
> Ф Put cursor on this line and hit =C-c C-*= to make it a heading
and just
> Ф
are producing different buffer-chars-modified-tick/buffer-modified-tick
signatures. I have added this kind of edit and the one from your other
report [1] to the exception list. The commit is 28d47cfb8 (main).

Given the growing number of such "special" cases, I also changed to code
to reset cache all the time but for "self-insert-command" in
russian-computer. Just to be safe. The warning will not be shown though.

[1] https://orgmode.org/list/sn5uaa$ehd$1@ciao.gmane.io

Best,
Ihor


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

* Re: [BUG] C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-21  8:35       ` Ihor Radchenko
@ 2021-11-30 11:59         ` Max Nikulin
  2021-11-30 12:54           ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Max Nikulin @ 2021-11-30 11:59 UTC (permalink / raw)
  To: emacs-orgmode

On 21/11/2021 15:35, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> C-\ russian-computer RET
>> A
>> C-*
>>
>> Latin "A" to type Cyrillic "Ф"
> 
> Apparently, C-* on
>> Ф Put cursor on this line and hit =C-c C-*= to make it a heading
> and just
>> Ф
> are producing different buffer-chars-modified-tick/buffer-modified-tick
> signatures. I have added this kind of edit and the one from your other
> report [1] to the exception list. The commit is 28d47cfb8 (main).

Ihor, thank you for your work related to such issues. I had a hope to 
thank you for the fix, but I faced a warning again in a bit modified 
scenario. This time it is soft indent mode.

---- >8 ----
#+startup: indent
Do not forget to activate settings above by =C-c C-c=

* H
Try =C-c C-*= on this line
---- 8< ----

Warning (org-element-cache): org-element--cache: Unregistered buffer 
modifications detected. Resetting.
If this warning appears regularly, please report it to Org mode mailing 
list (M-x org-submit-bug-report).
The buffer is: new.org
  Current command: (nil 312 320)
  Chars modified: 312
  Buffer modified: 320
  Backtrace:
nil

First letter of new heading must be a capital one, though it can be 
Latin. Converting top-level "H" heading by C-c C-* does not cause such 
warning.

> Given the growing number of such "special" cases, I also changed to code
> to reset cache all the time but for "self-insert-command" in
> russian-computer. Just to be safe. The warning will not be shown though.
> 
> [1] https://orgmode.org/list/sn5uaa$ehd$1@ciao.gmane.io

I am not an active user of main branch (I was merely hunting for another 
bug), so I can not estimate performance penalty for large files due to 
continuous cache resetting. I do not follow emacs-devel mail list last 
weeks. Have you managed to negotiate with Eli concerning changes 
required in Emacs code? I mean some followups of

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51766
#51766 29.0.50; Return value of buffer-chars-modified-tick changes when 
buffer text is not yet changed before inserting a character for 
non-latin input methods



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

* Re: [BUG] C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-30 11:59         ` Max Nikulin
@ 2021-11-30 12:54           ` Ihor Radchenko
  2021-12-01 12:27             ` Max Nikulin
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2021-11-30 12:54 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Ihor, thank you for your work related to such issues. I had a hope to 
> thank you for the fix, but I faced a warning again in a bit modified 
> scenario. This time it is soft indent mode.
> ...
> First letter of new heading must be a capital one, though it can be 
> Latin. Converting top-level "H" heading by C-c C-* does not cause such 
> warning.

Well... I added yet another exception on main. Note that this special
case is also just in older Emacs versions.

> I am not an active user of main branch (I was merely hunting for another 
> bug), so I can not estimate performance penalty for large files due to 
> continuous cache resetting. I do not follow emacs-devel mail list last 
> weeks. Have you managed to negotiate with Eli concerning changes 
> required in Emacs code? I mean some followups of ...

The conclusion from that discussion is that someone needs to prepare
upstream patch for Emacs. I may do it in future, but it does not feel
like high priority because fixes for Emacs master will not solve the
problem in older Emacs versions. (and I secretly hope that this kind of
patch will be implemented by someone else as a part of tree-sitter
integration).

As for the performance, the last series of special cases you reported
(thanks again for doing this!) should not happen too frequently. I
cannot imagine users spamming C-c C-* all the time. The most problematic
is the case triggered by self-insert-command, but it will not trigger
cache reset. The worst impact we can see with C-c C-* issue is ~1.5-2x
slower agenda (or other full-text search queries) if cache is reset
between agenda updates. It is still much better than not using cache.

Actually, growing cache too much makes Emacs garbage collector perform
pretty poorly (at least when you have a file so large that cache has
300-400k elements). Reducing cache size from time to time may be even
beneficial for performance. I do not know the realistic cutoff values
though. We may want to implement access frequency-based cache element
removal.

Best,
Ihor


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

* Re: [BUG] C-c C-* causes "org-element--cache: Unregistered buffer modifications detected."
  2021-11-30 12:54           ` Ihor Radchenko
@ 2021-12-01 12:27             ` Max Nikulin
  0 siblings, 0 replies; 8+ messages in thread
From: Max Nikulin @ 2021-12-01 12:27 UTC (permalink / raw)
  To: emacs-orgmode

On 30/11/2021 19:54, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
>> Ihor, thank you for your work related to such issues. I had a hope to
>> thank you for the fix, but I faced a warning again in a bit modified
>> scenario. This time it is soft indent mode.
>> ...
>> First letter of new heading must be a capital one, though it can be
>> Latin. Converting top-level "H" heading by C-c C-* does not cause such
>> warning.
> 
> Well... I added yet another exception on main. Note that this special
> case is also just in older Emacs versions.

Ihor, have you pushed the change? I still can reproduce the issue with 
Emacs-26.3

Next Ubuntu LTS is expected in April, upgrades will be enabled about 
September. As fallback (for the case of some intrusive changes that 
might be added by Canonical) I consider Debian and it has ~2 years 
release cycle as well.

> (and I secretly hope that this kind of
> patch will be implemented by someone else as a part of tree-sitter
> integration).

A piece of friendly trolling: it would be tree-sitter module for Org syntax.

> The most problematic
> is the case triggered by self-insert-command, but it will not trigger
> cache reset.

I mean namely this case of just typing text somewhere in a large file.





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

end of thread, other threads:[~2021-12-01 12:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 11:40 C-c C-* causes "org-element--cache: Unregistered buffer modifications detected." Max Nikulin
2021-11-11 13:07 ` Ihor Radchenko
2021-11-14  7:59   ` Ihor Radchenko
2021-11-18 14:55     ` [BUG] " Max Nikulin
2021-11-21  8:35       ` Ihor Radchenko
2021-11-30 11:59         ` Max Nikulin
2021-11-30 12:54           ` Ihor Radchenko
2021-12-01 12:27             ` Max Nikulin

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).