Commit Graph

5867 Commits

Author SHA1 Message Date
TEC 2a78c11a96
NOPUSH org: Don't fill displayed equations in text
* list/org.el (org-fill-element): If a displayed equation (\[ ... \])
starts on its own line, it should not be filled into the rest of the
text. I.e.,

some nice text
\[
  1+1=2
\]
more text.

should not become,

some nice text \[ 1+1=3 \] more text.

While the above example may not look bad, with non-trivial equations
this can become quite messy.
2024-04-16 20:07:28 +08:00
TEC 8d3909de66
NOPUSH org-src: Prettify inline results
* lisp/org.el (org-inline-src-prettify-results):

* lisp/org-src.el (org-fontify-inline-src-blocks-1):
2024-04-16 20:07:28 +08:00
TEC 4f0592b21b
org: Introduce semantic seperator fontification
* lisp/org.el (org-fontify-semantic-seperator,
org-set-font-lock-defaults): TODO
2024-04-16 19:58:50 +08:00
TEC 4280eb3869
org-latex-preview: Put :page-width in opt plist
* lisp/org-latex-preview.el (org-latex-preview-options,
org-latex-preview-appearance-options): Rename
`org-latex-preview-options' to `org-latex-preview-appearance-options',
as it better reflects the purpose of the variable.

(org-latex-preview--tex-styled, org-latex-preview--image-extract-async,
org-latex-preview--create-tex-file,
org-latex-preview--create-image-async, org-latex-preview--hash,
org-latex-preview-place, org-latex-preview--update-overlay): Put the
page width specification in `org-latex-preview-appearance-options', and
adjust existing code to handle this new structuring.

* lisp/ox-html.el (org-html-prepare-latex-images,
org-html-latex-image-options): Adjust for the
`org-latex-preview-appearance-options' rename, and put :page-width in
the options plist, just with a raised value of 1.0 as the HTML default.

* lisp/org.el (org-do-latex-and-related, org-latex-preview-options),
org-compute-latex-and-related-regexp): Adjust for the
`org-latex-preview-appearance-options' rename.

* lisp/org-compat.el: Adjust for the
`org-latex-preview-appearance-options' rename.

* lisp/ob-latex.el (org-babel-execute:latex, org-latex-preview-header)):
Adjust for the `org-latex-preview-appearance-options' rename.

* etc/ORG-NEWS: Adjust for the `org-latex-preview-appearance-options'
rename.

* doc/org-manual.org (Previewing LaTeX fragments): Adjust for the
`org-latex-preview-appearance-options' rename.
2024-04-16 19:58:50 +08:00
TEC 5dbe159407
org-latex-preview: Support symbol entrypoint args
* lisp/org-latex-preview.el (org-latex-preview): Refactor to support a
symbol-value "mode" argument as well as prefix arguments.  This stops
forcing programmatic invocations from having to use uninformative
values, and actually makes the implementation slightly nicer to read I
think.

* lisp/org.el: Change the argument in the preview startup invocation to 'buffer.
2024-04-16 19:58:50 +08:00
TEC 0d28e6ef72
org: Update LaTeX overlay during fontification
* lisp/org.el (org-do-latex-and-related, org-latex-preview-options): To
ensure that LaTeX preview overlays update as the face changes (for
instance, when in a heading that changes level), the face used is
updated during fontification when applicable.  This also ensures that
the correct face is used when JIT fontification is active.
2024-04-16 19:58:49 +08:00
TEC ba4e542fc1
org-latex-preview: Lazy-load, with autoloads
* lisp/org.el: No longer require org-latex-preview.

* lisp/org-latex-preview.el: Require the relevant files, and add
autoload tokens to `org-latex-preview-options',
`org-latex-preview-process-alist' (for backwards compatibility),
`org-latex-preview-auto-mode', `org-latex-preview' (the major likely
entry points), and `org-latex-preview-place` (potential external entry
point).
2024-04-16 19:58:49 +08:00
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 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 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 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 096ecc9e24
Update version number for the 9.6.26 release 2024-04-12 09:53:47 +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 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 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
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 9bff93f19a
Update version number for the 9.6.25 release 2024-04-05 10:29:48 +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
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 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 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 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
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
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 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
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
Ihor Radchenko 28dc5dd1ac
Update version number for the 9.6.21 release 2024-03-08 11:34:42 +03:00