瀏覽代碼

org-element--cache-before-change: Fix handling sensitive edits at bol

* lisp/org-element.el (org-element--cache-before-change): Fix
optimisation when edits are involving element :end position.  Checking
that END is at BOL fails when we insert at the beginning of a
headline.
Ihor Radchenko 3 年之前
父節點
當前提交
5da9d6810b
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      lisp/org-element.el

+ 3 - 1
lisp/org-element.el

@@ -6575,7 +6575,9 @@ The function returns the new value of `org-element--cache-change-warning'."
        (beginning-of-line)
        (let ((bottom (save-excursion
                        (goto-char end)
-                       (if (bolp)
+                       (if (and (bolp)
+                                ;; When beg == end, still extent to eol.
+                                (> (point) beg))
                            ;; FIXME: Potential pitfall.
                            ;; We are appending to an element end.
                            ;; Unless the last inserted char is not