[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 84c89ea7cb 6/7: org-export-resolve-id-link: Pre-cac
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 84c89ea7cb 6/7: org-export-resolve-id-link: Pre-cache all the ids in the parse tree |
Date: |
Sun, 12 Jun 2022 05:57:46 -0400 (EDT) |
branch: externals/org
commit 84c89ea7cbe17c00da088bf4c200087970fae3de
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-export-resolve-id-link: Pre-cache all the ids in the parse tree
* lisp/ox.el (org-export-resolve-id-link): Pre-cache all the ids in
the parse tree for faster lookup.
---
lisp/ox.el | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 695c52286e..cfe86d1902 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4399,15 +4399,27 @@ tree or a file name. Assume LINK type is either \"id\"
or
\"custom-id\". Throw an error if no match is found."
(let ((id (org-element-property :path link)))
;; First check if id is within the current parse tree.
- (or (org-element-map (plist-get info :parse-tree) 'headline
- (lambda (headline)
- (when (or (equal (org-element-property :ID headline) id)
- (equal (org-element-property :CUSTOM_ID headline) id))
- headline))
- info 'first-match)
- ;; Otherwise, look for external files.
- (cdr (assoc id (plist-get info :id-alist)))
- (signal 'org-link-broken (list id)))))
+ (or (let ((local-ids (or (plist-get info :id-local-cache)
+ (let ((table (make-hash-table :test #'equal)))
+ (org-element-map
+ (plist-get info :parse-tree)
+ 'headline
+ (lambda (headline)
+ (let ((id (org-element-property :ID
headline))
+ (custom-id (org-element-property
:CUSTOM_ID headline)))
+ (when id
+ (unless (gethash id table)
+ (puthash id headline table)))
+ (when custom-id
+ (unless (gethash custom-id table)
+ (puthash custom-id headline table)))))
+ info)
+ (plist-put info :id-local-cache table)
+ table))))
+ (gethash id local-ids))
+ ;; Otherwise, look for external files.
+ (cdr (assoc id (plist-get info :id-alist)))
+ (signal 'org-link-broken (list id)))))
(defun org-export-resolve-radio-link (link info)
"Return radio-target object referenced as LINK destination.
- [elpa] externals/org updated (ed6f8dc67f -> f5c9ce8f06), ELPA Syncer, 2022/06/12
- [elpa] externals/org 147ca39750 3/7: org-in-commented-heading-p: Do not parse section unless already cached, ELPA Syncer, 2022/06/12
- [elpa] externals/org 2f8e688516 2/7: org-back-to-heading-or-point-min: Rely less on cache, ELPA Syncer, 2022/06/12
- [elpa] externals/org 8a0b03fb3b 1/7: org-element-headline-parser: Fix headings like * COMMENTnospace, ELPA Syncer, 2022/06/12
- [elpa] externals/org f51c286716 4/7: org-export-get-footnote-definition: Pre-cache references in parse tree, ELPA Syncer, 2022/06/12
- [elpa] externals/org f5c9ce8f06 7/7: org-babel-exp-process-buffer: Disable edit control while processing, ELPA Syncer, 2022/06/12
- [elpa] externals/org 84c89ea7cb 6/7: org-export-resolve-id-link: Pre-cache all the ids in the parse tree,
ELPA Syncer <=
- [elpa] externals/org 792cd4b0a6 5/7: org-export-resolve-fuzyy-link: Pre-cache all possible search cells, ELPA Syncer, 2022/06/12