Skip to content

Commit 4ae72c6

Browse files
yantar92kyleam
authored andcommitted
Backport commit 0f7ceb480 from Emacs
* lisp/ox.el (org-export-as): Use `buffer-chars-modified-tick' and avoid extra invocations of `org-set-regexps-and-options' and `org-update-radio-target-regexp' when the buffer is not changed. Also, disable folding checks. Folding is irrelevant inside export buffer. org-export-as: Do not update buffer settings when not modified 0f7ceb4803cabcb3c406fa7c27ccb7625096058e Ihor Radchenko Thu Jun 16 10:53:16 2022 +0300 [ km: This ported commit comes from main's 076dd92. I'm applying it here too for bookkeeping/traceability purposes. ]
1 parent 4f8ea50 commit 4ae72c6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lisp/ox.el

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,11 +2958,12 @@ Return code as a string."
29582958
(mapcar (lambda (o) (and (eq (nth 4 o) 'parse) (nth 1 o)))
29592959
(append (org-export-get-all-options backend)
29602960
org-export-options-alist))))
2961-
tree)
2961+
tree modified-tick)
29622962
;; Update communication channel and get parse tree. Buffer
29632963
;; isn't parsed directly. Instead, all buffer modifications
29642964
;; and consequent parsing are undertaken in a temporary copy.
29652965
(org-export-with-buffer-copy
2966+
(font-lock-mode -1)
29662967
;; Run first hook with current back-end's name as argument.
29672968
(run-hook-with-args 'org-export-before-processing-hook
29682969
(org-export-backend-name backend))
@@ -2974,24 +2975,29 @@ Return code as a string."
29742975
;; potentially invasive changes.
29752976
(org-set-regexps-and-options)
29762977
(org-update-radio-target-regexp)
2978+
(setq modified-tick (buffer-chars-modified-tick))
29772979
;; Possibly execute Babel code. Re-run a macro expansion
29782980
;; specifically for {{{results}}} since inline source blocks
29792981
;; may have generated some more. Refresh buffer properties
29802982
;; and radio targets another time.
29812983
(when org-export-use-babel
29822984
(org-babel-exp-process-buffer)
29832985
(org-macro-replace-all '(("results" . "$1")) parsed-keywords)
2984-
(org-set-regexps-and-options)
2985-
(org-update-radio-target-regexp))
2986+
(unless (eq modified-tick (buffer-chars-modified-tick))
2987+
(org-set-regexps-and-options)
2988+
(org-update-radio-target-regexp))
2989+
(setq modified-tick (buffer-chars-modified-tick)))
29862990
;; Run last hook with current back-end's name as argument.
29872991
;; Update buffer properties and radio targets one last time
29882992
;; before parsing.
29892993
(goto-char (point-min))
29902994
(save-excursion
29912995
(run-hook-with-args 'org-export-before-parsing-hook
29922996
(org-export-backend-name backend)))
2993-
(org-set-regexps-and-options)
2994-
(org-update-radio-target-regexp)
2997+
(unless (eq modified-tick (buffer-chars-modified-tick))
2998+
(org-set-regexps-and-options)
2999+
(org-update-radio-target-regexp))
3000+
(setq modified-tick (buffer-chars-modified-tick))
29953001
;; Update communication channel with environment.
29963002
(setq info
29973003
(org-combine-plists

0 commit comments

Comments
 (0)