Commit Graph

19761 Commits

Author SHA1 Message Date
TEC 239f3bab04
org-latex-preview: Use prefix more consistently
* lisp/ox-odt.el (org-odt--translate-latex-fragments): Use renamed
org-latex-preview-* functions/variables.

* lisp/ox-html.el (org-html-latex-fragment, org-html-latex-environment,
org-html-format-latex, org-html-with-latex): Use renamed
org-latex-preview-* functions/variables.

* lisp/org.el (org-compute-latex-and-related-regexp,
org-latex-packages-alist): Use renamed org-latex-preview-*
functions/variables.

* lisp/org-latex-preview.el (org-dvipng-color, org-create-formula-image,
org--get-display-dpi, org-create-latex-export,
org-preview-latex--tex-styled, org-preview-precompile,
org-latex-preview--place-images, org-latex-preview--generic-callback,
org-latex-preview--image-extract-async,
org-preview-latex--create-tex-file, org-create-formula-image-async,
org-create-latex-preview, org-format-latex, org-latex-preview-fragments,
org-latex-replace-fragments, org-latex-preview,
org--latex-preview-region, org-clear-latex-preview,
org-latex-preview--handle-insert,
org-latex-preview--close-previous-overlay,
org-latex-preview--handle-post-cursor, org--make-preview-overlay,
org-latex-preview-auto-generate-p, org-preview-use-precompilation,
org-format-latex-header, org-preview-latex-process-alist,
org-preview-latex-default-process, org-format-latex-signal-error,
org-format-latex-options): Use renamed org-latex-preview-*
functions/variables.  Use the org-latex-preview group instead of
org-latex for preview-related variables.

* lisp/org-compat.el: Add entries for renamed and obsoleted
org-latex-preview-* functions/variables.

* lisp/ob-latex.el (org-babel-execute:latex, org-format-latex-header)):
Use renamed org-latex-preview-* functions/variables.

* doc/org-manual.org (Footnotes, Previewing LaTeX fragments, LaTeX
fragments): Use renamed org-latex-preview-* functions/variables.

org-latex-preview: clear overlays name

* lisp/org-latex-preview.el (org-clear-latex-preview):
2024-04-16 19:58:49 +08:00
TEC 0b16419f21
org-latex-preview: Basic error indication
* lisp/org-latex-preview.el (org-latex-preview--tex-compile-async,
org-latex-preview--latex-preview-filter): Search the latex compilation
stdout for fragment error messages via a process filter, and record any
found.
(org-latex-preview--display-info): Save the :error field of fragments.
(org--make-preview-overlay): When showing an SVG that has an error, use
the error face.
(org-preview-latex--tex-styled): Make any generated styling directives
take up exactly one line in all situations, so the fragment-relative
line numbers can easily be worked out in
`org-latex-preview--latex-preview-filter'.
2024-04-16 19:58:49 +08:00
TEC d528301806
org-latex-preview: Filter dvisvgm process for info
* lisp/org-latex-preview.el (org-latex-preview--display-info,
org-latex-preview--cleanup-callback, org-create-formula-image-async,
org--make-preview-overlay): Apply a filter to the dvisvgm process in
order to place overlays as images are produced, and along the way
extract size and baseline information that is used to more accurately
position the overlay image.  Because `org-latex-preview--place-images'
is now run within a filter and hence the stdout buffer, we need to
record the org buffer and switch to it before placing overlays.
(org-latex-preview--image-extract-async): Record the DPI-based scaling
factor so it can be accounted for when calculating the pt-scale fragment
height/width/depth.
(org-latex-format-options): Introduce a new parameter :zoom for
affecting the display scaling of images with associated height
resolution, but unlike :scale not the resolution/size of the images
files themselves.  This is then used in `org--make-preview-overlay'.
2024-04-16 19:58:49 +08:00
TEC cb225ab2f2
org-latex-preview: Use a fragment info plists
* lisp/org-latex-preview.el (org-latex-preview--cleanup-callback,
org-create-formula-image-async, org-create-latex-preview): Instead of
using lists of the same length for fragment information, use a single
list of fragment information plists.  This allows for more information
to be stored/used without ending up with half a dozen disparate lists
that we rely on lining up.
2024-04-16 19:58:49 +08:00
TEC 9ecfa904a2
org-latex-preview: Use org-persist for caching
* lisp/org-latex-preview.el
(org-latex-preview--cache-image, org-latex-preview--get-cached):
Implement image data save/retrieve functions using org-persist.
(org-place-latex-image, org-create-latex-export,
org-latex-preview--cleanup-callback, org-create-formula-image-async,
org-create-latex-preview, org--make-preview-overlay): Use the new model
of image data caching relying on org-persist.
2024-04-16 19:58:49 +08:00
Karthik Chikmagalur 8af5751ff2
org-latex-preview: Make image optional in overlay
* lisp/org-latex-preview.el (org-make--preview-overlay): Supplying an
image file when creating a latex preview overlay is now optional.
This change is in preparation for fully-automatic preview generation,
which requires "dummy" overlays to be placed on latex fragments that
have not yet been fully inserted or previewed.
2024-04-16 19:58:49 +08:00
Karthik Chikmagalur 69265adff0
org-latex-preview: Add imagemagick support
* lisp/org-latex-preview.el (org-preview-latex-process-alist,
org-preview-latex--create-tex-file, org-preview-precompile):
Add a new entry `:latex-precompiler' to
`org-preview-latex-process-alist', and tweak imagemagick-specific
`:image-converter' entries.  The function `org-preview-precompile' now
accepts two arguments.  Extra processing info is used to find the
right precompilation command.
2024-04-16 19:58:48 +08:00
TEC 7bc9de054a
org-macs: Rework async filter
* lisp/org-macs.el (org-async--filter, org-async-call): Expose :info to
the async filter function, and make the obvious modifications to the
process buffer content.
2024-04-16 19:58:48 +08:00
TEC fe5712eac8
org-macs: Accept nested org-async callbacks
* lisp/org-macs.el (org-async--execute-callback, org-async-call): Change
the org-async call arguments callback form to start with the symbol
org-async-task.  This allows for a list of callbacks to be
differentiated from a single callback.  `org-async-call' is also
extended to accept a a callback of this form as its sole argument.

* lisp/org-latex-preview.el (org-latex-preview--image-extract-async,
org-latex-preview--tex-compile-async, org-create-formula-image-async):
Use the new async callback form.
2024-04-16 19:58:48 +08:00
TEC 1223971314
org-latex-preview: use currentColor in SVGs
* lisp/org-latex-preview.el (org-place-latex-image,
org-create-formula-image-async, org--make-preview-overlay,
org-latex-preview--dvisvgm-callback): Edit the dvisvgm generated SVGs to
use "currentColor" instead of a hardcoded foreground color.  To then set
the color of the displayed images, set the overlay face as appropriate.
(org-create-latex-preview): Now that the foreground is generalised, when
producing the sha1 hash for an SVG image, the current foreground value
should not affect it.
2024-04-16 19:58:48 +08:00
TEC c230fef02b
org-latex-preview: Run dvipng concurrently
* lisp/org-latex-preview.el (org-create-formula-image-async): When using
dvipng with the "--follow" flag, image processing can occur
concurrently, so we may as well check for this case and start it
concurrently when this occurs.
2024-04-16 19:58:48 +08:00
TEC 82ac33c1d7
org-latex-preview: Refactor async formula function
* lisp/org-latex-preview.el (org-create-preview-string,
org-create-latex-preview, org-latex-replace-fragments,
org-create-formula-image-async): Refactor
`org-create-formula-image-async', specifically by splitting up the
texfile creation, texfile compilation, image extraction, and cleanup
phases into individual functions (`org-preview-latex--create-tex-file',
`org-latex-preview--tex-compile-async',
`org-latex-preview--image-extract-async',
`org-latex-preview--cleanup-callback') and use `org-async-call' for
managing async.  Along the way a few other minor tweaks have crept in.
2024-04-16 19:58:48 +08:00
Karthik Chikmagalur af24131046
org-latex-preview: Add preamble precompilation
* lisp/org-latex-preview.el (org-create-formula-image-async): Change
how the latex header is computed to account for precompiled headers.
(org-preview-use-precompilation): Boolean to control if
header/preamble precompilation is enabled when generating latex
previews.  If enabled, previewing will be much faster at the expense
of a slower first run.
(org-preview-precompile): This function creates precompiled dumps of
latex preambles/headers, and is intended for use with
`org-create-formula-image-async'.
2024-04-16 19:58:48 +08:00
Karthik Chikmagalur b47f2b23a8
org-latex-preview: Change default latex command
* lisp/org-latex-preview.el (org-preview-latex-process-alist,
org-create-formula-image-async): Change the default latex command to
include the input file name.  Previously the input file was introduced
via process input for compatibility with preview.sty directives.  But
it appears that it's possible to simply set \RequirePackage{preview}
in the latex header without issues.
2024-04-16 19:58:48 +08:00
TEC a8f433c31b
org-latex-preview: Get face from char before latex
* lisp/org-latex-preview.el (org-create-latex-preview): Instead of
getting the face using `face-at-point' use `get-text-property' on the
position one before the start of the LaTeX fragment.  This ensures that
the face is that of the parent element rather than the LaTeX fragment.
2024-04-16 19:58:48 +08:00
Karthik Chikmagalur 3f9cfd7849
org-latex-preview: Add async image previews
* lisp/org-latex-preview.el (org-latex-preview-fragments): Collect and
send all fragments to be processed in a single pass.

(org-create-latex-preview): Apply cached previews and send the
other fragments to be generated asynchronously.

(org-create-formula-image-async): Generate latex preview
images asynchronously and apply them to the buffer.

(org-create-preview-string): Helper function that accepts a math
fragment and returns a latex snippet suitable for use with
preview.sty. Respects color preferences.
2024-04-16 19:58:48 +08:00
TEC e827bb8a24
org-latex-preview: Collect math fragments in fun
* lisp/org-latex-preview.el (org-latex-preview-fragments,
org-latex-replace-fragments, org-latex-collect-fragments): Introduce a
new function to collect all LaTeX math fragments in a
region (`org-latex-collect-fragments') and use it in
`org-latex-preview-fragments' and `org-latex-replace-fragments'.
2024-04-16 19:58:48 +08:00
TEC 712f97aaaf
org-latex-preview: Split org-create-latex-preview
* lisp/org-latex-preview.el (org-create-latex-preview,
org-create-latex-export): Split the export and preview functionality of
`org-create-latex-preview' into two functions: a rewritten
`org-create-latex-preview' that now /only/ deals with previews, and
`org-create-latex-export' for exports.
(org-latex-preview-fragments): Use the new `org-create-latex-preview`.
(org-latex-replace-fragments): Use the new `org-create-latex-export`.
2024-04-16 19:58:48 +08:00
TEC 9edfc99fda
org-latex-preview: Split org-format-latex into two
* lisp/org-latex-preview.el (org-format-latex, org-create-latex-preview,
org-latex-replace-fragments): The rather large `org-format-latex'
function mixed the preview and export code paths together in rather
confusing way.  This has now been split into
`org-latex-replace-fragments' for export, and
`org-latex-preview-fragments' for in-buffer previews.
(org--latex-preview-region): Replace `org-format-latex' with the more
specific `org-latex-preview-fragments'.
(org-latex-tentative-math-re): Instead of let-binding the math regexp,
use a const and explain its usage.

* lisp/ox-odt.el (org-odt--translate-latex-fragments): Replace
`org-format-latex' with the more specific `org-latex-replace-fragments`.

* lisp/ox-html.el (org-html-format-latex): Replace `org-format-latex'
with the more specific `org-latex-replace-fragments`.
2024-04-16 19:58:48 +08:00
TEC 3b9b87548b
org-latex-preview: Split org-place-formula-image
* lisp/org-latex-preview.el (org-create-latex-preview,
org-place-formula-image, org-place-latex-image,
org-place-latex-image-link): Replace `org-place-formula-image' with two
functions, one for overlays (`org-place-latex-image') and another for
links (`org-place-latex-image-link').
2024-04-16 19:58:48 +08:00
TEC ae09ab8ebe
org-latex-preview: Split org-format-latex into two
* lisp/org-latex-preview.el (org-create-latex-preview,
org-format-latex): Split `org-format-latex' into two, creating a new
function for the `cond' branch that deals with
`org-preview-latex-process-alist'.
2024-04-16 19:58:48 +08:00
TEC c591dda62a
org.el: Relocate LaTeX preview code to new file
* lisp/org.el (org-format-latex-options, org-format-latex-signal-error,
org-latex-to-mathml-jar-file, org-latex-to-mathml-convert-command,
org-latex-to-html-convert-command, org-preview-latex-default-process,
org-preview-latex-process-alist, org-preview-latex-image-directory,
org-format-latex-header, org-format-latex-mathml-available-p,
org--make-preview-overlay, org-clear-latex-preview,
org--latex-preview-region, org-latex-preview, org-format-latex,
org-place-formula-image, org-create-math-formula,
org-format-latex-as-mathml, org-format-latex-as-html,
org--get-display-dpi, org-create-formula-image, org-dvipng-color,
org-dvipng-color-format, org-latex-color, org-latex-color-format,
org-normalize-color): Move to org-latex-preview.el.

* lisp/org-latex-preview.el: A new home for code related to the
generated of in-buffer previews of LaTeX fragments.
2024-04-16 19:58:48 +08:00
TEC 72ba4116eb
ox-latex: Call compilation commands asynchronously
* lisp/ox-latex.el (org-latex-compile): Make use of the new
`org-async-call' to call compilation commands asynchronously.

When running ox-export via the command line, the expectation is the
Emacs process will not exit until the export has completed.  This
assumption is violated with async export, so when the current Emacs
session is `noninteractive' we go back to the previous (synchronously)
method of compiling.
2024-04-16 19:58:48 +08:00
TEC 6b6aff2ef2
org-macs: Add an async command execution system
* lisp/org-macs.el (org-async--stack, org-async--wait-queue,
org-async-process-limit, org-async-timeout,
org-async-check-timeout-interval, org-async--counter, org-async-call,
org-async--sentinel, org-async--cleanup-process,
org-async--execute-callback, org-async--monitor-scheduled,
org-async--monitor): Introduce an asynchronous command execution system.
2024-04-16 19:58:48 +08:00
TEC 8bc2742d29
oc-*: Make use of conditional preamble for export
* lisp/oc-natbib.el (org-cite-natbib-use-package): Refactor to make use
of the conditional/generated preamble.

* lisp/oc-csl.el (org-cite-csl-finalizer): Refactor to make use of
the conditional/generated preamble.

* lisp/oc-biblatex.el (org-cite-biblatex-prepare-preamble): Refactor to
make use of the conditional/generated preamble.
2024-04-16 19:58:48 +08:00
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
TEC c737d6ed77
org-compat: Add ensure-list as org-ensure-list
* lisp/org-compat.el (org-ensure-list): Add `ensure-list' from Emacs 28,
as `org-ensure-list'.
2024-04-16 19:58:48 +08:00
Ihor Radchenko 1ae978f940
Merge branch 'bugfix' 2024-04-15 14:19:50 +03:00
Ihor Radchenko 4ae5cc0182
org-self-insert-command: Prevent deleting selection for speed commands
* lisp/org.el (org--speed-command-p): New helper function checking
whether current command is a speed command.
(org-self-insert-command): Use the new helper.
* lisp/org.el: In `delete-selection' property of
`org-self-insert-command' symbol, signal that selection must not be
deleted when current command is a speed command.

Reported-by: Joe Gilder <joe@homestudiocorner.com>
Link: https://orgmode.org/list/87il0voeok.fsf@localhost
2024-04-15 14:17:17 +03:00
Ihor Radchenko b03ece433b
org-fold: Optimize fontification of link folds
* lisp/org-fold-core.el (org-fold-core--specs): Add new folding spec -
:font-lock.  When non-nil, enable re-fontification of the folds.
(org-fold-core-region): Only trigger re-fontification when the folding
spec has :font-lock property.
* lisp/org-fold.el (org-fold-initialize): Only enable re-fontification
of folded outlines, drawers, and blocks.
2024-04-15 11:53:59 +03:00
Ihor Radchenko 17072a4690
Allow clock elements without timestamp, like CLOCK: => 12:00
This syntax has been introduced in Org 4.78, but not supported later,
when Org element parser have been created.  Fix this omission to not
remove an existing (and announced!) feature.

This kind of clock is of limited use though - all the customizations
relying upon knowing _when_ clocking time was recorded, like ranges in
clock tables or limits on the displayed clocked-in time, will include
such clocks unconditionally.  So, not adding this to the manual, as it
is not very clear how to use it in actual workflow.

* lisp/org-element.el (org-element-clock-line-re): Update the regexp.
(org-element-clock-parser): Do not assume that timestamp always
follows CLOCK: line.
* testing/lisp/test-org-element.el (test-org-element/clock-parser):
(test-org-element/clock-interpreter): Add tests checking parser and
interpreter output of clocks without timestamps.

Link: https://orgmode.org/list/87frvpyzrf.fsf@localhost
2024-04-14 15:46:15 +03:00
Ihor Radchenko b42867b5a1
org-html-toc: Fix duplicate ids when there are multiples TOCs
* lisp/ox-html.el (org-html-toc): When multiple TOCs are generated
inside the exported document, make sure that they do not have
duplicate IDs.

Reported-by: Michel Damiens <michel.damiens@gmail.com>
Link: https://orgmode.org/list/87sfj6av4t.fsf@localhost
2024-04-14 13:34:13 +03:00
Ihor Radchenko 4d3b216b83
Merge branch 'bugfix' 2024-04-13 15:50:01 +03:00
Ihor Radchenko 6cb088972f
org-link-open-as-file: Do not try dired wildcard expansion when file exists
* lisp/ol.el (org-link-open-as-file): When PATH points to an existing
file and contains wildcard chars, do not try to list all the files in
`dired'.

Reported-by: Edgar Lux <edgarlux@mailfence.com>
Link: https://orgmode.org/list/1294251072.453751.1712943418634@ichabod.co-bxl
2024-04-13 15:47:18 +03:00
Ihor Radchenko 08c047a507
Merge branch 'bugfix' 2024-04-12 21:03:36 +03:00
Lei Zhe 5128460f94
org-table-header-line-mode: Fix when cursor is outside table
* lisp/org-table.el (org-table-header-set-header): Display table
header even when the point is below the table, as long as the table is
visible at the top of the window.
2024-04-12 21:01:49 +03:00
Ihor Radchenko c274128997
org-table-eval-formula: Keep empty result in duration (;TtU) mode
* lisp/org-table.el (org-table-eval-formula): When using T, t, or
U (duration) mode, do not convert empty results into duration.  This
is to keep things consistent with default mode.

Reported-by: Jeff Trull <edaskel@att.net>
Link: https://list.orgmode.org/orgmode/CAF_DUeEFpNU5UXjE80yB1MB9xj5oVLqG=XadnkqCdzWtakWdPg@mail.gmail.com/
2024-04-12 15:07:02 +03:00
Ihor Radchenko 096ecc9e24
Update version number for the 9.6.26 release 2024-04-12 09:53:47 +03:00
Morgan Smith 66e307b411
lisp/org-element.el: Add repeater-deadline support to org-element
* lisp/org-element.el (org-element-timestamp-parser,
org-element-timestamp-interpreter): Add support for repeater
deadlines.  Adds two new properties: ':repeater-deadline-value' and
':repeater-deadline-unit'.

* testing/lisp/test-org-element.el (test-org-element/timestamp-parser,
test-org-element/timestamp-interpreter): Test support for repeater
deadlines.

* etc/ORG-NEWS: Add relevant news.
2024-04-11 16:17:40 +03:00
Ihor Radchenko ead3f99901
Fix regression after 72b0e9ff0
* lisp/ox-html.el (org-html-link): Fix code branches assuming that
PATH variable strips link type.

Reported-by: Daniel Clemente <n142857@gmail.com>
Link: https://orgmode.org/list/CAJKAhPD=eMR2Tw3rsufPw_T6eEexpcHP=6PXKw3fLDtB2Z7qNg@mail.gmail.com
2024-04-10 17:02:01 +03:00
Ihor Radchenko 093b21c8c3
org-latex--caption/label-string: Add comment 2024-04-10 16:36:10 +03: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 129a18abf3
org-timer-set-timer: Fix when called from agenda buffer
* lisp/org-timer.el (org-timer-set-timer): Get effort minutes from
agenda entry line when in agenda buffer.

Reported-by: Bhavin Gandhi <bhavin7392@gmail.com>
Link: https://orgmode.org/list/CAOn=hbez7-4wFG2M1-MSHqAwvV0mysvLAUYP9_GK6mrSbtz3CQ@mail.gmail.com
2024-04-10 11:49:55 +03:00
Ihor Radchenko 85389da8cf
Merge branch 'bugfix' 2024-04-10 11:18:25 +03:00
Ihor Radchenko 42cdf2a90e
org-emphasis-alist: Clarify that emphasis markers cannot be changed
* lisp/org.el (org-emphasis-alist): Update the docstring, clarifying
that emphasis markers cannot be changed to arbitrary markers.

Link: https://orgmode.org/list/m3il0pac42.fsf@sina.com
2024-04-10 11:17:03 +03:00
Ihor Radchenko 9d636473be
fixup! lisp/ob-emacs-lisp.el: Throw an error when session is requested 2024-04-09 16:35:44 +03:00
Ihor Radchenko d1c6f91ced
lisp/ob-emacs-lisp.el: Throw an error when session is requested
* lisp/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): When :session
is provided, signal error - sessions are not supported.
(org-babel-prep-session:emacs-lisp): Signal error when trying to
switch to session.

Reported-by: Adam Sneller <adam@earth2adam.com>
Link: https://orgmode.org/list/871qoe8k9e.fsf@localhost
2024-04-09 16:22:00 +03:00
Ihor Radchenko 029d85dcca
Merge branch 'bugfix' 2024-04-09 14:07:28 +03:00
Ihor Radchenko 67ec699769
org-dblock-write:columnview: Fix when :id file:foo.org is not open
* lisp/org-colview.el (org-dblock-write:columnview): Fix generating
columnview when :id point to a file that is not yet open in Emacs.
Just open it as needed.

Reported-by: Vlastimil Vondra <vlastimil.vondra@gmail.com>
Link: https://orgmode.org/list/CACjq+cwjyi-d_jFY9oVe_kviMfLqm4t3+DVtr_Qk_kZaZt7ncA@mail.gmail.com
2024-04-09 14:04:02 +03:00
Ihor Radchenko 6d864526b7
org-offer-links-in-entry: Kill *Select Link* buffer on C-g
* lisp/org.el (org-offer-links-in-entry): When selection is aborted
via C-g, kill *Select Link* buffer.  This is useful when the location
of the buffer is customized via `display-buffer-alist' to be not in
the same frame - then, `save-window-configuration' is not enough get
rid of the temporary window.
2024-04-07 16:03:10 +03:00
Ihor Radchenko be80f4319f
fixup! Honor `display-buffer-alist' when creating dialogues
Fix Emacs <29 compatibility.
2024-04-07 16:02:35 +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
Sławomir Grochowski cc3a13c1fe
lisp/org-colview.el: Add defcustom `org-columns-checkbox-allowed-values'
* lisp/org-colview.el Add defcustom
`org-columns-checkbox-allowed-values'.
(org-columns-next-allowed-value): Introduce variable
`org-columns-checkbox-allowed-values'.

This would allow to use more than two states ("[ ]", "[X]") in columns
with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").  For example
you can add an intermediate state ("[-]").  Or empty state ("") to
remove checkbox.

* etc/ORG-NEWS: New option ~org-columns-checkbox-states~.
2024-04-06 15:54:35 +03:00
Ihor Radchenko ea6296a4d9
Consistently label fold types when `org-fold-core-style' is 'overlays
* lisp/org-clock.el (org-clock-find-position):
* lisp/org-compat.el (org-flag-drawer):
* lisp/org-src.el (org-edit-src-exit):
* lisp/org.el (org-log-beginning): Do not force 'outline folds when
`org-fold-core-style' is 'overlays.  The erroneous logic dates back to
the time when all the folding was done via 'outline folds to save up
on the number of overlays in buffer.  This is not longer the case -
newer Emacs no longer struggle with number of overlays and we fall
back to using text properties in older Emacs.

Reported-by: Bruno Cardoso <cardoso.bc@gmail.com>
Link: https://orgmode.org/list/87sezzmd1m.fsf@gmail.com
2024-04-06 15:21:10 +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 b2827aed98
org-dblock-write:columnview: Write width specifications
* lisp/org-colview.el (org-dblock-write:columnview): When writing
table, write width specifications as well and apply them.
* testing/lisp/test-org-colview.el (test-org-colview/dblock): Add
test.
* etc/ORG-NEWS (=colview= dynamic block now writes column width
specifications): Document the change.

Link: https://orgmode.org/list/87r1015w30.fsf@localhost
2024-04-05 14:14:04 +03:00
Ihor Radchenko d491a74fd9
fixup! lisp/ox-odt.el (org-odt-table): Add FIXME comment 2024-04-05 13:19:58 +03:00
Ihor Radchenko 95b494a862
lisp/ox-odt.el (org-odt-table): Add FIXME comment 2024-04-05 13:17:27 +03:00
Ihor Radchenko ef43642874
lisp/ox-odt.el (org-odt-item): Fix table hack inside nested list
* lisp/ox-odt.el (org-odt-item): When exporting table inside a list,
fix scenario when the table is located inside a sub-list of another
list.

Reported-by: Christian Moe <mail@christianmoe.com>
Link: https://orgmode.org/list/87edxn9z7n.fsf@localhost
2024-04-05 13:17:23 +03:00
Ihor Radchenko 9bff93f19a
Update version number for the 9.6.25 release 2024-04-05 10:29:48 +03:00
Stefan Monnier 90045c45e2
org-element--cache-after-change: Remove redundant setq
* lisp/org-element.el (org-element--cache-after-change):
`org-element--cache-after-change' already changes
`org-element--cache-change-warning' by side effect.  No need to assign
it.
2024-04-04 20:11:04 +03:00
Ihor Radchenko c8d1338365
org-html-htmlize-generate-css: Do not omit faces without :inherit property
* lisp/ox-html.el (org-html-htmlize-generate-css): Fix not adding
faces without :inherit property to the generated css.  Update the
docstring, detailing that the css class names are the face names with
`org-html-htmlize-font-prefix' prepended.
2024-04-04 14:18:37 +03:00
Ihor Radchenko ce5e8ecbb8
Prioritize underline over subscript inside parenthesis
* lisp/org-element.el (org-element--object-lex): Prioritise underline
parser over subscript.  `org-element-underline-parser' is more strict
compared to `org-element-subscript-parser'.
* testing/lisp/test-org-element.el (test-org-element/underline-parser):
Add test.
* etc/ORG-NEWS (Underline syntax now takes priority over subscript
when both are applicable): Announce the breaking change.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://list.orgmode.org/87v8z52eom.fsf@posteo.net/T/#t
2024-04-01 15:32:14 +03:00
Ihor Radchenko a698d073a1
org-latex-to-mathml/html-convert-command: Prevent shell expansion
* lisp/org.el (org-create-math-formula):
(org-format-latex-as-html): Shell-quote LaTeX fragment text when
replacing %i placeholder.  This prevents shell expansion of
$... and similar constructs inside the code.
(org-latex-to-mathml-convert-command):
(org-latex-to-html-convert-command): Update the docstring.
* etc/ORG-NEWS (~org-latex-to-mathml-convert-command~ and
~org-latex-to-html-convert-command~ shell-escape LaTeX code): Announce
the breaking change.
* doc/org-manual.org (LaTeX math snippets): Update example.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/735645dd-1ddf-4579-a6dd-2700f3e83c94@gmail.com
2024-04-01 14:13:15 +03:00
Ihor Radchenko 1d86651bef
org--collect-keywords-1: Ignore #+SETUPFILE when its file handler errs
* lisp/org.el (org--collect-keywords-1): When `expand-file-name'
handler errs on #+SETUPFILE, ignore it.  An error may be thrown when
by custom file handler (for example, by TRAMP handler on GVFS path
when `tramp-gvfs-enabled' is nil; which is the default).

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/uue18j$j42$1@ciao.gmane.io
2024-04-01 14:04:50 +03:00
Ihor Radchenko 462bbb213a
Make sure that commented headings appear commented
* lisp/org.el (org-set-font-lock-defaults): Apply 'org-special-keyword
face to commented headings last, so that every markup inside look dim,
as per 'org-special-keyword face.
2024-03-31 14:50:49 +03:00
Ihor Radchenko d3878cb6fe
Consistently combine markup and the containing element faces during fontification
* lisp/org-src.el (org-fontify-inline-src-blocks-1):
* lisp/org.el (org-fontify-macros):
* lisp/org.el (org-activate-footnote-links):
(org-set-font-lock-defaults):  Prepend faces during
activation instead of overriding.  Add a comment explaining the
general rule how we combine faces.
* etc/ORG-NEWS (Org mode faces are now consistently combined, with
markup faces taking precedence over the containing element faces):
Document the breaking change.

Reported-by: StrawberryTea <look@strawberrytea.xyz>
Link: https://orgmode.org/list/875xy21e49.fsf@localhost
2024-03-31 14:41:07 +03:00
Ihor Radchenko c0e732266b
org-file-contents: Improve comment
* lisp/org.el (org-file-contents): Link to an example when
`file-remote-p' may throw an error.
2024-03-30 13:01:17 +03:00
Matthew Trzcinski e9c288dfac lisp/ob-comint.el: Fix prompt appearing in async shell results
* lisp/ob-comint.el (org-babel-comint-async-filter): Call prompt
`org-babel-comint--prompt-filter'

Reported-by: "Matthew Trzcinski" <matt@excalamus.com>
Link: https://list.orgmode.org/18d753c1e8a.cfb3e1921191837.5665565128507976741@excalamus.com/
2024-03-29 12:11:18 +01:00
Matthew Trzcinski 574e04d119 lisp/ob-comint.el: Refactor `org-babel-comint-with-output'
* lisp/ob-comint.el (org-babel-comint-with-output): Replace logic for
prompt and echo filtering with `org-babel-comint--prompt-filter' and
`org-babel-comint--echo-filter'.  Delete
`org-babel-comint-prompt-separator' variable and move related comment
to `org-babel-comint--prompt-filter'.
2024-03-29 12:11:18 +01:00
Matthew Trzcinski 3776eba2f7 lisp/ob-comint.el: Create comint echo filter
* lisp/ob-comint.el (org-babel-comint--echo-filter): Extract echo
filtering logic from `org-babel-comint-with-output' into a new
function.
2024-03-29 12:11:18 +01:00
Matthew Trzcinski 227cbb5359 lisp/ob-comint.el: Create comint prompt filter
* lisp/ob-comint.el (org-babel-comint--prompt-filter): Extract prompt
filtering logic from `org-babel-comint-with-output' into a new
function.
2024-03-29 12:11:18 +01:00
Ross Timson 1be2f96931
lisp/ox-html.el: Add avif support for html export inline images
* lisp/ox-html.el (org-html-inline-image-rules): Add AVIF image
support for inline images on HTML export.

AVIF is well supported by browsers these days and offers similar
features and much better compression than the other image formats
commonly used for the web.

TINYCHANGE
2024-03-27 15:11:40 +03:00
Ihor Radchenko 3f20e32f8e
org-element-clock-parser: Do not be case-sensitive
* lisp/org-element.el (org-element-clock-parser): Fix demanding
upcased "CLOCK:" string.  As per general Org mode syntax principle,
keywords in Org mode are case-insensitive.
* testing/lisp/test-org-element.el (test-org-element/clock-parser):
Add test.

Reported-by: Gregor Zattler <telegraph@gmx.net>
Link: https://orgmode.org/list/875xx8mvvn.fsf@no.lan
2024-03-27 14:57:17 +03:00
Ihor Radchenko 5bdfc02c6f
Update version number for the 9.6.24 release 2024-03-26 22:45:33 +03:00
Laurence Warne 990b89d324
Create commands for `org-read-date-minibuffer-local-map'
Create commands for `org-read-date-minibuffer-local-map' for use in
place of the inline lambda commands in order to aid user discoverability.

* org.el (org-calendar-goto-today-or-insert-dot)
(org-calendar-goto-today, org-calendar-backward-month)
(org-calendar-forward-month, org-calendar-backward-year)
(org-calendar-forward-year, org-calendar-backward-week)
(org-calendar-forward-week, org-calendar-backward-day)
(org-calendar-forward-day, org-calendar-view-entries)
(org-calendar-scroll-month-left, org-calendar-scroll-month-right)
(org-calendar-scroll-three-months-left)
(org-calendar-scroll-three-months-right): New functions.
* org-keys.el (org-read-date-minibuffer-local-map): Use the new
functions for keybindings instead of inline functions.

TINYCHANGE
2024-03-26 18:04:23 +03:00
Ihor Radchenko a3bd978e15
Merge branch 'bugfix' 2024-03-26 14:44:52 +03:00
Ihor Radchenko 6223f20a64
org-map-entries: Fix when buffer is not a file buffer and SCOPE is nil
* lisp/org.el (org-map-entries): Avoid triggering check for existence
of file on FS when SCOPE is nil.

Link: https://old.reddit.com/r/emacs/comments/1bnhz24/bug_nonexistent_agenda_file_s/
2024-03-26 14:36:53 +03:00
Ihor Radchenko f0a92b1eb9
org-resource-download-policy: Emphasize that the value of t is dangerous
* lisp/org.el (org-resource-download-policy): Mark value t in the
docstring dangerous.
2024-03-26 14:10:52 +03:00
Ihor Radchenko 9450468e5c
Merge branch 'bugfix' 2024-03-25 14:32:57 +03:00
Ihor Radchenko d7f7b63a77
lisp/org.el (untrusted-content): Fix for Emacs <29.3
* lisp/org.el (untrusted-content): Define the variable ourselves when
not defined by Emacs.
2024-03-25 14:32:09 +03:00
Ihor Radchenko 16f7021c75
Merge branch 'bugfix' 2024-03-25 13:56:53 +03:00
Ihor Radchenko 656531edbe
org-html-style-default: Fix XHTML validation failing
* lisp/ox-html.el (org-html-style-default): Provide mandatory
attribute type for style tag.

Reported-by: c.buhtz@posteo.jp
2024-03-25 13:54:58 +03:00
Ihor Radchenko 6652ee7be9
Merge branch 'bugfix' 2024-03-24 19:18:11 +03:00
Ihor Radchenko 5ff4d54c6f
Update version number for the 9.6.23 release 2024-03-24 19:16:02 +03:00
Ihor Radchenko 01f10031b1
org--confirm-resource-safe: Fix prompt when prompting in non-file Org buffers
* lisp/org.el (org--confirm-resource-safe): When called from
non-file buffer, do not put stray "f" in the prompt.
2024-03-24 17:11:36 +03:00
Ihor Radchenko 4255d5dcc0
org-file-contents: Consider all remote files unsafe
* lisp/org.el (org-file-contents): When loading files, consider all
remote files (like TRAMP-fetched files) unsafe, in addition to URLs.
2024-03-24 17:11:28 +03:00
Ihor Radchenko 03635a3355
org-latex-preview: Add protection when `untrusted-content' is non-nil
* lisp/org.el (org--latex-preview-when-risky): New variable
controlling how to handle LaTeX previews in Org files from untrusted
origin.
(org-latex-preview): Consult `org--latex-preview-when-risky' before
generating previews.

This patch adds a layer of protection when LaTeX preview is requested
for an email attachment, where `untrusted-content' is set to non-nil.
2024-03-24 17:11:17 +03:00
Ihor Radchenko 003ddacf1c
org-macro--set-templates: Prevent code evaluation
* lisp/org-macro.el (org-macro--set-templates): Get rid of any
risk to evaluate code when `org-macro--set-templates' is called as a
part of major mode initialization.  This way, no code evaluation is
ever triggered when user merely opens the file or when
`mm-display-org-inline' invokes Org major mode to fontify mime part
preview in email messages.
2024-03-24 17:11:05 +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
Aaron L. Zeng 5808155084 lisp/ob-shell.el: Initialize explicit-shell-file-name
* lisp/ob-shell.el (org-babel-shell-initialize): force blocks to
always use the specified shell language

Sessions are initialized using `shell'.  The `shell' command checks
`explicit-shell-file-name' for file to use before checking other
variables, like `shell-file-name'.  Previously, only `shell-file-name'
was set.  So, if the user had set the `explicit-shell-file-name',
session blocks would use that whereas non-session blocks would use
`shell-file-name', resulting in inconsistent behavior.  This change
sets both variables so that even if the user changes the
`explicit-shell-file-name' or `shell-file-name', blocks will only use
the shell language specified by the block.

TINYCHANGE
2024-03-23 08:57:18 +01:00
Matthew Trzcinski 34c844ab33 Revert "lisp/ob-shell.el: Initialize explicit-shell-file-name"
This reverts commit 37cd00bb12.

Commit 37cd00bb accidentally added check.sh, nohup.out, and setup.sh.
2024-03-23 08:54:51 +01:00
Ihor Radchenko 13af0fd543
fixup! Support completion boundaries when completing olp, tags, and agenda filter
Copy-paste typos.
2024-03-23 08:58:20 +03:00
Ihor Radchenko 5fa0f0c6fe
Support completion boundaries when completing olp, tags, and agenda filter
* lisp/org-agenda.el (org-agenda-filter-completion-function):
* lisp/org-refile.el (org-olpath-completing-read):
* lisp/org-tags.el (org-tags-completion-function): Add support for
orderless/flex completion styles that require boundaries operation.
2024-03-22 13:50:45 +03:00
Ihor Radchenko 50c51b9ad1
Update version number for the 9.6.22 release 2024-03-22 10:30:04 +03:00
Ihor Radchenko 1b99cccbe9
Merge branch 'bugfix' 2024-03-21 15:56:36 +03:00
Ihor Radchenko 5dbf930c2d
org-agenda-clock-cancel: Unmark clocking tasks in the agenda buffer
* lisp/org-agenda.el (org-agenda-clock-cancel): When canceling clock,
remove clocking overlays from current agenda buffer.
2024-03-21 15:55:21 +03:00
Ihor Radchenko fe83afc300
org-persist: Do not demand write access to existing directories
* lisp/org-persist.el (org-persist--check-write-access): New function
checking write access to creating a directory and all the necessary
parents.  The function is a refactoring of duplicated code that
previously checked one parent beyond what needs to be created.
(org-persist-write:index): Use the new function.  Create
`org-persist-directory' together with all its parents.  Gracefully
handle failure.
* lisp/org-persist.el: Use the new function when adding hooks to
`kill-emacs-hook'.

Reported-by: Al Oomens <aloomens@outlook.com>
Link: https://list.orgmode.org/MW4PR19MB6888F37194BA260AE5631770C4332@MW4PR19MB6888.namprd19.prod.outlook.com
2024-03-21 12:13:13 +03:00
Ihor Radchenko ad02825337
org-persist: Do not demand write access to existing directories
* lisp/org-persist.el (org-persist--check-write-access): New function
checking write access to creating a directory and all the necessary
parents.  The function is a refactoring of duplicated code that
previously checked one parent beyond what needs to be created.
(org-persist-write:index): Use the new function.  Create
`org-persist-directory' together with all its parents.  Gracefully
handle failure.
* lisp/org-persist.el: Use the new function when adding hooks to
`kill-emacs-hook'.

Reported-by: Al Oomens <aloomens@outlook.com>
Link: https://list.orgmode.org/MW4PR19MB6888F37194BA260AE5631770C4332@MW4PR19MB6888.namprd19.prod.outlook.com
2024-03-21 12:04:53 +03:00
Ihor Radchenko 224254e7f0
fixup! Fix org-fontify-quote-and-verse-blocks when org-src-fontify-natively is t 2024-03-19 23:35:30 +03:00
Ihor Radchenko df4a48bc4f
Fix org-fontify-quote-and-verse-blocks when org-src-fontify-natively is t
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Do not attempt
native fontification in quote and verse blocks when
`org-src-fontify-natively' is non-nil.  Limit native fontification to
src and example blocks only.

Reported-by: William Denton <william@williamdenton.org>
Link: https://orgmode.org/list/Ml33lIeToTUsXIzeVEIolD5SsK-HJ0yrdPgOMr2N9WrldhU72LtjnGjehgViKAjMOgN5IAwM5Tx5TfCJlRBrTfnGnxqpuhy3-lEbUNycPMY=@williamdenton.org
2024-03-19 22:22:57 +03:00
Ihor Radchenko 4f548f9482
fixup! org-create-math-formula: Do not run file-related hooks when checking output 2024-03-19 19:26:46 +03:00
Ihor Radchenko b338a90698
org-create-math-formula: Do not run file-related hooks when checking output
* lisp/org.el (org-create-math-formula): Avoid using
`find-file-noselect' to check contents of the generated mathml
formula.  `find-file-noselect' runs a number of hooks, which are not
necessary and may sometimes throw errors.

Link: https://orgmode.org/list/ut96a7$i6d$1@ciao.gmane.io
2024-03-19 17:44:00 +03:00
Damien Cassou 2381c7b882
ox-odt: Avoid warning when everything is fine
* lisp/ox-odt.el (org-odt--translate-latex-fragments): When
processing-type is already 'verbatim, no need to print any warning.
2024-03-19 17:22:52 +03:00
Ihor Radchenko 63b10621a0
org-sparse-tree: Fix matching property names containing "-"
* lisp/org.el (org-sparse-tree): Escape "-" in property names.

Reported-by: Fabian Kurmann <fabian.kurmann@uni-duesseldorf.de>
Link: https://orgmode.org/list/87v87qprwq.fsf@localhost
2024-03-19 17:02:02 +03:00
Leo Butler 80615195c4
lisp/ox-beamer.el: constrain use of org-beamer-frame-environment
* lisp/ox-beamer.el (org-beamer--format-frame, org-beamer-template):
Only use `org-beamer-frame-environment' when a frame is marked as
fragile and the frame's contents include either \begin{frame} or
\end{frame}.  When `org-beamer-frame-environment' is used and not
equal to "frame", add the property :beamer-define-frame to INFO and
set it to t.  When that property is t, `org-beamer-template' emits a
definition of the alternative frame environment.

Refs: https://list.orgmode.org/orgmode/87bk7jeik8.fsf@localhost/
https://list.orgmode.org/87a5nux3zr.fsf@t14.reltub.ca/T/
2024-03-17 17:35:37 +03:00
Aaron L. Zeng 37cd00bb12 lisp/ob-shell.el: Initialize explicit-shell-file-name
* lisp/ob-shell.el (org-babel-shell-initialize): force blocks to
always use the specified shell language

Sessions are initialized using `shell'.  The `shell' command checks
`explicit-shell-file-name' for file to use before checking other
variables, like `shell-file-name'.  Previously, only `shell-file-name'
was set.  So, if the user had set the `explicit-shell-file-name',
session blocks would use that whereas non-session blocks would use
`shell-file-name', resulting in inconsistent behavior.  This change
sets both variables so that even if the user changes the
`explicit-shell-file-name' or `shell-file-name', blocks will only use
the shell language specified by the block.

TINYCHANGE
2024-03-17 13:42:39 +01:00
Matthew Trzcinski cb80019c28 Revert "lisp/ob-shell.el: Initialize explicit-shell-file-name"
This reverts commit 0e2a9524dc.
2024-03-17 13:40:57 +01:00
Ihor Radchenko d545ad6068
lisp/ol.el: Make `org-link-get-parameter' a valid PLACE for `setf'
* lisp/ol.el (org-link-get-parameter): Define setter.  This allows
modifying link parameters with `setf' and altering them via
`add-function'.

Link: https://orgmode.org/list/a123389c-8f86-4836-a4fe-1e3f4281d33b@app.fastmail.com
2024-03-17 13:06: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
Visuwesh 89b0773c3f
ob-calc.el: Add support for tables in Calc source block :var
A table with MxN dimensions is converted to a MxN matrix when given in
:var to a Calc source block.  A table with a single row is converted
to a vector (i.e., row vector).

* lisp/ob-calc.el (org-babel-execute-src-block:calc): Construct the
right data structure to pass tables as matrices to Calc.
* testing/lisp/test-ob-calc.el: Add tests for ob-calc, and this new
feature.
* etc/ORG-NEWS: Announce the feature.
* mk/default.mk (BTEST_OB_LANGUAGES): Enable ob-calc tests by default.
2024-03-16 15:15:40 +03:00
Ihor Radchenko 712ef988c3
org-fold-core-region: Fix removing non-fold overlays
* lisp/org-fold-core.el (org-fold-core-region): Do not clear all the
overlays in region when unfolding and when SPEC-OR-ALIAS is nil.

Reported-by: Bruno Barbier <brubar.cs@gmail.com>
Link: https://orgmode.org/list/65f4a408.df0a0220.5debf.2c65@mx.google.com
2024-03-16 12:26:00 +03:00
Ihor Radchenko 8b73c8b98f
org-fold-core-region: Fix removing non-fold overlays
* lisp/org-fold-core.el (org-fold-core-region): Do not clear all the
overlays in region when unfolding and when SPEC-OR-ALIAS is nil.

Reported-by: Bruno Barbier <brubar.cs@gmail.com>
Link: https://orgmode.org/list/65f4a408.df0a0220.5debf.2c65@mx.google.com
2024-03-16 12:23:08 +03:00
Ihor Radchenko 9f4064e68e
org-capture-templates: Document %^{prompt}X %-escape syntax
* lisp/org-capture.el (org-capture-templates):
* doc/org-manual.org (Template expansion): Document the supported
custom prompt syntax.

Link: https://old.reddit.com/r/orgmode/comments/1bfgzsz/format_timestamp_after_capture_by_prompt/
2024-03-16 12:18:17 +03:00
Ihor Radchenko acf6fa6209
org-fold-core--property-symbol-get-create: Improve performance
* lisp/org-fold-core.el (org-fold-core--property-symbol-get-create):
Cache values of global property symbols.
2024-03-16 12:17:49 +03:00
Ihor Radchenko 051e7b9d7c
Reduce repetitive calls to `find-buffer-visiting' + `find-file-noselect'
* lisp/org-macs.el (org-with-file-buffer): New macro switching to a
file buffer temporarily and killing it if a buffer visiting file did
not exist previously.
(org-file-buffer-created): New variable set when buffer visiting file
has been created.
* lisp/ob-tangle.el (org-babel-tangle-file):
* lisp/org-archive.el (org-archive-subtree):
* lisp/org-refile.el (org-refile):
(org-refile-check-position):
(org-refile-new-child):
* lisp/ox-org.el (org-org-publish-to-org):
* lisp/ox-publish.el (org-publish-org-to):
(org-publish-find-property): Avoid calling `find-buffer-visiting' +
`find-file-noselect'.  The latter calls the former.  Instead, either
just call `find-file-noselect' or use `org-with-file-buffer'.

This commit addresses O(N_buffers) complexity in
`find-buffer-visiting', reducing the number of calls to it.

See Emacs bug#66117.
2024-03-16 11:21:30 +03:00
Matthew Trzcinski 0e2a9524dc lisp/ob-shell.el: Initialize explicit-shell-file-name
* lisp/ob-shell.el (org-babel-shell-initialize): force blocks to
always use the specified shell language

Sessions are initialized using `shell'.  The `shell' command checks
`explicit-shell-file-name' for file to use before checking other
variables, like `shell-file-name'.  Previously, only `shell-file-name'
was set.  So, if the user had set the `explicit-shell-file-name',
session blocks would use that whereas non-session blocks would use
`shell-file-name', resulting in inconsistent behavior.  This change
sets both variables so that even if the user changes the
`explicit-shell-file-name' or `shell-file-name', blocks will only use
the shell language specified by the block.

Submitted by: "Aaron L. Zeng" me@bcc32.com

TINYCHANGE
2024-03-15 22:27:04 +01:00
Ihor Radchenko fb61e83f2a
org-insert-property-drawer: Fix incorrect fold type
* lisp/org.el (org-insert-property-drawer): When folding style is
overlays, do not use outline folds to fold the property drawer.

Reported-by: Bruno Cardoso <cardoso.bc@gmail.com>
Link: https://orgmode.org/list/87wmq5btzn.fsf@gmail.com
2024-03-15 00:20:02 +03:00
Ihor Radchenko 7653e58f6d
org-table-next-row: Improve docstring
* lisp/org-table.el (org-table-next-row): Explain what happens when
the next row is outside table or when it is an hline.

Link: https://orgmode.org/list/B35D543F-6A6C-4F7D-913F-E8CBB6B9BC1B@gmail.com
2024-03-13 17:14:04 +03:00
Stefan Monnier 2773904cfb
org-src-font-lock-fontify-block: Clarify offset computation
* lisp/org-src.el (org-src-font-lock-fontify-block): Improve the translation
of local positions into org-buffer positions, and get rid of
assumption about the value of `point-min' while we're at it.
2024-03-13 16:31:56 +03:00
Ihor Radchenko cd0568ab1b
org-submit-bug-report: Submit Org-related warnings
* lisp/org.el (org--warnings): New variable storing Org mode warnings
to be submitted together with bug reports.
(org-submit-bug-report): Add `org--warnings' to bug report template.
* lisp/org-element.el (org-element--cache-warn): Store cache warnings
for submission.
2024-03-13 16:07:06 +03:00
Ihor Radchenko 505db97a8c
org-update-parent-todo-statistics: Fix infinite loop after 4254a54f8
* lisp/org.el (org-update-parent-todo-statistics): Make sure that we
move to the end of updated cookie at the end of search loop, even when
the cookie has not been updated.

Reported-by: No Wayman <iarchivedmywholelife@gmail.com>
Link: https://orgmode.org/list/87le6pucnv.fsf@gmail.com
2024-03-13 13:26:00 +03:00
Gerard Vermeulen e2caccfdf6
lisp/oc-basic.el: add missing function declarations 2024-03-12 16:17:09 +03:00
Ihor Radchenko f08174a459
org-export: Display a warning when the value of :exports header arg is invalid
* lisp/ob-exp.el (org-babel-exp-do-export): Display warning when
:exports value is not known.  Document nil return value.
(org-babel-exp-process-buffer): Do not remove code block when
`org-babel-exp-do-export' returns nil.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/usc9jn$g2r$1@ciao.gmane.io
2024-03-12 16:07:13 +03:00
Ihor Radchenko c9b655f273
org-activate-folds: Skip over folded newlines faster
* lisp/org.el (org-activate-folds): When searching next unfolded
newline skip over folded newlines faster, using org-fold-core API.
2024-03-12 15:40:37 +03:00
Psionik K b6f8078ab4
org-do-remove-indentation: Ignore invisible text
* lisp/org-macs.el (org-do-remove-indentation): Set
`buffer-invisibility-spec' to nil before detecting the column or
moving to a column.

This fixes src_block indentation removal for org-modern-mode but will
also correct other cases of hidden indentation.

TINYCHANGE
2024-03-12 15:19:50 +03:00
Ihor Radchenko a1b8554f6f
org-mks: Do not leave window around
* lisp/org-macs.el (org-mks): Make sure that selection window is
closed upon exiting.  See also fef873b1c.

Reported-by: Björn Bidar <bjorn.bidar@thaodan.de>
Link: https://orgmode.org/list/874jdg2ipo.fsf@
2024-03-12 15:12:42 +03:00
Ihor Radchenko 72b0e9ff04
org-export: Do not strip link type by default during export
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link--inline-image):
* lisp/ox-texinfo.el (org-texinfo-link): Preserve link type during
export for all the links, not just for a hard-coded subset.
* etc/ORG-NEWS (Built-in HTML, LaTeX, Man, Markdown, ODT, and Texinfo
exporters preserve the link protocol during export): Document the
breaking change.

Link: https://list.orgmode.org/orgmode/878r9nofpw.fsf@localhost/
2024-03-12 13:57:47 +03:00
Stefan Monnier b0c3c90574
ox-texinfo:: Always provide a @direntry
Until now @dircategory/@direntry entries were added only if
both TEXINFO_DIR_CATEGORY and TEXINFO_DIR_TITLE were set.
And the setting of TEXINFO_DIR_TITLE had to be careful to
provide exactly the right syntax.

This patch changes various things in this regard:
- Always generate a @dircategory/@direntry.
- Default TEXINFO_DIR_CATEGORY to "Misc".
- Use the document title by default if TEXINFO_DIR_DESC is missing.
- Rename TEXINFO_DIR_TITLE to TEXINFO_DIR_NAME.
- Use the filename by default when TEXINFO_DIR_NAME is missing.
- Try and make it harder to provide a direntry that does not
  have the right format or refers to a different filename than
  the one we're outputting to.

* lisp/ox-texinfo.el (texinfo): Add entry for TEXINFO_DIR_NAME.
(org-texinfo-template): Use sane defaults for `@direntry` and `@dircategory`.

* doc/org-manual.org (Texinfo specific export settings): Adjust accordingly.
(Info directory file, A Texinfo example, Export Setup): Update examples
to use the new syntax.
* etc/ORG-NEWS (Version 9.7 / New features): Add entry.
2024-03-08 13:45:26 +03:00
Stefan Monnier 4fd8691941
lisp/ox-texinfo.el: Remove redundant `:group`s 2024-03-08 13:45:25 +03:00
Ihor Radchenko 28dc5dd1ac
Update version number for the 9.6.21 release 2024-03-08 11:34:42 +03:00
Ihor Radchenko cab81f2428
org-babel: Improve parsing of colnames in tables with horizontal lines
* lisp/ob-core.el (org-babel-get-colnames): When table starts with
horizontal lines, consider column names to be the first non-hline row.
(org-babel-disassemble-tables): When detecting automatic column names,
do not assign colnames when the first row is an hline.
* doc/org-manual.org (Passing arguments): Update the manual, detailing
that leading hline rows are skipped for :colnames yes.

Link: https://orgmode.org/list/87wmqexjoj.fsf@localhost
2024-03-07 22:02:21 +03:00
Ihor Radchenko 0a6c881174
org-babel: Fix smart `replace-regexp-in-string' behavior during variable assignment
* lisp/ob-latex.el (org-babel-expand-body:latex):
* lisp/ob-lilypond.el (org-babel-expand-body:lilypond):
* lisp/ob-org.el (org-babel-expand-body:org):
* lisp/ob-sql.el (org-babel-sql-expand-vars): Pass FIXEDCASE and
LITERAL arguments to `replace-regexp-in-string'.  This avoids changing
case and special handling of \N constructs in the replacement string.
2024-03-07 15:49:07 +03:00
Ihor Radchenko 0608ae1062
Merge branch 'bugfix' 2024-03-07 15:43:53 +03:00
Ihor Radchenko 01a0f15b6b
org-babel-expand-body:gnuplot: Fix altering variable data case
* lisp/ob-gnuplot.el (org-babel-expand-body:gnuplot): Pass FIXEDCASE
and LITERAL arguments to `replace-regexp-in-string'.  This prevents it
from "smartly" altering the replacement text case when the variable
name is upcased like $C or $FOO; and from interpreting \N constructs.

Reported-by: Paul Stansell <paulstansell@gmail.com>
Link: https://orgmode.org/list/CAMJKaZyH0ZwaitHxCTdd2ZGMKOZtVCvwVf_OEuRe9crPbqG9jA@mail.gmail.com
2024-03-07 15:43:00 +03:00
Ihor Radchenko 8eb78048f0
org-mobile-create-index-file: Fix typo
* lisp/org-mobile.el (org-mobile-create-index-file): Fix argument
order in the call to `expand-file-name'.

Reported-by: Fabian Brosda <f.brosda@gmx.de>
Link: https://orgmode.org/list/87a5ngxzcr.fsf@gmx.de
2024-03-06 13:36:56 +03:00
Ihor Radchenko 1151c614b3
org-fold-core-region: Fix another edge case with newline fontification
* lisp/org-fold-core.el (org-fold-core-region): Do not just update
folds before/after.  Refresh newlines created by splicing a fold by
unfolding in the middle of an existing fold.  Then, fold list between
from/to will not cover the folds right before from and right after to.

Reported-by: StrawberryTea <look@strawberrytea.xyz>
Link: https://orgmode.org/list/878r2xfk60.fsf@strawberrytea.xyz
2024-03-05 11:02:21 +03:00
Gerard Vermeulen c2ea553be8
org-babel-demarcate-block: split using element API
* lisp/ob-babel.el (org-babel-demarcate-block): Modify a copy
of (org-element-at-point) to replace the old source block with 2 or 3
new modified copies by means of `org-element-interpret-data'.  The 1st
source block contains the text from the body of the old block before
point or region, the 2nd block contains the body text after point or
body text within region, and in case of region, the 3rd block contains
the text after region.  The caption and the name are deleted from the
1 or 2 blocks below the upper source block.  Indent all blocks
immediately after insertion.  Use :post-blank to control white lines
between inserted blocks.  Leave point at the last inserted block.
Trying to split when point or region is not within the body of the old
source block raises an user-error.
* lisp/ob-babel (org-get-src-block-info): add the "within blank lines
after a source block" condition to the doc-string to match it with the
doc-string of and a comment in `org-babel-demarcate-block'.
* testing/lisp/test-ob.el (test-ob/demarcate-block-split-duplication)
(test-ob/demarcate-block-split-prefix-point)
(test-ob/demarcate-block-split-prefix-region)
(test-ob/demarcate-block-split-user-errors)
(test-ob/demarcate-block-wrap-point)
(test-ob/demarcate-block-wrap-region): New tests to check test cases
that broke earlier versions of this patch.

Link: https://list.orgmode.org/7e41f9b6e9026a404e256f33371e974c@posteo.net/
2024-03-04 14:48:59 +03:00
Ihor Radchenko 5f5db3d353
org-babel-do-in-edit-buffer: Fix when opening src edit buffer fails
* lisp/ob-core.el (org-babel-do-in-edit-buffer): When opening src edit
buffer fails, do not leave point inside that buffer.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/5bf6832d2485f0aa6be2e5ea2eba37d2@posteo.net
2024-03-04 13:11:21 +03:00
Anand Deopurkar 8ac99c33f0
org-agenda.el: Fix org-agenda-write to avoid duplicates
* lisp/org-agenda.el (org-agenda-write): Make sure headlines are not
duplicated when writing to an `org' file, even if they are repeated in
the agenda view.

For example, a headline may appear multiple times in the agenda
view (for example, if it has multiple time stamps).  But
org-agenda-write should write it only once to the output `org' file.

TINYCHANGE
2024-03-03 16:44:54 +03:00
Ihor Radchenko 2da622cad7
org-fold-core-region: Fix re-fontification when unfolding everything
* lisp/org-fold-core.el (org-fold-core-region): Make sure that we
refresh fontification of newlines after folds when unfolding is
requested across multiple non-intersecting folds.

Reported-by: StrawberryTea <look@strawberrytea.xyz>
Link: https://orgmode.org/list/87y1b0m0ij.fsf@strawberrytea.xyz
2024-03-03 16:42:03 +03:00
Anand Deopurkar 902dacb9ca
org-archive.el: Fix org-add-archive-files to correctly de-duplicate
* org-archive.el (org-add-archive-files): Use `seq-uniq' with TESTFN
`file-equal-p' to de-duplicate the list of gathered files.

Previously, `org-uniquify' was used.  This de-duplicates the
file-names, but not necessarily the files.  The problem occurs if the
list of file-names includes distinct file-names that reference the
same file (symbolic links, for example).

TINYCHANGE
2024-03-02 15:26:16 +03:00
Ihor Radchenko ca061cfacb
org-beamer-template: Fix when `org-beamer-frame-environement' is "frame"
* lisp/ox-beamer.el (org-beamer-template): Do not try to define
`org-beamer-frame-environement' when it is set to "frame" - the same
as the existing frame environment.

Reported-by: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
Link: https://orgmode.org/list/87a5nh1r9h.fsf@t14.reltub.ca
2024-03-02 15:19:31 +03:00
Leo Butler 60ddec4827
lisp/ox-beamer.el: fix orgframe environment definition
* (org-beamer-template):  pass the frame overlay specification to the
frame in the definition of the orgframe environment.

Bug reported by Pedro Andres Aranda Gutierrez.

Ref: https://list.orgmode.org/orgmode/CF58E7A4-233D-4F9D-BBE2-FC1A67E315BD@gmail.com/T/
2024-03-02 15:16:40 +03:00
Ihor Radchenko b127d7257e
lisp/ol.el (org--re-list-looking-at): Fix Emacs <29 compatibility 2024-02-29 16:00:06 +03:00
Ihor Radchenko c88da815ed
Revert "lisp/ob-sql.el: Prevent from getting stuck with an error"
This reverts commit 45ca597f96.

Another commit handles the problem more universally: a3ebd8c66.
2024-02-29 15:05:19 +03:00
Ihor Radchenko a3ebd8c669
org-babel-do-in-edit-buffer: When editing fails, do not throw an error
* lisp/ob-core.el (org-babel-do-in-edit-buffer): Avoid throwing an
error when something is not right with the code block.  We already
ignore errors when major mode fails to load and we generally don't
want this macro to fail as it is used during indentation.

Link: https://list.orgmode.org/orgmode/87wmqo3it5.fsf@localhost/
2024-02-29 15:01:00 +03:00
Ihor Radchenko 8648576573
org-up-heading-safe: Return true level, ignoring org-odd-levels-only
* lisp/org.el (org-up-heading-safe): Fix return value, making sure
that the returned level is not reduced.

Reported-by: E.L.K. <some.any.key@gmail.com>
Link: https://orgmode.org/list/CAF+cOoPuh8rzVRoV9-pGSP3SVRm-M8ZQrM=xGB+o4TqJat_O-A@mail.gmail.com
2024-02-29 14:47:31 +03:00
Ihor Radchenko 6ef0154576
org-up-heading-safe: Return true level, ignoring org-odd-levels-only
* lisp/org.el (org-up-heading-safe): Fix return value, making sure
that the returned level is not reduced.  This is what other code
expects and what used to be the case before refactoring, in previous
version of the function.
* testing/lisp/test-org.el (test-org/up-heading-safe): Add test.

Reported-by: E.L.K. <some.any.key@gmail.com>
Link: https://orgmode.org/list/CAF+cOoPuh8rzVRoV9-pGSP3SVRm-M8ZQrM=xGB+o4TqJat_O-A@mail.gmail.com
2024-02-29 14:36:26 +03:00
Ihor Radchenko 731d16f9e9
org-table-to-lisp: Preserve text properties
* lisp/org-table.el (org-table-to-lisp): When parsing table, keep text
properties.  These text properties are required to calculate table
alignment with invisible text.
* testing/lisp/test-org-table.el (test-org-table/align): Add new test.

Reported-by: Kostadin Ninev <dinkonin@gmail.com>
Link: https://orgmode.org/list/1709041784097.2987395179.620232376@gmail.com
2024-02-29 14:23:37 +03:00
Ihor Radchenko c841be9656
lisp/ol.el (org-target-link-regexp-limit): Bump value 2024-02-29 14:07:15 +03:00
Ihor Radchenko 341a01a07d
Work around regexp size limitation for large number of link targets
* lisp/ol.el (org-target-link-regexp-limit): New constant defining
maximum regexp limit where `org-target-link-regexp' is still safe to
use without triggering "Regexp too long" error.
(org-target-link-regexps): New variable holding a series of shorter
regexps to be used instead of too long single
`org-target-link-regexp'.
(org--re-list-search-forward): New function like `re-search-forward',
but accepting a list of regexps.
(org--re-list-looking-at): New function like `looking-at', but
accepting a list of regexps.
(org-update-radio-target-regexp): When `org-target-link-regexp' is too
long, set `org-target-link-regexps', partitioning the link target list
into smaller regexps.
* lisp/org-element.el (org-element-link-parser):
(org-element--object-lex):
* lisp/org.el (org-activate-target-links): Use
`org--re-list-search-forward' and `org--re-list-looking-at' when
`org-target-link-regexps' is non-nil.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
tests.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/orgmode/m2lenax5m6.fsf@me.com/
2024-02-29 13:54:41 +03:00
Olivier Lischer dd4d05a159
ob-tangle: Add flag to optionally remove files before writing
* lisp/ob-tangle.el: Add new custom option
`org-babel-tangle-remove-file-before-write'.
(org-babel-tangle): Remove file before writing according to the value
of `org-babel-tangle-remove-file-before-write'.

The variable `org-babel-tangle-remove-file-before-write' adds support
for the current and old behaviour of `org-babel-tangle'.

Link: https://list.orgmode.org/orgmode/877cjzhjtg.fsf@liolin.ch/
Co-authored-by: Ihor Radchenko <yantar92@posteo.net>

TINYCHANGE
2024-02-29 13:41:34 +03:00
Ihor Radchenko 9029470eb9
fixup! oc-basic.el: Drop {...} when rendering Bibtex entries 2024-02-29 13:02:48 +03:00
Ihor Radchenko ac1ed2bf85
lisp/org-colview.el: Fix computing summary with low-level first child
* lisp/org-colview.el (org-columns--compute-spec): Do not assume that
all the children of an entry have the same LAST-LEVEL.  Handle
situation when the first child has lower level:

* Heading
****** Child 1
** Child 2
** Child 3

Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87wn8yj2i5.fsf@localhost
2024-02-29 12:57:24 +03:00
Ihor Radchenko d2df9624ce
oc-basic.el: Drop {...} when rendering Bibtex entries
* lisp/oc-basic.el (org-cite-basic--print-bibtex-string): New function
approximately parsing Bibtex strings and dropping {...}.
(org-cite-basic--print-entry): Use the new function.
* testing/examples/Basic.bib:
*
testing/lisp/test-oc-basic.el (test-org-cite-basic/export-bibliography):
Add test.

Reported-by: Dominik Schrempf <dominik.schrempf@gmail.com>
Link: https://orgmode.org/list/CAF+0kSg8O3RQBG1wXoHjMEHwnGFz0gaDkTTSGv+ZaOt4d4myCA@mail.gmail.com
2024-02-29 12:21:08 +03:00
Ihor Radchenko 286a8fb798
org-element-insert-before: Fix return value when setting plain-text
* lisp/org-element-ast.el (org-element-set-element): When setting
plain-text node, return the new node instead of immutable old one.
* testing/lisp/test-org-element.el (test-org-element/set): Add test.
2024-02-29 11:43:52 +03:00
Ihor Radchenko 755fef38f5
Merge branch 'bugfix' 2024-02-28 10:54:50 +03:00
Ihor Radchenko fe9bc9efd1
Update version number for the 9.6.20 release 2024-02-28 10:53:28 +03:00
Ihor Radchenko 80dff08ed1
Fix unescaped \ in docstrings
* lisp/org-macs.el (org-split-string):
* lisp/ox-latex.el (org-latex-guess-babel-language): Fix docstrings,
as revealed by compiler warnings.
2024-02-28 10:52:58 +03:00
Tim Ruffing 356072c1d6
org-agenda: Make sure skipping warning/delay days never increases their number
* lisp/org-agenda.el (org-agenda-get-deadlines, org-agenda-get-scheduled):
Use minimum of warning/delay days specified in timestamp cookie and the
limit specified by `org-agenda-skip-deadline-prewarning-if-scheduled' or
`org-agenda-skip-scheduled-delay-if-deadline`, respectively.
* testing/lisp/test-org-agenda.el (test-org-agenda/skip-deadline-prewarning-if-scheduled):
New test.

Link: https://orgmode.org/list/59e48dfe744dc9409ff47183255bc64e92d26d88.camel@timruffing.de

TINYCHANGE
2024-02-27 15:40:18 +03:00
Ihor Radchenko 8651c83991
Address Emacs 27 warnings
* lisp/org-entities.el (seq): Require seq.el - it is not preloaded in
Emacs <28.
* lisp/org.el (org--image-yank-media-handler): Suppress warning and
throw an error about `file-name-with-extension'.  This function is not
supposed to be called in older Emacs.
2024-02-27 13:34:07 +03:00
Ihor Radchenko 25a51bad2c
Address Emacs 28 warnings
* lisp/oc-basic.el (org-cite-basic--shorten-names): Provide third
argument for `mapconcat'.  It is mandatory in Emacs <29.
* lisp/org.el (org--image-yank-media-handler): Suppress warning and
throw and error in Emacs <29.
(org--dnd-rmc): Do not try to call `use-dialog-box-p' in Emacs <29.
2024-02-27 13:29:00 +03:00
Ihor Radchenko 87c9f9b5db
org-export: Fix exporting visible when org-fold-core-style is 'text-properties
* lisp/org-fold-core.el (org-fold-core--update-buffer-folds): New
function updating buffer folds in copied text for current buffer.
(org-fold-core-decouple-indirect-buffer-folds): Use the new function.
* lisp/org-element.el (org-element--generate-copy-script): Synchronize
folds.
2024-02-27 13:21:36 +03:00
Ihor Radchenko fef873b1cf
org-agenda-get-restriction-and-command: Do not leave window around
* lisp/org-agenda.el (org-agenda-get-restriction-and-command): When
agenda selection is aborted or completed by any means, quit agenda
command selection window.

Reported-by: Björn Bidar <bjorn.bidar@thaodan.de>
Link: https://list.orgmode.org/orgmode/87il2ai916.fsf@/
2024-02-27 12:18:34 +03:00
Ihor Radchenko 9f6894c106
org-activate-folds: Do not fontify newline after abbreviated links
* lisp/org.el (org-activate-folds): When a fold is created by link
abbreviation, and a link ends at eol, do not force the newline after
the ]] to have the same face as the link.

Reported-by: Rohit Patnaik <quanticle@quanticle.net>
Link: https://orgmode.org/list/6d440976-6747-4ce6-8913-b63931dd017f@app.fastmail.com
2024-02-26 15:52:25 +03:00
Ihor Radchenko 8bac4d386a
org-fold-core-get-folding-spec: Fix edge case
* lisp/org-fold-core.el (org-fold-core-get-folding-spec): When SPEC is
nil, do not rely upon 'invisible property value to determine the fold.
Examine unique property set by `org-fold-region' instead.
2024-02-26 15:51:31 +03:00
Ihor Radchenko 655e97208c
org-element--generate-copy-script: Copy all the overlay properties
* lisp/org-element.el (org-element--generate-copy-script): In buffer
copy, copy over all the overlay properties, not just 'invisible.  This
is needed to copy folding overlays correctly - they use more than just
'invisible property.
2024-02-26 15:51:04 +03:00
Thierry Banel 407a55c1c0
org-table.el: Enhanced table parsing
* lisp/org-table.el (org-table-to-lisp): Refactored.
* etc/ORG-NEWS: Document changes.

`org-table-to-lisp' is significantly faster.
It no longer uses regexps, nor clobbers the global regexp state.
2024-02-25 14:30:38 +03:00
Ihor Radchenko af9100382c
Never pass error message verbatim as the first argument for `message'/`error'
* lisp/org-capture.el (org-capture-store-last-position):
* lisp/org-crypt.el (org-encrypt-entry):
* lisp/org.el (org-open-file): Avoid (error string) code pattern.
Instead use (error "%s" string).  (error string) is erroneous when
STRING contains %-specs.

Reported-by: Corwin Kerr <corwin@corwinkerr.com>
Link: https://orgmode.org/list/beceaf05-ae15-487b-864b-2e23a33a3884@app.fastmail.com
2024-02-25 13:15:04 +03:00
Ihor Radchenko 9daad41ccf
Re-introduce undocumented fontification of example blocks
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Do not assert
that `org-src-fontify-natively' only applies to code blocks.  Allow
other blocks with language specifier to be fontified, but keep this
behavior undocumented.

Reported-by: Rudi C <rudiwillalwaysloveyou@gmail.com>
Link: https://orgmode.org/list/CAE9z9A3ko27NeN0oYFs_aBWV_cUbNm5YQTLrRux16dHsixsMBA@mail.gmail.com
2024-02-25 13:00:12 +03:00
Martin Kampas 37e468cf16
org-bibtex-yank: Allow to populate existing item
Align with `org-bibtex-create'.

* lisp/ol-bibtex.el (org-bibtex-write):
* lisp/ol-bibtex.el (org-bibtex-yank): New optional argument
UPDATE-HEADING to update heading at point instead of creating a new
heading.
(org-bibtex-create): Rename NONEW argument to UPDATE-HEADING.
* etc/ORG-NEWS (~org-bibtex-yank~ accepts a prefix argument):
(New optional argument =UPDATE-HEADING= for ~org-bibtex-yank~):
Announce the change.

Link: https://list.orgmode.org/orgmode/4868155.GXAFRqVoOG@gt1/
2024-02-25 11:50:38 +03:00
Ihor Radchenko 5d186b499d
org-fold: Refactor fontifying newlines after folds
* lisp/org.el (org-activate-folds): New fontification function to
arrange faces at newlines after folds to be the same as face before
the fold.
(org-set-font-lock-defaults): Add the new fontification function.
* lisp/org-fold-core.el (org-fold-core-region): Refresh fontification
of newlines after folds when folding/unfolding.

Reported-by: StrawberryTea <look@strawberrytea.xyz>
Link: https://orgmode.org/list/87plwoqrfv.fsf@strawberrytea.xyz
2024-02-25 11:42:44 +03:00
Rick Lupton 95554543b9
org-id.el: Add search strings, inherit parent IDs
* lisp/ol.el (org-store-link): Refactor org-id links to use standard
`org-store-link-functions'.
(org-link-search): Create new headings at appropriate level.
(org-link-precise-link-target): New function extracting logic to
identify a precise link target, e.g. a heading, named object, or text
search.
(org-link-try-link-store-functions): Extract logic to call external
link store functions. Pass them a new `interactive?' argument.
* lisp/ol-bbdb.el (org-bbdb-store-link):
* lisp/ol-bibtex.el (org-bibtex-store-link):
* lisp/ol-docview.el (org-docview-store-link):
* lisp/ol-eshell.el (org-eshell-store-link):
* lisp/ol-eww.el (org-eww-store-link):
* lisp/ol-gnus.el (org-gnus-store-link):
* lisp/ol-info.el (org-info-store-link):
* lisp/ol-irc.el (org-irc-store-link):
* lisp/ol-man.el (org-man-store-link):
* lisp/ol-mhe.el (org-mhe-store-link):
* lisp/ol-rmail.el (org-rmail-store-link): Accept optional arg.
* lisp/org-id.el (org-id-link-consider-parent-id): New option to allow
a parent heading with an id to be considered as a link target.
(org-id-link-use-context): New option to add context to org-id links.
(org-id-get): Add optional `inherit' argument which considers parents'
IDs if the current entry does not have one.
(org-id-store-link): Consider IDs of parent headings as link targets
when current heading has no ID and `org-id-link-consider-parent-id' is
set.  Add a search string to the link when enabled.
(org-id-store-link-maybe): Function set as :store option for custom id
link property. Move logic from `org-store-link' here to determine when
an org-id link should be stored using `org-id-store-link'.
(org-id-open): Recognise search strings after "::" in org-id links.
* lisp/org-lint.el: Add checker for "::" in ID properties.
* testing/lisp/test-ol.el: Add tests for
`org-link-precise-link-target' and `org-id-store-link' functions,
testing new options.
* doc/org-manual.org: Update documentation about links.
* etc/ORG-NEWS: Document changes and new options.

These feature allows for more precise links when using org-id to link to
org headings, without requiring every single headline to have an id.

Link: https://list.orgmode.org/118435e8-0b20-46fd-af6a-88de8e19fac6@app.fastmail.com/
2024-02-24 15:56:44 +03:00
Rick Lupton 6e7e0b2cd3
lisp/org.el (org-insert-heading): Allow specifying heading level
* lisp/org.el (org-insert-heading): Change optional argument TOP to
LEVEL, accepting a number to force a specific heading level.
* testing/lisp/test-org.el (test-org/insert-heading): Add tests.
* etc/ORG-NEWS: Document changes.
2024-02-24 15:56:43 +03:00
Ihor Radchenko f90322377c
ox: Fix exporting code blocks with missing language specifier
* lisp/ox-latex.el (org-latex-inline-src-block): Export code blocks
without language as verbatim.
* lisp/ox-man.el (org-man-inline-src-block):
(org-man-src-block): Do not try to call source-highlight executable
when code block language is missing.
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-texinfo.el (org-texinfo-src-block): Do not throw error when
code block language is missing.

Reproducer (not available on the list):

  To reproduce my problem you can write create an org-mode buffer (C-x b
  1.org M-x org-mode) with the following content:

  #+begin_src lua :tangle yes  :noweb yes
    aaa
    <<second>>
  #+end_src

  #+name: second
  #+begin_src
   bbb
  #+end_src

  Then enable exporting to texinfo and export the buffer:
    M-: (require 'ox-texinfo)
    C-c C-e i t

  The folllowing backtrace appears (providing you already enabled
  debugging on errors):

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    apply(debug error (wrong-type-argument stringp nil))
    edebug(error (wrong-type-argument stringp nil))
    signal(wrong-type-argument (stringp nil))
    edebug-signal(wrong-type-argument (stringp nil))
    string-match("lisp" nil nil t)
    string-match-p("lisp" nil)
    (edebug-after (edebug-before 1) 5 (string-match-p "lisp" (edebug-after (edebug-before 2) 4
  (org-element-property :language (edebug-after 0 3 src-block)))))

Reported-by: pva-outdoor@yandex.ru
Link: https://list.orgmode.org/orgmode/87jzn7oz1u.fsf@yandex.ru/
2024-02-24 12:52:51 +03:00
Ihor Radchenko 505778950a
org-persist: Disable reporting read/write time by default
* lisp/org-persist.el (org-persist--report-time): This information
might be interesting, but not really necessary for users.  At least
one user also asked to disable the time reporting.
2024-02-24 12:39:59 +03:00
Ihor Radchenko 19db45f2cc
org-agenda-filter-by-category: Fix using truncated category as a filter
* lisp/org-agenda.el (org-agenda-format-item): Do not store truncated
category in 'org-category property when `org-agenda-prefix-format'
causes truncation.  This leads to agenda filters assuming truncated
version of the category as the true value, which is incorrect.

Reported-by: John Mathena <jmmathena@gmail.com>
Link: https://orgmode.org/list/CADywB5Lonxw-t1H7cvK+Au3oWq=EsB=Bthj13pt03MRP-Fn-4w@mail.gmail.com
2024-02-24 12:33:27 +03:00
Ihor Radchenko 4b1399fb21
org-goto-map: Do not treat 0-9 as digital arguments by default
* lisp/org-goto.el (org-goto--set-map): Fix 0-9 being interpreted as
digital arguments when `org-goto-auto-isearch' is non-nil.

Reported-by: Pan Xie <xiepan@skyguard.com.cn>
Link: https://orgmode.org/list/5f491471-af08-49d5-a840-6b2f96be54cf@skyguard.com.cn
2024-02-24 12:07:55 +03:00
Ihor Radchenko bfe253f7eb
org-cycle: Fix "Overwriting value of ... by aliasing" warning
* lisp/org-cycle.el:
* lisp/org.el (org-cycle): Move variable aliases right before new
variable name definitions in org-cycle.el.  Otherwise, if users set
the aliased variable values before loading Org-mode, they might get
overwritten by the default value.

Reported-by: Ruiyang Wu <ywwry66@gmail.com>
Link: https://orgmode.org/list/F3A95086-B4BF-4C08-AF7A-8D7DE6FE30CF@gmail.com
2024-02-23 16:24:19 +03:00
Ihor Radchenko 256caa0823
org-cycle: Fix "Overwriting value of ... by aliasing" warning
* lisp/org-cycle.el:
* lisp/org.el (org-cycle): Move variable aliases right before new
variable name definitions in org-cycle.el.  Otherwise, if users set
the aliased variable values before loading Org-mode, they might get
overwritten by the default value.

Reported-by: Ruiyang Wu <ywwry66@gmail.com>
Link: https://orgmode.org/list/F3A95086-B4BF-4C08-AF7A-8D7DE6FE30CF@gmail.com
2024-02-23 16:21:13 +03:00
Ihor Radchenko 24ce9abce7
org-capture-set-target-location: Fix `pcase' conditions
* lisp/org-capture.el (org-capture-set-target-location): Do not demand
file path to be a string in capture targets.  Other non-string values
are also allowed and checked in `org-capture-expand-file' that is
called later.

This commit fixes the changes introduced in 0a58a53ed.

Reported-by: Derek Chen-Becker <derek@chen-becker.org>
Link: https://orgmode.org/list/CAMbmz5nnXY1V1cPObfdw9wyM_GbiuYQ5_rksJ6gcO3Af+HOmSQ@mail.gmail.com
2024-02-23 15:51:11 +03:00
Ihor Radchenko 67d9372487
org-read-date-display: Fix random overlay priority when selection is at today
* lisp/org.el (org-read-date-display): Assign `org-read-date-overlay'
non-default priority.  This makes sure that the overlay is displayed
over the overlay that calendar.el puts to indicate "today".

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CALEYq0-xbCc6ayEK3v7tKnuGU7=Npgh3raEjuB13qOTN6Eu07Q@mail.gmail.com
2024-02-21 14:15:24 +03:00
Leo Butler b3b35b03ff
lisp/ox-beamer.el: customize the beamer frame environment name
* lisp/ox-beamer.el (org-beamer-frame-environment): A new customize
variable.  It contains the name of an environment that serves as an
alias for the beamer frame environment.

(org-beamer-template): Insert the `org-beamer-frame-environment'
environment definition into the beamer document.

* lisp/org-lint.el (org-lint-beamer-frame): Check the body of each
frame for an occurrence of \begin{orgframe} or \end{orgframe}, or
whatever environment name is in `org-beamer-frame-environment' [4].
The warning includes advice to see `org-beamer-frame-environment'.

* etc/ORG-NEWS (New option ~org-beamer-frame-environment~): Announce
the new option.

Rationale: Code with \begin{frame} or \end{frame} cannot be embedded
in a verbatim environment inside a beamer frame due to a design
decision made by the beamer developers [1].  As suggested in that
report, defining an alias for the beamer frame environment will allow
such verbatim examples to compile correctly [2].

This solution also works with instances of \againframe.

Refs:
[1] https://github.com/josephwright/beamer/issues/360
[2] https://github.com/josephwright/beamer/issues/360#issuecomment-708705250
[3] https://list.orgmode.org/orgmode/87le8eg1hs.fsf@localhost/T/
[4] https://list.orgmode.org/orgmode/87il38i5tb.fsf@localhost/T/
2024-02-21 13:46:32 +03:00
Ihor Radchenko 0dd2c5ea39
Merge branch 'bugfix' 2024-02-19 13:20:47 +03:00
Ihor Radchenko d5b98bcfb5
org-dynamic-block-define: Clarify that FUNC must accept zero arguments
* lisp/org.el (org-dynamic-block-define): Update the docstring.

Reported-by: chris <inkbottle007@gmail.com>
Link: https://orgmode.org/list/5790810.DvuYhMxLoT@nixos
2024-02-19 13:19:11 +03:00
Ihor Radchenko d6c3ab08b4
org-dynamic-block-insert-dblock: Do not call non-commands interactively
* lisp/org.el (org-dynamic-block-insert-dblock): When insert command
for a dynamic block is not interactive, do not try to call it
interactively.

Reported-by: chris <inkbottle007@gmail.com>
Link: https://orgmode.org/list/5790810.DvuYhMxLoT@nixos
2024-02-19 13:18:10 +03:00
Martin Edström a8443f2c79
org-latex-to-html-convert-command: Enhance the docstring
* org.el (org-latex-to-html-convert-command): Add a note in the
docstring about proper shell-quoting.

It can trip you up because wrongly quoted input still works with some
math snippets, so the command may work during testing but not later
when you have different math snippets in play.

TINYCHANGE
2024-02-19 11:28:06 +03:00
Ihor Radchenko d314882301
org-narrow-to-subtree: Fix when current narrowing intersects subtree
* lisp/org.el (org-narrow-to-subtree): Fix error when current
narrowing intersects the current subtree.  When intersection happens,
behave historically, like the previous version of the command (that
did not use org-element).
2024-02-18 17:47:18 +01:00
Ihor Radchenko 7360c6b427
Merge branch 'bugfix' 2024-02-18 17:29:35 +01:00
Ihor Radchenko 85aafac417
ox-md.el: Fix adding blank lines between table rows in derived exporters
* lisp/ox-md.el (org-md-separate-elements): Do not add blank lines
between table cells.  Even though table-cell elements are not exported
by ox-md itself, derived backends do not expect blank lines appearing
there.

Reported-by: Rohit Patnaik <quanticle@quanticle.net>
Link: https://orgmode.org/list/d84d5df0-108f-4a75-b7d2-299392613052@app.fastmail.com
2024-02-18 17:25:27 +01:00
Ihor Radchenko ea487bffb5
org-fold-hide-drawer-all: Do not use point and mark when no region is active
* lisp/org-fold.el (org-fold-hide-drawer-all): Do not unconditionally
use point and mark.  Only use region boundaries when the region is
active.
2024-02-18 11:48:50 +01:00
Ihor Radchenko 388ba5b5c4
org-insert-link: Do not expand path arg when `org-link-file-path-type' is a function
* lisp/ol.el (org-insert-link): Drop `expand-file-name'.
(org-link-file-path-type): Update docstring.
* etc/ORG-NEWS (When ~org-link-file-path-type~ is a function, its
argument is now a filename as it  in the link; not an absolute
path): Announce the change.

Link: https://orgmode.org/list/871qahl0un.fsf@localhost
2024-02-17 16:25:19 +01: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 0e1f0e1605
ox-latex: Make errors/warnings during PDF generation more obvious
* lisp/ox-latex.el (org-latex-compile--postprocess): Display a
warning, not message when there are problems with PDF generation.
2024-02-14 15:34:19 +01:00
Juan Manuel Macias 9eec4af620
lisp/ox-latex.el: Add missing character warnings
* (org-latex-known-warnings): Two missing character warnings are
added: one for LuaLaTeX/XelaTeX and another for pdfLaTeX.
2024-02-14 15:29:30 +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