Просмотр исходного кода

org-element-cache: Allow detecting changes from indirect non-Org buffers

* lisp/org-element.el (org-element--cache-before-change):
(org-element--cache-after-change): Do not prevent trigerring if the
current indirect buffer is not in Org mode, but its base buffer is in
Org mode.
Ihor Radchenko 4 лет назад
Родитель
Сommit
5d05f5911a
1 измененных файлов с 6 добавлено и 6 удалено
  1. 6 6
      lisp/org-element.el

+ 6 - 6
lisp/org-element.el

@@ -6571,9 +6571,9 @@ BEG and END are the beginning and end of the range of changed
 text.  See `before-change-functions' for more information.
 text.  See `before-change-functions' for more information.
 
 
 The function returns the new value of `org-element--cache-change-warning'."
 The function returns the new value of `org-element--cache-change-warning'."
-  (when (org-element--cache-active-p t)
-    (with-current-buffer (or (buffer-base-buffer (current-buffer))
-                             (current-buffer))
+  (with-current-buffer (or (buffer-base-buffer (current-buffer))
+                           (current-buffer))
+    (when (org-element--cache-active-p t)
       (org-with-wide-buffer
       (org-with-wide-buffer
        (setq org-element--cache-change-tic (buffer-chars-modified-tick))
        (setq org-element--cache-change-tic (buffer-chars-modified-tick))
        (goto-char beg)
        (goto-char beg)
@@ -6647,9 +6647,9 @@ The function returns the new value of `org-element--cache-change-warning'."
 BEG and END are the beginning and end of the range of changed
 BEG and END are the beginning and end of the range of changed
 text, and the length in bytes of the pre-change text replaced by
 text, and the length in bytes of the pre-change text replaced by
 that range.  See `after-change-functions' for more information."
 that range.  See `after-change-functions' for more information."
-  (when (org-element--cache-active-p t)
-    (with-current-buffer (or (buffer-base-buffer (current-buffer))
-                             (current-buffer))
+  (with-current-buffer (or (buffer-base-buffer (current-buffer))
+                           (current-buffer))
+    (when (org-element--cache-active-p t)
       (when (not (eq org-element--cache-change-tic (buffer-chars-modified-tick)))
       (when (not (eq org-element--cache-change-tic (buffer-chars-modified-tick)))
         (org-element--cache-log-message "After change")
         (org-element--cache-log-message "After change")
         (setq org-element--cache-change-warning (org-element--cache-before-change beg end))
         (setq org-element--cache-change-warning (org-element--cache-before-change beg end))