[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org d8606c3 1/3: org-element--cache-sync: Handle silent
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org d8606c3 1/3: org-element--cache-sync: Handle silent changes for non-latin input methods |
Date: |
Sun, 14 Nov 2021 02:57:25 -0500 (EST) |
branch: externals/org
commit d8606c316ee3d27ddfb38705f1c15e24087f0ee3
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-element--cache-sync: Handle silent changes for non-latin input methods
* lisp/org-element.el (org-element--cache-sync): Detect silent changes
in buffer made by quail.el when non-latin input methods are active.
These silent changes do not modify the buffer, but only change
`buffer-chars-modified-tick' and do no affect element cache. Note
that the detection uses heuristics.
Fixes https://list.orgmode.org/87sfw2luhj.fsf@localhost/T/#you
---
lisp/org-element.el | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index c98e95b..6c956d6 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5835,8 +5835,21 @@ updated before current modification are actually
submitted."
(with-current-buffer (or (buffer-base-buffer buffer) buffer)
;; Check if the buffer have been changed outside visibility of
;; `org-element--cache-before-change' and
`org-element--cache-after-change'.
- (if (/= org-element--cache-change-tic
- (buffer-chars-modified-tick))
+ (if (and (/= org-element--cache-change-tic
+ (buffer-chars-modified-tick))
+ ;; FIXME: Below is a heuristics noticed by observation.
+ ;; quail.el with non-latin input does silent
+ ;; modifications in buffer increasing the tick counter
+ ;; but not actually changing the buffer text:
+ ;; https://list.orgmode.org/87sfw2luhj.fsf@localhost/T/#you
+ ;;
https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg00894.html
+ ;; However, the values of `buffer-chars-modified-tick'
+ ;; and `buffer-modified-tick' appear to be same after
+ ;; the quail.el's changes in buffer. We do not
+ ;; consider these exact changes as a dangerous silent
+ ;; edit.
+ (/= (buffer-chars-modified-tick)
+ (buffer-modified-tick)))
(progn
(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).