Commit Graph

754 Commits

Author SHA1 Message Date
TEC 64d0d115af
ox: Introduce conditional/generated preamble
* lisp/ox.el (org-export-detect-features, org-export-expand-features,
org-export-generate-features-preamble): New functions for detecting
features and generating content based on them.
(org-export-conditional-features): Customisation for feature detection.
(org-export-as): Add detected to features to info in the slot :features.
(org-export-update-features): Add a convenience function for users to
edit the feature condition/implementation lists.
(org-export--annotate-info, org-export-detect-features,
org-export-define-derived-backend, org-export-define-backend,
org-export-conditional-features): Refactor backend feature
conditions/implementations into a struct field.  This allows for parent
inheritance to be properly managed, and leads into future work making
features more widely used in the export process.
(org-export-expand-features, org-export-resolve-feature-implementations,
org-export-generate-features-preamble,
org-export-expand-feature-snippets): The main functions for working with
export features.
(org-export-process-features, org-export-update-features): Introduce
`org-export-process-features' to simplify the application of features to
INFO.
2024-04-16 19:58:48 +08:00
Ihor Radchenko 78e9dd0c42
Fix when user customization makes Org dialogues pop up in new frames
* lisp/ol.el (org-insert-link):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
* lisp/org-attach.el (org-attach):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-goto.el (org-goto-location):
* lisp/org-macs.el (org-mks):
* lisp/org-table.el (org-table-fedit-finish):
* lisp/org.el (org-offer-links-in-entry):
* lisp/ox.el (org-export-dispatch): Arrange the dialogue window to be
killed when it is displayed in a new frame.
`save-window-configuration' is not enough in such scenarios.  Use
`quit-window' instead.
* lisp/org-table.el (org-table-edit-formulas): Prohibit popping up
table editor in a new frame.  This is because the major mode for
formula editing makes assumptions about where the editor window is
located and does not work reliably in a separate frame.

Reported-by: Björn Bidar <bjorn.bidar@thaodan.de>
Link: https://orgmode.org/list/87jzlcoxuq.fsf@
2024-04-10 15:42:52 +03:00
Ihor Radchenko 18fbb9985f
Honor `display-buffer-alist' when creating dialogues
* lisp/org-macs.el (org-display-buffer-split): New function to display
just the new buffer and current buffer visible in the frame.  To be
used as `display-buffer' ACTION parameter.
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
(org-agenda-fit-window-to-buffer):
(org-agenda-prepare-window):
(org-agenda-switch-to):
* lisp/org-capture.el (org-capture-place-template):
* lisp/org-goto.el (org-goto-location):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org.el (org-tree-to-indirect-buffer):
(org-fast-todo-selection):
(org-add-log-note):
(org-fast-tag-selection):
(org-submit-bug-report):
* lisp/ox.el (org-export--dispatch-ui): Get rid of calling
`delete-other-windows' manually.  Instead, make use of
`org-display-buffer-slip' + `pop-to-buffer'/`display-buffer'.  This
way, user overrides in `display-buffer-alist' are honored.
* lisp/org-plot.el (org-plot/gnuplot):
* lisp/org.el (org-offer-links-in-entry): When `delete-other-windows'
cannot be avoided, make it ignore errors in the frames where
displaying a lone window is forbidden.
2024-04-07 13:34:13 +03:00
Ihor Radchenko b45b393265
lisp/ox.el (org-export-table-row-is-special-p): Fix docstring
Special rows may not be ignored depending on :with-special-rows option.
2024-04-05 17:03:41 +03:00
Ihor Radchenko d72feeb09b
lisp/ox.el (org-export-table-row-number): Clarify docstring 2024-04-05 17:03:40 +03:00
Ihor Radchenko 33503445e6
org-export: Do not treat unpaired ' and " as smart quotes
* lisp/ox.el (org-export--smart-quote-status): When quotes are not
balanced, treat " literally and ' as apostrophes.
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Fix
test with unbalanced " and add new tests for unbalanced quotes.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://list.orgmode.org/orgmode/875xxfqdpt.fsf@posteo.net/
2024-03-24 12:53:11 +03:00
Ihor Radchenko ae50b94e0e
Merge branch 'bugfix' 2024-03-16 16:03:00 +03:00
Jan Zavitski c5ede53210
org-export-dictionary: Improve Estonian translation
* lisp/ox.el (org-export-dictionary): Add missing and improve
existing Estonian translation entries.
2024-03-16 16:02:14 +03:00
Ihor Radchenko 1cca1967e9
fixup! ox-org: Do not process citations by default
* lisp/ox.el (org-export-process-citations): Add missing defcustom keywords.
2024-02-14 15:36:51 +01:00
Ihor Radchenko 97cc71b594
lisp/org-element.el, lisp/ox.el: Add Ihor Radchenko as a maintainer
* lisp/org-element.el:
* lisp/ox.el:
2024-02-14 13:41:21 +01:00
Ihor Radchenko fd45bfa648
Acknowledge that Nicolas Goaziou is no longer maintaining Org libraries
* lisp/ox-ascii.el:
* lisp/ox-beamer.el:
* lisp/ox-icalendar.el:
* lisp/ox-md.el:
* lisp/ox-org.el:
* lisp/ox-publish.el:
* lisp/ox-texinfo.el:
* lisp/ox.el: Remove "Maintainer" line.
2024-02-14 13:41:21 +01:00
Ihor Radchenko b8ee1315a1
ox-org: Do not process citations by default
* lisp/ox.el (org-export-options-alist): Add new export option
:with-cite-processors that allows disabling citation processors.
(org-export-process-citations): New customization (t by default)
defining the default value of :with-cite-processors export option.
(org-export-as):
(org-export--annotate-info): Disable citation processors when
:with-cite-processors is nil.
* lisp/ox-org.el (org-org-with-cite-processors): New custom
option (nil by default) controlling whether to use citation processors
when exporting to Org.
(org): Set :with-cite-processors according to the new option.  Declare
transcoders for citation and citation-reference objects.
* doc/org-manual.org (Summary of the export process): Update the
export flow description.
* etc/ORG-NEWS (Org export backends can now disable citation processors):
(=ox-org= disables citation processors by default):
(New option ~org-export-process-citations~):
(New option ~org-org-with-cite-processors~): Document the changes.

The change in ox-org behavior also fixes citation objects being
removed unconditionally from table src block results.

Reported-by: Stanislav Vlasov <S.Vlasov@tilburguniversity.edu>
Link: https://orgmode.org/list/87edrin6jw.fsf@localhost
2024-02-14 13:16:57 +01:00
Ihor Radchenko f9fc9d95c7
org-export-as: Add reference to export flow in the manual
* lisp/ox.el (org-export-as): Update docstring.
2024-02-12 14:23:51 +01:00
Ihor Radchenko 6ff0de5c3e
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.
2024-02-12 12:55:37 +01:00
Ihor Radchenko ede8294cf7
lisp/ox.el: Fix removed variable in the commentary
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-31 14:05:30 +01:00
Ihor Radchenko ea529007d7
ox-html: Fix links to targets that do not have a number
* lisp/ox.el (org-export-get-ordinal): Return nil when ELEMENT does
not match PREDICATE.  `ox-html-link' expects this behavior when a link
refers to target that does not have a caption.
* testing/lisp/test-ox.el (test-org-export/get-ordinal): Fix tests.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/7bf1f79071a714750634e76130fe5963@posteo.net
2024-01-25 13:30:35 +01:00
Ihor Radchenko 78dc58508d
Obsolete org-switch-to-buffer-other-window and org-no-popups
* lisp/org-compat.el (org-switch-to-buffer-other-window):
(org-no-popups): Move from org-macs.el and mark obsolete.
* lisp/ob-lilypond.el (org-babel-lilypond-execute-tangled-ly):
(org-babel-lilypond-mark-error-line):
* lisp/ol.el (org-insert-link):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
(org-agenda-prepare-window):
(org-agenda-goto):
(org-agenda-open-link):
(org-agenda-clock-goto):
(org-agenda-diary-entry-in-org-file):
(org-agenda-add-entry-to-org-agenda-diary-file):
(org-agenda-show-the-flagging-note):
* lisp/org-attach.el (org-attach):
* lisp/org-capture.el (org-capture-place-template):
(org-capture-fill-template):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-macs.el (org-mks):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org-table.el (org-table-edit-field):
(org-table-edit-formulas):
(org-table-show-reference):
* lisp/org.el (org-fast-todo-selection):
(org-add-log-note):
(org-fast-tag-selection):
* lisp/ox.el (org-export-stack-view):
(org-export--dispatch-ui): Use `switch-to-buffer-other-window'.
* etc/ORG-NEWS (Org mode no longer disallows configuring
~display-buffer-alist~ to open Org popups in other frame): Document
the breaking change.

Reported-by: Jan Seeger
Link: https://orgmode.org/list/87pmr3mfq3.fsf@localhost
2024-01-24 15:00:26 +01:00
Ihor Radchenko 6dab5c317d
lisp/ox.el: Fix removed variable in the commentary
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/CADwFkmnsjEg+d7ty0bjT5RGQiS-SdKcvRUy+KHDh+maa92bp1w@mail.gmail.com
2024-01-22 12:25:04 +01:00
Ihor Radchenko 83696bf21f
org-export-activate-smart-quotes: Fix edge case with multiple secondary strings
* lisp/ox.el (org-export--smart-quote-status): Do not hash quote
status by parent syntax node - it will create clashes when parent has
multiple secondary strings.  Instead, hash by parent + secondary
string property.
* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes): Add
new test case.

Reported-by: William Denton <william@williamdenton.org>
Link: https://orgmode.org/list/TarY7-tR4TEmIu8jawOtTyyi03K93WIg7DsS1eXNylelCy2Hv-6OFNKOMQMukf70Tzf3uO_2F1Qe7xwrzb43SpJc4jxJZLN3W0MioKYbgzI=@williamdenton.org
2024-01-21 13:44:50 +01:00
Ihor Radchenko 38c6eb2b72
ox-latex: Do not use float for inline images inside links
* lisp/ox.el (org-export-insert-image-links): Fix call to
`org-element-set-contents' - setting "nil" literally would put an
actual nil element into contents.
* lisp/ox-latex.el (org-latex--inline-image): Do not use float
environment unless the inline image is a single image inside
paragraph.  The code is adapted with simplifications from
`org-html-standalone-image-p'.
* testing/lisp/test-ox-latex.el (test-ox-latex/inline-image): New
test.

Reported-by: Dr. Arne Babenhauserheide <arne_bab@web.de>
Link: https://orgmode.org/list/878rest3qv.fsf@localhost
2024-01-15 13:52:43 +01:00
Kyle Meyer 72a2db86d9 Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
Po Lu 9f1d6dfd73 Backport commit 8e1c56ae4 from Emacs
; Add 2024 to copyright years
8e1c56ae46754dd7baedff49a464f078f0e9912d
Po Lu
Tue Jan 2 09:47:10 2024 +0800
2024-01-06 15:48:23 -05:00
Ihor Radchenko 3afae6690f
org-element-with-buffer-copy, org-export-with-buffer-copy: Fix expansion
* lisp/org-element.el (org-element-with-buffer-copy):
* lisp/ox.el (org-export-with-buffer-copy): Make sure that keyword
arguments in the macro are not duplicated into BODY, which happens for
&rest body + &allow-other-keys in `cl-defmacro'.

Reported-by: João Távora <joaotavora@gmail.com>
Link: https://yhetil.org/emacs-devel/CALDnm53p7nXdnbA2PuH-VHL7EeGQUXYy3x_87hp3oj2pkyWS9Q@mail.gmail.com/
2023-12-25 15:50:04 +01:00
Ihor Radchenko 9ecee6f2e2
* lisp/ox.el (org-export-async-debug): Fix checkdoc warning 2023-11-01 12:48:43 +02:00
Ihor Radchenko a9e2a97ee3
org-export-ignored-local-variables: Add missing variables
This fixes ox-hugo bug when Org buffer copy cache is corrupted.

Reported-by: George Kettleborough <kettleg@gmail.com>
Link: https://orgmode.org/list/41acf96e-8f62-4ed5-9853-b4ff4e0e2fa9@gmail.com
2023-10-25 10:58:02 +03:00
Ihor Radchenko 7d90507420
Merge branch 'bugfix' 2023-10-15 11:12:34 +03:00
Ihor Radchenko 51937d4b13
* lisp/ox.el (org-export-to-file): Ensure final newline
The newline were added by default in the past, before d7a55bbd5.
Continue to add it to avoid changed behavior.

Reported-by: YE <yet@ego.team>
Link: https://orgmode.org/list/87wmvwklnq.fsf@localhost
2023-10-15 11:10:58 +03:00
Ihor Radchenko ec23993301
lisp/ox.el: Ignore case when matching headings and targets
* lisp/ox.el (org-export-search-cells):
(org-export-string-to-search-cell): Ignore case in headline titles and
radio targets.
* testing/lisp/test-ox.el (test-org-export/fuzzy-link): Add new test.

ox.el implements an independent link resolution mechanism that is not
fully consistent with ol.el.  In particular, radio links, when
resolved via `org-export-resolve-link' (unlike
`org-export-resolve-radio-link'), were previously case-sensitive, in
contrast with ol.el, which is case-insensitive.  Similarly, headline
matching by fuzzy links had inconsistency between `org-link-search'
and what ox.el does.

Link: https://orgmode.org/list/m2cyxl3qd0.fsf@me.com
2023-10-14 11:45:57 +03:00
Ihor Radchenko ad07b2982f
fixup! org-element-parse-secondary-string: Prevent altering current buffer cache 2023-10-10 15:05:25 +03:00
Ihor Radchenko 37d6bde27f
org-element-parse-secondary-string: Prevent altering current buffer cache
* lisp/org-element.el (org-element-ignored-local-variables):
* lisp/ox.el (org-export-ignored-local-variables):
* lisp/org-compat.el (org-export-ignored-local-variables): Rename and
move to org-element.el.  Declare the old name obsolete.
* lisp/org-element.el (org-element--generate-copy-script):
* lisp/ox.el (org-export--generate-copy-script): Rename and move to
org-element.el.
* lisp/org-element.el (org-element-copy-buffer):
(org-element-with-buffer-copy): New function and macro like
`org-export-copy-buffer' and `org-element-with-buffer-copy', but not
processing #+bind keywords.
(org-element-parse-secondary-string): Use
`org-element-with-buffer-copy' that takes care about not copying
element cache object by reference and thus not modifying that cache if
the buffer happens to be modified.
* lisp/ox.el (org-export--set-variables): New helper function that
sets an alist of variable/value pairs in current buffer.
(org-export-copy-buffer): Make use of `org-element-copy-buffer'.
(org-export-with-buffer-copy): Make use of
`org-element-with-buffer-copy'.

Reported-by: Edgar Lux <edgarlux@mailfence.com>
2023-10-10 13:53:07 +03:00
Ihor Radchenko c2594e7456
fixup! * lisp/ox.el (org-export-dictionary): Add Polish translation 2023-09-10 11:26:06 +03:00
Emacs User 7de89d0a42
* lisp/ox.el (org-export-dictionary): Add Polish translation
TINYCHANGE
2023-09-10 11:01:32 +03:00
Ihor Radchenko f299fbbbb0
org-export--prepare-file-contents: Drop redundant `save-match-data'
`save-match-data' is costly.  We should not use it unless necessary.
2023-08-26 14:29:17 +03:00
Ihor Radchenko 5ff5ac03b6
* lisp/ox.el (org-export-parse-include-value): Remove `save-match-data'
Avoid using GC-expensive `save-match-data'.
2023-08-25 14:13:23 +03:00
Ihor Radchenko 7bdec435ff
org-export-expand-include-keyword: Drop unnecessary call to `save-match-data'
* lisp/ox.el (org-export-expand-include-keyword): Do not wrap
`org-element-at-point' into `save-match-data'.  The search data from
`re-search-forward' is unused in the code and `save-match-data' call
is costly.
2023-08-24 15:10:32 +03:00
Ihor Radchenko 570cdacdbf
org-export-smart-quotes-alist: Turn into a custom option
* lisp/ox.el (org-export-smart-quotes-alist): Change to `defcustom'.
Fix typo in the value.  Add :type/:package-version/:group definitions.
* etc/ORG-NEWS (~org-export-smart-quotes-alist~ is now a custom
option): Announce the change.

Link: https://orgmode.org/list/871qg5bnfh.fsf@bzg.fr
2023-08-15 14:16:41 +03:00
Bastien 73cb528c24 Merge branch 'bugfix' 2023-08-04 13:08:25 +02:00
Juan Manuel Macias 07f099f84e lisp/ox.el: Fix inner smart quotes in French
* (org-export-smart-quotes-alist): Add correct French second level
quotation marks.
2023-08-04 13:03:03 +02:00
Ihor Radchenko f409cb4e52
ox: New option `org-export-expand-links'
* lisp/ox.el (org-export-options-alist): New export option toggling
environment variable expansion in link paths.
(org-export-expand-links): New customization.
(org-export--expand-links): New function expanding environment
variables all the link paths in AST.
(org-export-expand-include-keyword):
(org-export--blindly-expand-include): Add new optional arguments to
expand environment variables in INCLUDE file paths.  Update
docstrings.
(org-export--annotate-info): Call `org-export--expand-links' during
export and pass :expand-links parameter to
`org-export-expand-include-keyword'.
* doc/org-manual.org (Export Settings): Document the new option.
* etc/ORG-NEWS (New export option ~org-export-expand-links~): Announce
new option.

Link: https://list.orgmode.org/orgmode/87pm6fbnlo.fsf@localhost/
2023-07-31 11:24:40 +03:00
Ihor Radchenko 2452f5de6d
org-export-get-all-transcoders: Fix when :parent is not symbol
* lisp/ox.el (org-export-get-all-transcoders): Handle :parent backend
not being symbol.
2023-07-29 11:26:03 +03:00
Ihor Radchenko 1967aa43e5
org-src-preserve-indentation: Refactor handling src block flags
* lisp/org-src.el (org-src-preserve-indentation-p): New function
checking whether block should preserve indentation.  This function
abstracts away the check for block type, indentation flag, and
customized `org-src-preserve-indentation' value.
(org-src--edit-element):
* lisp/ob-core.el (org-babel--normalize-body):
(org-babel-read-element):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-element.el (org-element-example-block-interpreter):
(org-element-src-block-interpreter):
* lisp/org.el (org-fixup-indentation):
(org-indent-region):
* lisp/ox.el (org-export-unravel-code): Use the new function instead
of duplicating code.

* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Add FIXME.  We
do not have access to the block element here and cannot easily check
the flag.

* lisp/ob-tangle.el (org-babel-tangle-single-block):
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org.el (org-indent-line): Check block flag in addition to `org-src-preserve-indentation'.

This commit unifies logic deciding whether to preserve block
indentation into a single place to avoid confusion.
2023-07-13 11:51:15 +03:00
Ihor Radchenko f93d855c51
Prefer `forward-line' over `beginning-of-line'
The latter is much slower.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#98
2023-07-01 14:36:14 +03:00
Ihor Radchenko bc29f5de41
org-element: New `org-element-*property*' functions
* lisp/org-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties.  The functions are `setf'-able.

Update all the relevant code in Org to use the new functions instead
of genetic property queries.
2023-07-01 14:35:43 +03:00
Ihor Radchenko 81a7e8c836
org-element-lineage: Allow TYPES to be a symbol
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument
to be a symbol.
* lisp/ox-ascii.el (org-ascii--current-text-width):
(org-ascii-format-inlinetask-default):
(org-ascii-section):
* lisp/ox-beamer.el (org-beamer--format-block):
* lisp/ox-html.el (org-html-section):
(org-html-table-cell):
(org-html-table-row):
* lisp/ox-latex.el (org-latex-table-cell):
(org-latex-table-row):
* lisp/ox-odt.el (org-odt-headline):
(org-odt-table-style-spec):
(org-odt-get-table-cell-styles):
(org-odt-table-cell):
(org-odt-table-row):
* lisp/ox-org.el (org-org-section):
* lisp/ox-publish.el (org-publish-collect-index):
* lisp/ox-texinfo.el (org-texinfo--get-node):
(org-texinfo-section):
(org-texinfo-table-row):
* lisp/ox.el (org-export--skip-p):
(org-export-get-node-property):
(org-export-table-cell-borders):
(org-export-table-row-in-header-p):
(org-export-table-row-number):
(org-export-collect-headlines): Update all the callers.
2023-07-01 14:35:43 +03:00
Ihor Radchenko 2d22d7f515
ox.el: Rename `org-element-get-parent-element' and move to org-element
* lisp/org-element.el: Rename `org-element-get-parent-element' to
`org-element-parent-element'.
* lisp/org-compat.el (org-export-get-parent-element):
* lisp/ox.el (org-export-get-parent-element): Remove, adding obsolete
alias.
(org-export--skip-p):
* lisp/org-table.el:
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-footnote-reference):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-format-label):
(org-odt-link--inline-image):
(org-odt-link--inline-formula):
* lisp/ox-texinfo.el (org-texinfo--inline-image): Update all the
callers.
2023-07-01 14:35:42 +03:00
Ihor Radchenko ea4f4fdf58
Rename `org-export-get-parent' to `org-element-parent' 2023-07-01 14:35:41 +03:00
Ihor Radchenko a43cc8c9aa
org-export-get-node-property: Use `org-element-property-inherited' 2023-07-01 14:35:40 +03:00
Ihor Radchenko 44baf8f2b8
org-element-parse-buffer: New optional argument to not force undefer
* lisp/org-element.el (org-element-parse-buffer): Do not force-undefer
when new optional argument is provided.
* lisp/org-lint.el (org-lint--generate-reports):
* lisp/org.el (org-unindent-buffer):
* lisp/ox.el (org-export--missing-definitions):
(org-export--annotate-info): Do not undefer when unnecessary.

Adjust all the declare forms.
2023-07-01 14:35:37 +03:00
Ihor Radchenko a7d1dfa171
Use `org-element-type-p'
Use `org-element-type-p' across Org source, except some tests, where `eq' can
produce more meaningful failure explanations.
2023-07-01 14:35:35 +03:00
Ihor Radchenko c22697f472
Use new function names `org-element-extract' and `org-element-set' 2023-07-01 14:35:32 +03:00