branch: externals/org commit fbf39134f39fbdf893712673e3f2da56a50a8cfa Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
Fix all the users of org-table-map-tables that expect org table type * lisp/org-table.el (org-table-map-tables): Add new optional parameter to only map over specific table types. (org-table-recalculate-buffer-tables): (org-table-iterate-buffer-tables): * lisp/org.el (org-mode): Ignore table.el tables. Reported-by: libreville <librevi...@riseup.net> Link: https://orgmode.org/list/06f32e496c8bb46bfa67d47d1ec41...@riseup.net --- lisp/org-table.el | 16 +++++++++++----- lisp/org.el | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 21286f59b0..0986a8d81f 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3145,7 +3145,7 @@ with the prefix ARG." ;; the way. (org-table-recalculate t t) (org-table-align)) - t))) + t 'org))) ;;;###autoload (defun org-table-iterate-buffer-tables () @@ -3159,7 +3159,9 @@ with the prefix ARG." (catch 'exit (while (> i 0) (setq i (1- i)) - (org-table-map-tables (lambda () (org-table-recalculate t t)) t) + (org-table-map-tables + (lambda () (org-table-recalculate t t)) + t 'org) (if (equal checksum (setq c1 (md5 (buffer-string)))) (progn (org-table-map-tables #'org-table-align t) @@ -4298,12 +4300,16 @@ beginning and end position of the current table." ;;; Generic Tools ;;;###autoload -(defun org-table-map-tables (f &optional quietly) - "Apply function F to the start of all tables in the buffer." +(defun org-table-map-tables (f &optional quietly type) + "Apply function F to the start of all tables in the buffer. +When TYPE is non-nil, only consider Org tables of that type (symbol +`org' or symbol `table.el'." (org-with-point-at 1 (while (re-search-forward org-table-line-regexp nil t) (let ((table (org-element-lineage (org-element-at-point) 'table t))) - (when table + (when (and table + (or (not type) + (eq type (org-element-property :type table)))) (unless quietly (message "Mapping tables: %d%%" (floor (* 100.0 (point)) (buffer-size)))) diff --git a/lisp/org.el b/lisp/org.el index f73e4f70e7..ec6aa75806 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5140,7 +5140,7 @@ The following commands are available: (lambda () (org-table-align) (org-table-shrink))) (org-startup-align-all-tables #'org-table-align) (t #'org-table-shrink)) - t)) + t 'org)) ;; Suppress modification hooks to speed up the startup. ;; However, do it only when text properties/overlays, but not ;; buffer text are actually modified. We still need to track text