[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 303c89350e 16/50: Backport commit 5b3d4e7bf from Em
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 303c89350e 16/50: Backport commit 5b3d4e7bf from Emacs |
Date: |
Tue, 4 Oct 2022 21:57:59 -0400 (EDT) |
branch: externals/org
commit 303c89350e9a96880e7329a35cb35a0f58c2a9eb
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Kyle Meyer <kyle@kyleam.com>
Backport commit 5b3d4e7bf from Emacs
* lisp/ox.el (org-export-get-footnote-definition): Pre-process parse
tree once to filter out all non-footnote elements. This speeds up
subsequent footnote definition searches.
org-export-get-footnote-definition: Pre-cache references in parse tree
5b3d4e7bf0b6a1eb576e1c6e6592028e3589f792
Ihor Radchenko
Thu Jun 16 10:52:17 2022 +0300
[ km: This ported commit comes from main's f51c28671. I'm applying it
here too for bookkeeping/traceability purposes. ]
---
lisp/ox.el | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/lisp/ox.el b/lisp/ox.el
index 6316c687db..807b585aea 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3750,28 +3750,33 @@ definition can be found, raise an error."
(if (not label) (org-element-contents footnote-reference)
(let ((cache (or (plist-get info :footnote-definition-cache)
(let ((hash (make-hash-table :test #'equal)))
+ ;; Cache all the footnotes in document for
+ ;; later search.
+ (org-element-map (plist-get info :parse-tree)
+ '(footnote-definition footnote-reference)
+ (lambda (f)
+ ;; Skip any standard footnote reference
+ ;; since those cannot contain a
+ ;; definition.
+ (unless (eq (org-element-property :type f)
'standard)
+ (puthash
+ (cons :element (org-element-property :label f))
+ f
+ hash)))
+ info)
(plist-put info :footnote-definition-cache hash)
hash))))
(or
(gethash label cache)
(puthash label
- (org-element-map (plist-get info :parse-tree)
- '(footnote-definition footnote-reference)
- (lambda (f)
- (cond
- ;; Skip any footnote with a different label.
- ;; Also skip any standard footnote reference
- ;; with the same label since those cannot
- ;; contain a definition.
- ((not (equal (org-element-property :label f) label)) nil)
- ((eq (org-element-property :type f) 'standard) nil)
- ((org-element-contents f))
- ;; Even if the contents are empty, we can not
- ;; return nil since that would eventually raise
- ;; the error. Instead, return the equivalent
- ;; empty string.
- (t "")))
- info t)
+ (let ((hashed (gethash (cons :element label) cache)))
+ (when hashed
+ (or (org-element-contents hashed)
+ ;; Even if the contents are empty, we can not
+ ;; return nil since that would eventually raise
+ ;; the error. Instead, return the equivalent
+ ;; empty string.
+ "")))
cache)
(error "Definition not found for footnote %s" label))))))
- [elpa] externals/org 69ba7a20be 24/50: Backport commit 2a8d08360 from Emacs, (continued)
- [elpa] externals/org 69ba7a20be 24/50: Backport commit 2a8d08360 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 1a2d2fd5e4 05/50: Backport commit c1145c31a from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org e7572fa86c 02/50: Backport commit 616dcf27e from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 723af4afae 10/50: Backport commit 8ef37913d from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 56ba22b9df 11/50: Backport commit 3abb3681b from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org c06dc10f39 13/50: Backport commit 2fba71cf1 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 5a81ec0018 15/50: Backport commit 253374f81 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org e58217ff1f 35/50: Backport commit 57259773b from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 772c44779c 06/50: Backport commit dd0727e1e from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 5d5a7832ec 09/50: Backport commit 18b680cfd from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 303c89350e 16/50: Backport commit 5b3d4e7bf from Emacs,
ELPA Syncer <=
- [elpa] externals/org 675ec6771f 23/50: Backport commit 9230953f2 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 1bbd86310a 31/50: Backport commit 4c1bc8315 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org add8552b1d 36/50: Backport commit 48aacbf29 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 98e168b489 46/50: compat: Add compatibility wrapper for string-clean-whitespace, ELPA Syncer, 2022/10/04
- [elpa] externals/org 75d63533d3 47/50: compat: Move string-equal-ignore-case to correct section, ELPA Syncer, 2022/10/04
- [elpa] externals/org 95a4c59bfe 49/50: compat: Add compatibility wrapper for format-prompt, ELPA Syncer, 2022/10/04
- [elpa] externals/org 4ae72c6174 19/50: Backport commit 0f7ceb480 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 0da6c49f75 21/50: Backport commit 4f37a3b29 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org 07ca33e603 25/50: Backport commit 2a05479c2 from Emacs, ELPA Syncer, 2022/10/04
- [elpa] externals/org e7059f7dbe 28/50: Backport commit 22a5f0223 from Emacs, ELPA Syncer, 2022/10/04