Commit Graph

27672 Commits

Author SHA1 Message Date
Mattias Engdegård d0c29cfdf9 Backport commit af4791b57 from Emacs
* lisp/org.el (org-display-inline-remove-overlay):
Update the base variable after performing a destructive deletion,
where it was obvious that this was intended.

Fix apparently wrong `delete` and `delq` value discards (bug#61730)
af4791b5706f494d73fd00c391ff867fb2c5a06d
Mattias Engdegård
Wed May 24 23:01:10 2023 +0200
2024-05-28 22:58:43 -04:00
Stefan Monnier d8e47abb75 Backport commit 54d40577c from Emacs
* lisp/org-table.el (org-table-make-reference): Don't use `eq` to
compare against literal strings.

(org-table-make-reference): Fix compiler warning
54d40577c4bb64d25db030b7d11ab553364e375d
Stefan Monnier
Mon Apr 10 21:33:56 2023 -0400
2024-05-28 22:58:42 -04:00
Kyle Meyer 898b5c4da5 org-macs: Autoload org-element-with-disabled-cache
* lisp/org-macs.el (org-element-with-disabled-cache): Autoload.

Otherwise compiling lisp/org/org-loaddefs.el in the Emacs tree will
warn that org-element-with-disabled-cache is not known to be defined.
2024-05-27 22:55:14 -04:00
Kyle Meyer 464d668ead Clean up spacing to pass Emacs's pre-commit check
Avoid trailing spaces and spaces before tabs.
2024-05-27 21:18:59 -04:00
Ihor Radchenko 0450cf0e85
Fix test failures for thingatpt support on Emacs 27
* testing/lisp/test-org.el (test-org/thing-at-point/url): Disable test
in old Emacs that do not yet support custom
`thing-at-point-provider-alist'.
* etc/ORG-NEWS (Org links now support ~thing-at-point~): Clarify Emacs
versions where the new feature is supported.
2024-05-27 14:27:35 +02:00
Ihor Radchenko 6f152d8914
lisp/org.el (org-mode): Fix thingatpt support for Emacs 27 2024-05-26 17:53:57 +02:00
Jim Porter 66cb45658d
Add support for 'thing-at-point' to get URL at point
* lisp/org.el (thingatpt): Require.
(org--link-at-point, org--bounds-of-link-at-point): New functions...
(org-mode): ... add to 'thing-at-point-provider-alist' and friends.

* testing/lisp/test-org.el (test-org/thing-at-point/url): New test.

* etc/ORG-NEWS: Announce this change.
2024-05-26 14:51:31 +02:00
Ihor Radchenko 09f339c9dd
org-element-cache: Fix tracking changes in indirect buffers for overlay folding
* lisp/org-fold-core.el (org-fold-core-decouple-indirect-buffer-folds):
(org-fold-core--property-symbol-get-create): Make
`org-fold-core-cycle-over-indirect-buffers' track indirect buffers
even with `org-fold-core-style' = 'overlays.  This is necessary to
keep org-element-cache working.
* lisp/org-element.el: Add FIXME - we should eventually pull out
`org-fold-core-cycle-over-indirect-buffers' as it is used out of scope
of folding.
2024-05-25 14:22:17 +02:00
Morgan Smith a3c1a85021
Fix typos surrounding `org-agenda-skip-scheduled-repeats-after-deadline'
* etc/ORG-NEWS: Fix typos.
* testing/lisp/test-org-agenda.el: Fix typos.
2024-05-24 19:56:07 +02:00
Ihor Radchenko 1c5492263f
etc/ORG-NEWS: Re-organize and document news sections
* etc/ORG-NEWS: Add comments explaining the purpose of each of the
sections in the NEWS.  Refile the news entries accordingly.
2024-05-22 15:11:59 +02:00
Ihor Radchenko 0e5ac43324
lisp/ox-html.el: Convert :alt to :aria-label attribute in svg images
* lisp/ox-html.el (org-html--svg-image): When svg image has :alt
attribute, convert it to :aria-label instead.
(org-html--format-image): Pass default :alt attribute based on the
file name to `org-html--svg-image'.
2024-05-22 11:23:47 +02:00
Ihor Radchenko 302bc6393a
Revert "ox-html: Use <img> tags for svgs, not <object>"
This reverts commit d96e897579.

See https://orgmode.org/list/87r0dy3u91.fsf@localhost
2024-05-22 11:01:05 +02:00
Ihor Radchenko 895a367a67
Revert "lisp/ox-html.el: Restore org-svg class."
This reverts commit 9364b2d894.
2024-05-22 11:00:49 +02:00
Ihor Radchenko b2520ec52f
ob-haskell: Remove FIXME
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): The answer to
question asked in FIXME is that -i flag is handled later, in regex
search.  There is nothing to fix.
2024-05-21 15:58:40 +02:00
Ihor Radchenko b26337c255
oc-csl: Use `org-require-package' instead of `org-cite-csl--barf-without-citeproc'
* lisp/oc-csl.el (org-cite-csl--barf-without-citeproc): Remove.
(org-cite-csl-render-citation):
(org-cite-csl-render-bibliography):
(org-cite-csl-finalizer): Use `org-require-package'.
2024-05-21 15:57:15 +02:00
Ihor Radchenko 5fcd1d9def
org-save-markers-in-region: Store log note marker
* lisp/org.el (org-save-markers-in-region): Store
`org-log-note-marker' when storing and reinstalling Org markers.

This change automatically handles note taken after refiling/archiving
without trying to place the note in place of the moved
subtree/heading.

Link: https://orgmode.org/list/m2plyjid8q.fsf@kyon.home
2024-05-21 13:36:39 +02:00
Ihor Radchenko 41c2e7af10
Add missing :package-version keywords to new and changed `defcustom'
* lisp/ob-comint.el (org-babel-comint-fallback-regexp-threshold):
* lisp/ob-exp.el (org-babel-exp-code-template):
(org-babel-exp-inline-code-template):
* lisp/org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown):
(org-agenda-sorting-strategy):
* lisp/org-attach.el (org-attach-store-link-p):
* lisp/org-capture.el (org-capture-templates):
* lisp/org-fold-core.el (org-fold-core-style):
* lisp/org-footnote.el (org-footnote-auto-label):
* lisp/org.el (org-latex-to-mathml-convert-command):
(org-latex-to-html-convert-command):
(org-latex-default-packages-alist):
(org-display-remote-inline-images):
* lisp/ox-beamer.el (org-beamer-environments-extra):
* lisp/ox-latex.el (org-latex-known-warnings):
2024-05-21 13:15:12 +02:00
Ihor Radchenko 8d43ab9ca9
orgtbl-setup: Resolve FIXME
* lisp/org-table.el (orgtbl-setup): Move setting up keymap to top
level instead of awkward re-`defun' used previously to ensure that
setup is evaluated once.  Make it possible to honor the value of
`orgtbl-optimized' during runtime, if it is changed.
(orgtbl-mode): Remove re-`defun'.
2024-05-21 12:21:29 +02:00
Ihor Radchenko e6c7b0f15e
testing/lisp/test-org.el (test-org/org-todo-prefix): Add test case 2024-05-21 12:12:11 +02:00
Ihor Radchenko b34b5baffc
lisp/org-keys.el: Remove support of obsolete `org-speed-commands-user'
* lisp/org-keys.el (org--print-speed-command): Update the docstring.
(org-speed-command-help):
(org-speed-command-activate): Remove code supporting
`org-speed-commands-user'.
2024-05-21 11:50:29 +02:00
Ihor Radchenko 81f84ae679
testing/lisp/test-org.el (test-org/org-ctrl-c-ctrl-c): Add test case 2024-05-21 11:47:26 +02:00
Ihor Radchenko 102f0a24c9
Do no assume that todo keywords are full words
* lisp/org-agenda.el (org-agenda):
(org-agenda-list-stuck-projects):
* lisp/org-clock.el (org-clock-in):
(org-clock-out):
* lisp/org.el (org-show-todo-tree): Do not enforce that word boundary
always matches after todo keyword \>.  Instead use a more accurate
match - space or eol.  Also, regexp-quote the todo keywords when
searching them.

Reported-by: Kepa <gnu.cognition199@slmails.com>
Link: https://orgmode.org/list/171620796695.7.14337986338068154257.334928503@slmails.com
2024-05-21 11:40:36 +02:00
Ihor Radchenko 6799350a85
org-manual: Explain how to handle ; inside formulas
* doc/org-manual.org (Emacs Lisp forms as formulas): Show an example
how to resolve ambiguity when the formula contains ;.

Reported-by: Nick Dokos <ndokos@gmail.com>
Link: https://orgmode.org/list/87ply5v1gj.fsf@localhost
2024-05-21 11:24:39 +02:00
Ihor Radchenko bae1b1fe70
Revert "org-table-eval-formula: Fix parsing of mode string when formula has ;"
This reverts commit 5af0625113.

The commit broken handling custom `format' spec for formula results:

Reported-by: Daniel Clemente <n142857@gmail.com>
Link: https://orgmode.org/list/CAJKAhPDFrgZY6sgefxu85qjEXnE2_HkPCHzbDOLsAD4Je57z7w@mail.gmail.com
2024-05-21 11:09:46 +02:00
Ihor Radchenko 3f539bc3d6
org-manual: Add better opening description to "Citation handling" section
* doc/org-manual.org (Citation handling): Rewrite the opening
paragraphs describing citations using less technical description.  The
new version aims to ordinary Org mode users and avoids talking about
Elisp libraries.
(Citations): Unify markup for citation processor names (use verbatim).
Mention that at least one #+PRINT_BIBLIOGRAPHY is mandatory to render
output.  Indicate that default citation style is "nil".
2024-05-20 15:24:13 +02:00
Ihor Radchenko 4049742044
lisp/ox-html.el (org-html-template): Remove Emacs 22 compatibility
Emacs 22 support is long-dropped.  We no longer need to be backwards
compatible with it.  Also, Org mode no longer works with Emacs 22, so
there is no point keeping this code.
2024-05-20 15:11:11 +02:00
Ihor Radchenko 9a02750501
lisp/org.el (org-display-inline-images): Remove FIXME
Addressing this FIXME would include implementing image cache flushing
feature in Emacs itself.  A bit too much for a FIXME in Org code.
2024-05-20 15:10:31 +02:00
Ihor Radchenko 8bea06ce93
lisp/org-element.el (org-element--cache-active-p): Remove FIXME
It is not 100% clear if inlining `org-element--cache-active-p' will
yield practical improvements.  So, let's not litter the code base with
such FIXMEs.
2024-05-20 15:09:51 +02:00
Ihor Radchenko 7ef578dd4e
lisp/org-element.el (org-element--current-element): Remove FIXME
`org-item-re' is caching its results, so it is ok to use it.
2024-05-20 15:09:23 +02:00
Ihor Radchenko 0af8d7bf40
etc/ORG-NEWS: Move more impacting changes near the top for Org 9.7 release 2024-05-20 14:04:34 +02:00
Ihor Radchenko bf71c8c597
lisp/ob-scheme.el: Fix mit-scheme evaluation
* lisp/ob-scheme.el (org-babel-scheme-execute-with-geiser): Do not
sent top comment when evaluating code block.  mit-scheme has problems
processing it for some reason.
2024-05-19 15:38:45 +02:00
Kris Nelson c0b66bf9c1
org-log-beginning: Fix error creating LOGBOOK drawer at end of buffer
* lisp/org.el (org-log-beginning): Fix regression after 288c7069c where
"Error in post-command-hook (org-add-log-note): (end-of-buffer)"
is displayed after creating the LOGBOOK drawer on a heading which is
at the end of the buffer.

Reported-by: Kris Nelson <kris@kristofernelson.com>
Link: https://orgmode.org/list/766237934.317726.1715720181047@office.mailbox.org

TINYCHANGE
2024-05-19 13:43:24 +02:00
Ihor Radchenko 5af0625113
org-table-eval-formula: Fix parsing of mode string when formula has ;
* lisp/org-table.el (org-table-eval-formula): Use more strict regexp
to detect mode string in formulas.
* testing/lisp/test-org-table.el (test-org-table/eval-formula): Add
test.

Reported-by: Nick Dokos <ndokos@gmail.com>
Link: https://orgmode.org/list/87ply5v1gj.fsf@localhost
2024-05-19 13:10:49 +02:00
Ihor Radchenko 6d5fa81984
ox-md, ox-ascii, ox-texinfo: Strip blank lines from paragraphs
* lisp/org-macs.el (org-remove-blank-lines): New helper function to
strip blank lines from string.
* lisp/ox-ascii.el (org-ascii-paragraph):
* lisp/ox-latex.el (org-latex-paragraph):
* lisp/ox-md.el (org-md-paragraph):
* lisp/ox-texinfo.el (org-texinfo-paragraph): Strip blank lines from
paragraphs - these exporters are using blank lines as paragraph
separators.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/v00le7$frp$1@ciao.gmane.io
2024-05-19 12:01:55 +02:00
Ihor Radchenko 14848726a0
org-export-data: Handle trailing spaces when transcoder returns nil
* lisp/ox.el (org-export--keep-spaces): New helper function containing
logic about keeping spaces in place of removed object from
`org-export--prune-tree'.  The logic is modified to keep spaces in the
case when previous plain-string object ends with a whitespace, but not
" " or "\t".  This can happen, for example, when there is a trailing
zero-width space.  We do want to keep spaces in such scenario.
(org-export-data): When transcoder returns nil, handle
trailing spaces after an object the same way `org-export--prune-tree'
does.  Remove special handling of export snippets that unconditionally
keep their trailing spaces.
(org-export--prune-tree): Use the helper function.
* testing/lisp/test-ox.el (test-org-export/export-snippet): Adjust test.

Link: https://orgmode.org/list/87h6fwmgkm.fsf@localhost
2024-05-19 12:01:54 +02:00
Joris Caravati f3e306c737
lisp/org.el: Add `org-after-note-stored-hook'
* lisp/org.el: Add `org-after-note-stored-hook' which is called at the
end of the `org-store-log-note' function.
* etc/ORG-NEWS: Document the new hook.

TINYCHANGE
2024-05-18 13:20:18 +02:00
Anand Deopurkar 0ebb36caea
lisp/org-capture.el: Restore org-store-link-plist
* org-capture.el (org-capture-fill-template): Restore original
`org-store-link-plist' after calling `org-store-link'.

To replace a %K escape (link to currently clocked task),
`org-capture-fill-template' calls `org-store-link'.  This call has the
side-effect of replacing the contents of `org-store-link-plist'.  As a
result, expected template expansions using the original
`org-store-link-plist' do not happen.

For example, suppose `org-capture' is called from a message buffer with the
template "%:subject %:from" while the clock is running.  Then
%:subject and %:from are not substituted because of the behaviour
above.  If the clock is not running, there is no problem.

Current fix restores `org-store-link-plist' to its original value
after `org-capture-fill-template' calls `org-store-link'.

TINYCHANGE
2024-05-18 12:52:04 +02:00
Ihor Radchenko ee58259bc7
org-duration-from-minutes: Accept negative durations
* lisp/org-duration.el (org-duration-from-minutes): Allow MINUTES
argument to be negative.

Reported-by: Raffael Stocker <r.stocker@mnet-mail.de>
Link: https://orgmode.org/list/yplmzfsrqjw6.fsf@mnet-mail.de
2024-05-17 14:43:04 +03:00
Ihor Radchenko 288c7069c4
org-log-beginning: Fix extra blank line created after LOGBOOK drawer
* lisp/org.el (org-log-beginning): Fix regression after f63ff07441
when additional blank is created after newly added LOGBOOK drawer.

Reported-by: Kris Nelson <kris@kristofernelson.com>
Link: https://orgmode.org/list/766237934.317726.1715720181047@office.mailbox.org
2024-05-17 14:19:29 +03:00
Ihor Radchenko ea8ed59c02
etc/ORG-NEWS (Org mode now fontifies...): Add references to manual
* etc/ORG-NEWS (Org mode now fontifies whole table lines (including
newline) according to ~org-table~ face): Add references to the manual
that explain how to set face 'inherit attribute.

Link: https://orgmode.org/list/87le4dfowy.fsf@yandex.com
2024-05-17 14:04:00 +03:00
Max Nikulin b4d17c0629
ORG-NEWS: Reword inline image width note
* etc/ORG-NEWS: Avoid possible confusion related to
"#+attr_org: :width" example.
2024-05-13 15:40:02 +03:00
Ihor Radchenko f326cd58ba
org-display-inline-image--width: Fix unparable non #+ATTR_ORG widths
* lisp/org.el (org-display-inline-image--width): When there are
multiple #+ATTR_BACKEND :width attributes, skip over all the
attributes that cannot be parser to a number.  This way

 #+attr_html: :alt Image width test
 #+attr_beamer: :width \linewidth
 #+attr_latex: :width +.5\textwidth
 #+attr_md: :width 75%
 [[file:~/Downloads/wallpaper.png]]

will get +.5 relative width even though #+attr_beamer does specify
some :width value (not a number).

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/875xvoshex.fsf@localhost
2024-05-13 15:36:13 +03:00
Ihor Radchenko aa71facf6d
Respect `org-auto-align-tags' in all the editing commands
* lisp/org-mobile.el (org-mobile-edit):
* lisp/org.el (org-insert-heading):
(org-edit-headline):
(org-priority):
(org-set-tags):
(org-entry-put):
(org-self-insert-command):
(org-delete-backward-char):
(org-delete-char):
(org-kill-line): Only re-align tags when `org-auto-align-tags' is set
to non-nil.
* etc/ORG-NEWS (~org-auto-align-tags~ is now respected universally):
Announce the breaking change.

Link: https://orgmode.org/list/87msxoc3qp.fsf@localhost
2024-05-13 15:10:35 +03:00
Ihor Radchenko 62356cb44b
lisp/org.el (org-block-map): Fix mapping over nested blocks
* lisp/org.el (org-block-map): Do not bypass the whole block when
mapping.  Look inside the block body for child blocks as well.

Reported-by: mahmood sheikh <mahmod.m2015@gmail.com>
Link: https://orgmode.org/list/CAOj1L_cx9XP5fS3_=x=UJSSt3xjcfcQ68Uef6E4DTi68Kr_ABw@mail.gmail.com
2024-05-13 14:59:45 +03:00
Ihor Radchenko fffb87174e
testing/lisp/test-ox-md.el (ox-md/headline-style): New test 2024-05-12 14:53:39 +03:00
Lee Thompson 1a7d7a5a5b
lisp/ox-md.el: New mixed-style option for `org-md-headline-style'
* lisp/ox-md.el (org-md-headline-style): New setting `mixed' allows
for mixing Setext and ATX-style headlines when exporting to Markdown.
* doc/org-manual.org (Header and sectioning structure): Document
`mixed' headline style.
* etc/ORG-NEWS (New allowed value of ~org-md-headline-style~ to mix
ATX and Setext style headlines): Document the new feature.

When exporting to Markdown, there was previously no obvious way of
mixing Setext-style and ATX-style headlines.  Via the
`org-md-headline-style' custom setting, headlines could be exported as
either all-Setext or all-ATX, but not as a mix.

With this change setting `org-md-headline-style' to `'mixed' will
export the first two headline levels as Setext-style Markdown
headlines and the rest as ATX-style.

TINYCHANGE
2024-05-12 14:53:34 +03:00
Ihor Radchenko bc51dfcb74
org-agenda-kill: Fix deleting wrong entry when Org buffer is narrowed
* lisp/org-agenda.el (org-agenda-kill): Use `org-with-point-at' to
jump to origin Org buffer from agenda.  It automatically widens the
buffer.
(org-remove-subtree-entries-from-agenda): Temporarily lift narrowing
when calculating the list of headings to clean up from the agenda.

Link: https://old.reddit.com/r/emacs/comments/1cog1fb/agenda_kills_wrong_item_in_orgmode_when_buffer_is/
2024-05-11 19:32:50 +03:00
Ihor Radchenko db5478108c
org-agenda-tree-to-indirect-buffer: Obey `org-indirect-buffer-display'
* lisp/org-macs.el (org-display-buffer-in-window): New helper function
to display buffer in specific window (when it is live).
* lisp/org.el (org-tree-to-indirect-buffer): By default, reuse the
window previously used for an existing indirect buffer, if it is in
the same frame.
* lisp/org-agenda.el (org-agenda-do-tree-to-indirect-buffer): Remove.
(org-agenda-tree-to-indirect-buffer): Merge with
`org-agenda-do-tree-to-indirect-buffer' and remove special handling of
the existing indirect buffer window that overrides
`org-indirect-buffer-display'.
(org-agenda-do-context-action): Force `org-indirect-buffer-display' to
be 'other-window when displaying subtree at point in
org-agenda-follow-mode.

This patch reverts 35d6d9f50, implementing an alternative fix for
stabilizing indirect buffer window selection.  Unlike the existing
fix, it utilizes display buffer action and does not cause clashes with
custom `org-indirect-buffer-display'.

Reported-by: JV <misc@jeffvalk.com>
Link: https://orgmode.org/list/1a4c7a04-8536-40c7-899e-ba433a1252fd@jeffvalk.com
2024-05-11 16:19:52 +03:00
Ihor Radchenko e36a4fe20e
org-html-final-function: Suppress mode hooks when indenting
* lisp/ox-html.el (org-html-final-function): When setting indentation,
use defaults, suppressing major mode hook.  If we do not, all kinds of
user code may be executed.

This fix will only work starting from Emacs 30, after bug#70671 is
fixed:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70671

Reported-by: arozbiz@gmail.com
Link: https://orgmode.org/list/87tu21hsuk.fsf@localhost
2024-05-11 13:02:10 +03:00
Ihor Radchenko 4131926984
org: New Org-wide custom option `org-sort-function'
* lisp/org-macs.el (org-sort-function): New customization defining how
Org mode should sort headlines, table lines, agenda lines, etc.
(org-string<):
(org-string<=):
(org-string>=):
(org-string>): Use the new customization.
(org-string<>): Add docstring.
(org-sort-function-fallback): New helper function to help users on
MacOS where `string-collate-lessp' is not reliable.
* lisp/oc-basic.el (org-cite-basic--field-less-p):
* lisp/org-agenda.el (org-cmp-category):
(org-cmp-alpha):
* lisp/org-list.el (org-sort-list):
* lisp/org-mouse.el (org-mouse-list-options-menu):
* lisp/org-table.el (org-table-sort-lines):
* lisp/org.el (org-tags-sort-function):
(org-sort-entries):
* lisp/ox-publish.el (org-publish-sitemap): Honor the new
customization.
* lisp/org-mouse.el (org-mouse-tag-menu):
(org-mouse-popup-global-menu):
* lisp/org-agenda.el (org-cmp-tag): Honor `org-tags-sort-function' and
falling back to `org-string<' if note set.
* etc/ORG-NEWS (New option controlling how Org mode sorts things
~org-sort-function~): Announce the change.

This change aims to standardize the way Org mode performs sorting of
user data.  In particular, it addresses issues with oddities of string
collation rules on MacOS and tricky language environments like
Turkish.

Link: https://orgmode.org/list/87jzleptcs.fsf@localhost
2024-05-11 12:34:30 +03:00