[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 792cd4b0a6 5/7: org-export-resolve-fuzyy-link: Pre-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 792cd4b0a6 5/7: org-export-resolve-fuzyy-link: Pre-cache all possible search cells |
Date: |
Sun, 12 Jun 2022 05:57:46 -0400 (EDT) |
branch: externals/org
commit 792cd4b0a664c1f402cd692c455a759b64c15ac3
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-export-resolve-fuzyy-link: Pre-cache all possible search cells
* lisp/ox.el (org-export-resolve-fuzzy-link): Before matching LINK,
pre-process and cache all the non-nil search cells in the parse tree.
When matching, use the pre-processed info. Fix the :test function for
the cache hash table.
---
lisp/ox.el | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index d655c621d6..695c52286e 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4352,17 +4352,27 @@ significant."
(let* ((search-cells (org-export-string-to-search-cell
(org-element-property :path link)))
(link-cache (or (plist-get info :resolve-fuzzy-link-cache)
- (let ((table (make-hash-table :test #'eq)))
+ (let ((table (make-hash-table :test #'equal)))
+ ;; Cache all the element search cells.
+ (org-element-map (plist-get info :parse-tree)
+ (append pseudo-types '(target)
org-element-all-elements)
+ (lambda (datum)
+ (dolist (cell (org-export-search-cells datum))
+ (if (gethash cell table)
+ (push datum (gethash cell table))
+ (puthash cell (list datum) table)))))
(plist-put info :resolve-fuzzy-link-cache table)
table)))
(cached (gethash search-cells link-cache 'not-found)))
(if (not (eq cached 'not-found)) cached
(let ((matches
- (org-element-map (plist-get info :parse-tree)
- (append pseudo-types '(target) org-element-all-elements)
- (lambda (datum)
- (and (org-export-match-search-cell-p datum search-cells)
- datum)))))
+ (let (result)
+ (dolist (search-cell search-cells)
+ (setq result
+ (nconc
+ result
+ (gethash search-cell link-cache))))
+ (delq nil result))))
(unless matches
(signal 'org-link-broken (list (org-element-property :path link))))
(puthash
- [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, 2022/06/12
- [elpa] externals/org 792cd4b0a6 5/7: org-export-resolve-fuzyy-link: Pre-cache all possible search cells,
ELPA Syncer <=