[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 28d47cf: org-element--cache-sync: Do not show warni
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 28d47cf: org-element--cache-sync: Do not show warning on known safe modifications |
Date: |
Sun, 21 Nov 2021 03:57:22 -0500 (EST) |
branch: externals/org
commit 28d47cfb824c0e6200c3817dc97cf6a0e1656b32
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-element--cache-sync: Do not show warning on known safe modifications
* lisp/org-element.el (org-element--cache-sync): Do not raise warning
when `buffer-chars-modified-tick' changes safely outside
org-element-cache visibility. Safe modifications are detected
according to heuristics based on `buffer-chars-modified-tick' and
`buffer-modified-tick'. Their difference contains footprint for some
known [1,2,3] modifications triggered by Emacs internals. However,
still reset cache to avoid false-positives for all but one [1] type of
modification.
[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01069.html
[2] https://list.orgmode.org/YYy9Hx8mNQN08U7e@smoon.bkoty.ru/T/#t
[3] https://list.orgmode.org/87ee7jdv70.fsf@localhost/T/#t
---
lisp/org-element.el | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index ba43eca..b96b834 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5863,25 +5863,30 @@ updated before current modification are actually
submitted."
;; consider these exact changes as a dangerous silent
;; edit.
(/= (buffer-chars-modified-tick)
- (buffer-modified-tick))
- ;; FIXME: Similar for "S-\" in russian-computer input.
- (not (= (buffer-chars-modified-tick)
- (- (buffer-modified-tick) 6)))
- ;; FIXME: Another heuristics noticed by observation.
- ;; `replace-match' in `org-toggle-heading' in Emacs <28
- ;; makes safe silent changes when first letter in the
- ;; line is a cyrillic capital letter.
- ;; https://list.orgmode.org/87pmr6lu1y.fsf@localhost/T/#t
- (not (= (buffer-chars-modified-tick)
- (- (buffer-modified-tick) 7))))
+ (buffer-modified-tick)))
(progn
- (when (or org-element--cache-diagnostics-modifications
+ (when (or (and org-element--cache-diagnostics-modifications
+ ;; FIXME: Some more special cases when
+ ;; non-latin input in Emacs <28 triggers
+ ;; changes in `buffer-chars-modified-tick'
+ ;; even though the buffer text remains
+ ;; unchanged. We still reset the cache as
+ ;; safety precaution, but do not show the
+ ;; warning.
+ (not (memq (- (buffer-modified-tick)
+ (buffer-chars-modified-tick))
+ ;; Note: 4 is a footprint for
+ ;; (let ((inhibit-modification-hooks t))
+ ;; (insert "blah"))
+ '(1 3 6 7))))
(and (boundp 'org-batch-test) org-batch-test))
(org-element--cache-warn "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: %s\n Current command: %S\n Backtrace:\n%S"
+The buffer is: %s\n Current command: %S\n Chars modified: %S\n Buffer
modified: %S\n Backtrace:\n%S"
(buffer-name (current-buffer))
- this-command
+ (list this-command (buffer-chars-modified-tick)
(buffer-modified-tick))
+ (buffer-chars-modified-tick)
+ (buffer-modified-tick)
(when (and (fboundp 'backtrace-get-frames)
(fboundp 'backtrace-to-string))
(backtrace-to-string (backtrace-get-frames
'backtrace)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 28d47cf: org-element--cache-sync: Do not show warning on known safe modifications,
ELPA Syncer <=