emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org fd93ad6 3/9: org-element-cache: Do not treat insert


From: ELPA Syncer
Subject: [elpa] externals/org fd93ad6 3/9: org-element-cache: Do not treat inserting newline at :begin sensitive
Date: Wed, 15 Dec 2021 23:57:29 -0500 (EST)

branch: externals/org
commit fd93ad698ad2bc65d81dcecc9fc63c167f13e84d
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-element-cache: Do not treat inserting newline at :begin sensitive
    
    * lisp/org-element.el (org-element--cache-before-change): Do not match
    `org-element--cache-sensitive-re' against an element starting at END
    when END is at bol.  Such changes never break an element structure (as
    opposed to inserting non-newline right at :begin of an element).
---
 lisp/org-element.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index c7418f9..b1edb6c 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -6522,7 +6522,17 @@ The function returns the new value of 
`org-element--cache-change-warning'."
        (setq org-element--cache-change-tic (buffer-chars-modified-tick))
        (goto-char beg)
        (beginning-of-line)
-       (let ((bottom (save-excursion (goto-char end) (line-end-position))))
+       (let ((bottom (save-excursion
+                       (goto-char end)
+                       (if (bolp)
+                           ;; FIXME: Potential pitfall.
+                           ;; We are appending to an element end.
+                           ;; Unless the last inserted char is not
+                           ;; newline, the next element is not broken
+                           ;; and does not need to be purged from the
+                           ;; cache.
+                           end
+                         (line-end-position)))))
          (prog1
              (let ((org-element--cache-change-warning-before 
org-element--cache-change-warning)
                    (org-element--cache-change-warning-after))



reply via email to

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