From 6ff0de5c3e5fc9d9b4223de1698983d5c8d83f8e Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 12 Feb 2024 12:55:37 +0100 Subject: [PATCH] ox-org: Export special table rows by default * lisp/ox.el (org-export-options-alist): New internal plist option - :with-special-rows. Defaults to nil. (org-export--skip-p): Do not skip special table rows when :with-special-rows is non-nil. * lisp/ox-org.el (org-org-with-special-rows): New custom option controlling whether to export special table rows. t by default. (org): Use `org-org-with-special-rows' as the value of :with-special-rows option. * etc/ORG-NEWS (=ox-org= now exports special table rows by default): (New option ~org-org-with-special-rows~): Announce the change. --- etc/ORG-NEWS | 12 ++++++++++++ lisp/ox-org.el | 10 +++++++++- lisp/ox.el | 5 ++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 33a3e98a9..7d2f70ab6 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -13,6 +13,13 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) ** Important announcements and breaking changes +*** =ox-org= now exports special table rows by default + +Previously, when exporting to Org, special table rows (for example, +width cookies) were not exported. Now, they are exported by default. + +You can customize new option ~org-org-with-special-rows~ to fall back to previous behavior. + *** Org babel backends are now expected to define an additional API function ~org-babel-session-buffer:~ Org babel now uses session buffer (if it exists) to retrieve @@ -501,6 +508,11 @@ The change is breaking when ~org-use-property-inheritance~ is set to ~t~. The =TEST= parameter is better served by Emacs debugging tools. ** New and changed options +*** New option ~org-org-with-special-rows~ + +The new options controls whether to export special table rows in +Org-Org (=ox-org=) export. The default value is ~t~. + *** New option ~org-babel-comint-fallback-regexp-threshold~ Org babel is often using Emacs' interactive REPL feature to implement diff --git a/lisp/ox-org.el b/lisp/ox-org.el index 403a6bf30..2cdac0be9 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -54,6 +54,11 @@ setting of `org-html-htmlize-output-type' is `css'." (const :tag "Don't include external stylesheet link" nil) (string :tag "URL or local href"))) +(defcustom org-org-with-special-rows t + "Non-nil means export special table rows. +Special rows are the rows containing special marking characters, as +described in the Info node `(org)Advanced features'.") + (org-export-define-backend 'org '((babel-call . org-org-identity) (bold . org-org-identity) @@ -112,7 +117,10 @@ setting of `org-html-htmlize-output-type' is `css'." (lambda (a s v b) (if a (org-org-export-to-org t s v b) (org-open-file (org-org-export-to-org nil s v b))))))) - :filters-alist '((:filter-parse-tree . org-org--add-missing-sections))) + :filters-alist '((:filter-parse-tree . org-org--add-missing-sections)) + :options-alist + ;; Export special table rows. + '((:with-special-rows nil nil org-org-with-special-rows))) (defun org-org--add-missing-sections (tree _backend _info) "Ensure each headline has an associated section. diff --git a/lisp/ox.el b/lisp/ox.el index 0ff845893..6e5302179 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -140,6 +140,7 @@ (:with-properties nil "prop" org-export-with-properties) (:with-smart-quotes nil "'" org-export-with-smart-quotes) (:with-special-strings nil "-" org-export-with-special-strings) + (:with-special-rows nil nil nil) (:with-statistics-cookies nil "stat" org-export-with-statistics-cookies) (:with-sub-superscript nil "^" org-export-with-sub-superscripts) (:with-toc nil "toc" org-export-with-toc) @@ -1838,7 +1839,9 @@ not exported." (and (org-export-table-has-special-column-p (org-element-lineage datum 'table)) (org-export-first-sibling-p datum options))) - (table-row (org-export-table-row-is-special-p datum options)) + (table-row + (unless (plist-get options :with-special-rows) + (org-export-table-row-is-special-p datum options))) (timestamp ;; `:with-timestamps' only applies to isolated timestamps ;; objects, i.e. timestamp objects in a paragraph containing only