From 76a725317e5872b5da7515baa49159da4983b9c0 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 10 Dec 2022 08:45:54 +0300 Subject: [PATCH] orgtbl-to-generic: Improve performance * lisp/org-table.el (orgtbl-to-generic): Disable org-fold checks in temporary buffer. Folding state is irrelevant there. Reported-by: Majzoub, Eric Link: https://orgmode.org/list/tn0s4e$84u$1@ciao.gmane.io --- lisp/org-table.el | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 70ebde205..7d02d896f 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -5728,31 +5728,32 @@ This may be either a string or a function of two arguments: ;; Initialize communication channel in INFO. (with-temp-buffer (let ((org-inhibit-startup t)) (org-mode)) - (let ((standard-output (current-buffer)) - (org-element-use-cache nil)) - (dolist (e table) - (cond ((eq e 'hline) (princ "|--\n")) - ((consp e) - (princ "| ") (dolist (c e) (princ c) (princ " |")) - (princ "\n"))))) - (org-element-cache-reset) - ;; Add back-end specific filters, but not user-defined ones. In - ;; particular, make sure to call parse-tree filters on the - ;; table. - (setq info - (let ((org-export-filters-alist nil)) - (org-export-install-filters - (org-combine-plists - (org-export-get-environment backend nil params) - `(:back-end ,(org-export-get-backend backend)))))) - (setq data - (org-export-filter-apply-functions - (plist-get info :filter-parse-tree) - (org-element-map (org-element-parse-buffer) 'table - #'identity nil t) - info))) - (when (and backend (symbolp backend) (not (org-export-get-backend backend))) - (user-error "Unknown :backend value")) + (org-fold-core-ignore-modifications + (let ((standard-output (current-buffer)) + (org-element-use-cache nil)) + (dolist (e table) + (cond ((eq e 'hline) (princ "|--\n")) + ((consp e) + (princ "| ") (dolist (c e) (princ c) (princ " |")) + (princ "\n"))))) + (org-element-cache-reset) + ;; Add back-end specific filters, but not user-defined ones. In + ;; particular, make sure to call parse-tree filters on the + ;; table. + (setq info + (let ((org-export-filters-alist nil)) + (org-export-install-filters + (org-combine-plists + (org-export-get-environment backend nil params) + `(:back-end ,(org-export-get-backend backend)))))) + (setq data + (org-export-filter-apply-functions + (plist-get info :filter-parse-tree) + (org-element-map (org-element-parse-buffer) 'table + #'identity nil t) + info)) + (when (and backend (symbolp backend) (not (org-export-get-backend backend))) + (user-error "Unknown :backend value")))) (when (or (not backend) (plist-get info :raw)) (require 'ox-org)) ;; Handle :skip parameter. (let ((skip (plist-get info :skip)))