aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/org/org-element.el
diff options
context:
space:
mode:
authorKyle Meyer2023-02-12 15:43:07 -0500
committerKyle Meyer2023-02-12 15:43:07 -0500
commitfe2ea5ddd8da91c8a0f3064f1447fc4fbbda68ab (patch)
treebf850d236c62f4cb34a8732a7c4891fbefcd9d21 /lisp/org/org-element.el
parent8280d721d7c0f6fb2e04f23128c0d2cccf2be1d5 (diff)
downloademacs-fe2ea5ddd8da91c8a0f3064f1447fc4fbbda68ab.tar.gz
emacs-fe2ea5ddd8da91c8a0f3064f1447fc4fbbda68ab.zip
Update to Org 9.6.1-31-gaf1bb1
Diffstat (limited to 'lisp/org/org-element.el')
-rw-r--r--lisp/org/org-element.el45
1 files changed, 30 insertions, 15 deletions
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 389acf82500..4f4eebfcc2d 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -7406,14 +7406,16 @@ the cache."
7406 (org-element-at-point to-pos) 7406 (org-element-at-point to-pos)
7407 (cl-macrolet ((cache-root 7407 (cl-macrolet ((cache-root
7408 ;; Use the most optimal version of cache available. 7408 ;; Use the most optimal version of cache available.
7409 () `(if (memq granularity '(headline headline+inlinetask)) 7409 () `(org-with-base-buffer nil
7410 (org-element--headline-cache-root) 7410 (if (memq granularity '(headline headline+inlinetask))
7411 (org-element--cache-root))) 7411 (org-element--headline-cache-root)
7412 (org-element--cache-root))))
7412 (cache-size 7413 (cache-size
7413 ;; Use the most optimal version of cache available. 7414 ;; Use the most optimal version of cache available.
7414 () `(if (memq granularity '(headline headline+inlinetask)) 7415 () `(org-with-base-buffer nil
7415 org-element--headline-cache-size 7416 (if (memq granularity '(headline headline+inlinetask))
7416 org-element--cache-size)) 7417 org-element--headline-cache-size
7418 org-element--cache-size)))
7417 (cache-walk-restart 7419 (cache-walk-restart
7418 ;; Restart tree traversal after AVL tree re-balance. 7420 ;; Restart tree traversal after AVL tree re-balance.
7419 () `(when node 7421 () `(when node
@@ -7443,8 +7445,9 @@ the cache."
7443 ;; Avoid extra staff like timer cancels et al 7445 ;; Avoid extra staff like timer cancels et al
7444 ;; and only call `org-element--cache-sync-requests' when 7446 ;; and only call `org-element--cache-sync-requests' when
7445 ;; there are pending requests. 7447 ;; there are pending requests.
7446 (when org-element--cache-sync-requests 7448 (org-with-base-buffer nil
7447 (org-element--cache-sync (current-buffer))) 7449 (when org-element--cache-sync-requests
7450 (org-element--cache-sync (current-buffer))))
7448 ;; Call `org-element--parse-to' directly avoiding any 7451 ;; Call `org-element--parse-to' directly avoiding any
7449 ;; kind of `org-element-at-point' overheads. 7452 ;; kind of `org-element-at-point' overheads.
7450 (if restrict-elements 7453 (if restrict-elements
@@ -7515,8 +7518,9 @@ the cache."
7515 tmpnext-start)) 7518 tmpnext-start))
7516 ;; Check if cache does not have gaps. 7519 ;; Check if cache does not have gaps.
7517 (cache-gapless-p 7520 (cache-gapless-p
7518 () `(eq org-element--cache-change-tic 7521 () `(org-with-base-buffer nil
7519 (alist-get granularity org-element--cache-gapless)))) 7522 (eq org-element--cache-change-tic
7523 (alist-get granularity org-element--cache-gapless)))))
7520 ;; The core algorithm is simple walk along binary tree. However, 7524 ;; The core algorithm is simple walk along binary tree. However,
7521 ;; instead of checking all the tree elements from first to last 7525 ;; instead of checking all the tree elements from first to last
7522 ;; (like in `avl-tree-mapcar'), we begin from FROM-POS skipping 7526 ;; (like in `avl-tree-mapcar'), we begin from FROM-POS skipping
@@ -7644,7 +7648,9 @@ the cache."
7644 ;; In the process, we may alter the buffer, 7648 ;; In the process, we may alter the buffer,
7645 ;; so also keep track of the cache state. 7649 ;; so also keep track of the cache state.
7646 (progn 7650 (progn
7647 (setq modified-tic org-element--cache-change-tic) 7651 (setq modified-tic
7652 (org-with-base-buffer nil
7653 org-element--cache-change-tic))
7648 (setq cache-size (cache-size)) 7654 (setq cache-size (cache-size))
7649 ;; When NEXT-RE/FAIL-RE is provided, skip to 7655 ;; When NEXT-RE/FAIL-RE is provided, skip to
7650 ;; next regexp match after :begin of the current 7656 ;; next regexp match after :begin of the current
@@ -7678,7 +7684,7 @@ the cache."
7678 ;; 7684 ;;
7679 ;; Call FUNC. FUNC may move point. 7685 ;; Call FUNC. FUNC may move point.
7680 (setq org-element-cache-map-continue-from nil) 7686 (setq org-element-cache-map-continue-from nil)
7681 (if org-element--cache-map-statistics 7687 (if (org-with-base-buffer nil org-element--cache-map-statistics)
7682 (progn 7688 (progn
7683 (setq before-time (float-time)) 7689 (setq before-time (float-time))
7684 (push (funcall func data) result) 7690 (push (funcall func data) result)
@@ -7697,7 +7703,15 @@ the cache."
7697 (when org-element-cache-map-continue-from 7703 (when org-element-cache-map-continue-from
7698 (goto-char org-element-cache-map-continue-from)) 7704 (goto-char org-element-cache-map-continue-from))
7699 (when (> (point) start) 7705 (when (> (point) start)
7700 (move-start-to-next-match nil)) 7706 (move-start-to-next-match nil)
7707 ;; (point) inside matching element.
7708 ;; Go further.
7709 (when (> (point) start)
7710 (setq data (element-match-at-point))
7711 (if (not data)
7712 (cache-walk-abort)
7713 (goto-char (next-element-start))
7714 (move-start-to-next-match next-element-re))))
7701 ;; Drop nil. 7715 ;; Drop nil.
7702 (unless (car result) (pop result))) 7716 (unless (car result) (pop result)))
7703 ;; If FUNC did not move the point and we 7717 ;; If FUNC did not move the point and we
@@ -7710,8 +7724,9 @@ the cache."
7710 start)) 7724 start))
7711 (setq start nil)) 7725 (setq start nil))
7712 ;; Check if the buffer has been modified. 7726 ;; Check if the buffer has been modified.
7713 (unless (and (eq modified-tic org-element--cache-change-tic) 7727 (unless (org-with-base-buffer nil
7714 (eq cache-size (cache-size))) 7728 (and (eq modified-tic org-element--cache-change-tic)
7729 (eq cache-size (cache-size))))
7715 ;; START may no longer be valid, update 7730 ;; START may no longer be valid, update
7716 ;; it to beginning of real element. 7731 ;; it to beginning of real element.
7717 ;; Upon modification, START may lay 7732 ;; Upon modification, START may lay