0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 08:32:53 +00:00
Commit graph

18402 commits

Author SHA1 Message Date
Ihor Radchenko 32b64607ad
org-element-cache-map: Fix when inside indirect buffer
* lisp/org-element.el: Query cache variables from the base buffer.
They are only kept up-to-date there.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Reported-by: Hanno Perrey <hanno@hoowl.se>
Link: https://orgmode.org/list/87pmau4fi3.fsf@hoowl.se
2023-02-01 00:18:56 +03:00
Ihor Radchenko c340e799f8
org-element-cache-map: Always continue after point set by FUNC
* lisp/org-element.el (org-element-cache-map): Never map over element
starting before the point manually moved (or set via
`org-element-cache-map-continue-from') by FUNC.
* testing/lisp/test-org.el (test-org/map-entries): Add tests.

Reported-by: Matthieu Caneill <matt@brokenwa.re>
Link: https://orgmode.org/list/Y9MKUzWWbErLFhmq@brokenwa.re
2023-01-30 12:05:29 +03:00
Ihor Radchenko c45a058928
org-follow-timestamp-link: Fix when org-agenda is not yet loaded
* lisp/org.el (org-follow-timestamp-link): Explicitly require
org-agenda.

Reported-by: Michael Maurer <maurer.michael@gmail.com>
Link: https://orgmode.org/list/CAH-0+bBaYEWLkQ3XVuuO+qiXDwQC+9JB0D2y9nti-a5uvNzEeA@mail.gmail.com
2023-01-27 13:34:22 +03:00
Arash Esbati 65ca7bc6a7
lisp/ox.el: Pacify compiler warning
* lisp/ox.el (org-export-to-buffer): Escape single quote in the
example given in docstring.
Add missing '.' after the abbreviation.
2023-01-26 12:18:49 +03:00
Ihor Radchenko 1bcab6c04f
org-assert-version: Clarify that Org loading is aborted
* lisp/org-macs.el (org-assert-version): Explicitly state that Org
loading is aborted.  Some users otherwise assume that the warning can
be ignored.  Also, remove sentence about `load-path' as it is
explained later in the warning text.
2023-01-24 23:12:32 +03:00
Ihor Radchenko 20ee7b85eb
fixup! org-fix-agenda-info: Fix Emacs <28 compatibility 2023-01-24 21:08:49 +03:00
Ihor Radchenko 5bbb97f3df
org-fix-agenda-info: Fix Emacs <28 compatibility
* lisp/org-agenda.el (org-fix-agenda-info): Do not use `string-pad'
that is only available since Emacs 28.  Instead, use the expression
used as default value of `calendar-iso-date-display-form'.

Reported-by: Aaron L. Zeng <me@bcc32.com>
Link: https://orgmode.org/list/20230124025259.1301063-1-me@bcc32.com
2023-01-24 12:16:19 +03:00
Kyle Meyer e37e9b692e org-persist: Silence recent byte-compiler warning
* lisp/org-persist.el: Bind pp-use-max-width to silence byte-compiler
warning about unused lexical variable.

Note that loading pp.el upfront rather than relying on the pp function
being autoloaded would also eliminate the warning, but that would only
work on Emacs 29 or later because earlier versions do not have the
pp-use-max-width option.
2023-01-22 21:45:57 -05:00
Kyle Meyer 6ae5430962 Merge branch 'km/from-emacs-29' into bugfix 2023-01-22 21:33:37 -05:00
Dmitry Gutov ebaf1c9c04 Backport commit 347933377 from Emacs
* lisp/ob-ruby.el: Fix outdated comments.

lisp/org/ob-ruby.el: Fix outdated comments.
34793337783489297313c67d4a56682514877597
Dmitry Gutov
Fri Jan 20 23:32:21 2023 +0200
2023-01-22 21:33:13 -05:00
Stefan Kangas 0ab9bc138f Backport commit 920a7d38e from Emacs
; Fix typos
920a7d38e96134289393b7bfcc3a7b88be73925b
Stefan Kangas
Sun Jan 15 02:14:19 2023 +0100

[km] These were likely not typos but intended as an abbreviation for
     "if and only if".  However, using "if" works fine in these spots,
     so let's just go along with the change.  (These may end up being
     reverted on Emacs's side; see emacs-devel
     <83a62k72lx.fsf@gnu.org>, 01-15.)
2023-01-22 21:33:13 -05:00
Ihor Radchenko 15c519b84c
Do not assume that `org-string-width' preserves match data
* lisp/org-table.el (org-table-blank-field):
(org-table-clean-line): Avoid `org-string-width' modifying match data.

As long as `org-string-width' creates a new window buffer, third-party
modes and Emacs distributions might modify the match data in buffer
hooks.  Hence, we cannot assume that match data is not modified even
though `org-string-width' code itself does not alter the match data.

Note: Adding `save-match-data' around function calls is generally a
good practice when the surrounding code relies on the match data being
intact.  Elisp conventions don't prohibit functions to modify match
data without notice in their docstring.

Reported-by: Thomas Schneider <qsx@chaotikum.eu>
Link: https://orgmode.org/list/wwufsc7edzu.fsf@chaotikum.eu
2023-01-20 12:01:24 +03:00
Ihor Radchenko ecdb442044
org-persist: Work around Emacs bug#58687
* lisp/org-persist.el (org-persist--write-elisp-file): Bind
`pp-use-max-width' to nil when using `pp'.  Otherwise, printing
quickly becomes slow.

Reported-by: Michael Eliachevitch <m.eliachevitch@posteo.de>
Link: https://orgmode.org/list/87wn8tb3zp.fsf@posteo.de
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58687
2023-01-20 11:44:57 +03:00
Ihor Radchenko cbb288eaa5
ob-core: Do not use `temporary-file-directory' function
* lisp/ob-core.el (org-babel-temporary-stable-directory): Use
`temporary-file-directory' variable instead of function.  The function
returns value depending on the `default-directory' at Org startup time
thus creating unpredictable temporary babel locations that may
sometimes litter current directory.

Reported-by: bhrgunatha <bhrgunatha@gmail.com>
Link: https://orgmode.org/list/93b040e1-6dc6-487f-de89-a4cea9a560ff@gmail.com
2023-01-18 12:16:19 +03:00
Ihor Radchenko 5d9c9c27c6
* lisp/org-agenda.el: require 'org-element
Load org-element for agenda instead of relying on org-element being
loaded when agenda is ran.

Reported-by: zimoun <zimon.toutoune@gmail.com>
Link: https://orgmode.org/list/86r0vszn3w.fsf@gmail.com
2023-01-18 11:52:08 +03:00
Ihor Radchenko c7b976a052
org: Bump the minimal required Emacs version
* lisp/org.el: Bump required Emacs version to 26.1.

See https://orgmode.org/worg/org-maintenance.html#emacs-compatibility
2023-01-17 15:05:11 +03:00
Ihor Radchenko 12bcd322d0
Improve documentation for agenda starting day
* doc/org-manual.org (Weekly/daily agenda):
* lisp/org-agenda.el (org-agenda-start-on-weekday):
(org-agenda-start-day): Document that `org-agenda-start-on-weekday'
takes precedence over `org-agenda-start-day' when agenda span is 7 or
14 days.

Reported-by: Eppo Math <eppolito.math@gmail.com>
Link: https://orgmode.org/list/878ri67plt.fsf@localhost
2023-01-16 13:35:11 +03:00
Ihor Radchenko df4a5d86d8
org-fold: Fix isearch when `org-fold-core-style' is 'overlays
* lisp/org-fold-core.el (org-fold-core--isearch-show): Make sure that
the actual isearch match is revealed.  This relies on undocumented
behavior of isearch that point is at the match when
'isearch-open-invisible is called.
(org-fold-core-region): Disable 'isearch-open-invisible-temporary
features when `org-fold-core-style' is 'overlays.  This is to work
around the undocumented requirement of isearch to _not_ delete the
overlay passed to 'isearch-open-invisible-temporary function.  Since
`org-fold-show-set-visibility' may destroy overlays arbitrarily, we
cannot currently support isearch `org-fold-show-context-detail' in
full.

Reported-by: Matt Lundin <mdl@imapmail.org>
Link: https://orgmode.org/list/87zgb6tk6h.fsf@localhost
2023-01-16 12:21:57 +03:00
Ihor Radchenko 2e22a8b827
org-export-dictionary: Fix typo
* lisp/ox.el (org-export-dictionary): Fix encoding keyword.

Reported-by: Rafael Bento <rafael.bentoe.silva@gmail.com>
Link: https://orgmode.org/list/adda99a7-b21f-a33b-571d-b7bfd6d743e2@gmail.com
2023-01-14 16:28:49 +03:00
Ihor Radchenko 97a235cf1c
org-clock-timestamps-change: Preserve point position
* lisp/org-clock.el (org-clock-timestamps-change): Try harder to
preserve point position.  `save-excursion' is not sufficient here,
when the timestamp gets deleted in the process.

Reported-by: Johannes Dahl <muusik@gmail.com>
Link: https://orgmode.org/list/CAHuokSbJxM4kqjdT94aHmjnKqzOvpJpq3tJqOEqdswaBC=JnfA@mail.gmail.com
2023-01-13 11:57:19 +03:00
Ihor Radchenko cd967ce006
org-odt-plain-text: Fix `fill-column' value
* lisp/ox-odt.el (org-odt-plain-text): Use `most-positive-fixnum' to
unfill plain text elements.  `point-max' is not a safe large value
because, for example, Han script symbols often occupy two columns.

Reported-by: Cantoraz Chou <cantoraz@gmail.com>
Link: https://orgmode.org/list/CAJg5Zf00e+A_kuBmRh+h68u+3g_Cb_bLqRhR4rpFH=nenXvTdw@mail.gmail.com
2023-01-13 11:10:54 +03:00
Ihor Radchenko a52d0f0918
org-export-as: Fix subtree export when metadata ends right before heading
* lisp/ox.el (org-export-as): Only include first newline after heading
line when the metadata is non-empty.
* testing/lisp/test-ox.el (test-org-export/export-scope): Add test.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY1d=UEJ-6ZPG1X+st=fCfBAnTfgbVNhxyxH_xKcLGG4cQ@mail.gmail.com
2023-01-12 12:23:19 +03:00
Ihor Radchenko 89d13998bd
org-element-fixed-width-parser: Fix when :value is empty
* lisp/org-element.el (org-element-fixed-width-interpreter): Interpret
fixed-width element with :value "" as ":\n", not as empty string.
* testing/lisp/test-org-element.el (test-org-element/fixed-width-interpreter):
Fixed the test.

The previous test, albeit intentionally asserting "" result, breaks
reversibility of parse-interpret sequence.
2023-01-12 12:23:19 +03:00
Bastien 630f86dfc4 Update version number for the 9.6.1 release 2023-01-11 16:00:12 +01:00
Ihor Radchenko a6523f1aa0
org-export-output-file-name: Remove redundant `cond' clause
* lisp/ox.el: Remove `cond' clause equivalent to t.
2023-01-07 15:13:52 +03:00
Ihor Radchenko 5a8a1d4ff9
org-compile-file: Expand "~" in SOURCE
* lisp/org-macs.el (org-compile-file): Expand "~" in the source before
passing it as quoted shell argument.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25528.42190.53674.62381@gargle.gargle.HOWL
2023-01-07 15:12:41 +03:00
Ihor Radchenko 93339de71b
org-babel-shell-initialize: Fix `org-babel-prompt-command'
* lisp/ob-shell.el (org-babel-shell-initialize): Do not search shell
name string by `eq' in `org-babel-shell-set-prompt-commands' alist.
Use `assoc' that is comparing by `equal' instead.

Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/87h6x8kluc.fsf@localhost
2023-01-05 11:26:40 +03:00
Ihor Radchenko 58aeb1af15
org-persist-unregister: Fix when ASSOCIATED is 'all
* lisp/org-persist.el (org-persist-unregister): Do not try to
normalize 'all ASSOCIATED.  It is not a valid association that should
be handled specially.  Previously, an error was thrown.
2023-01-03 10:58:02 +03:00
Ihor Radchenko ce6f1799cc
org-options-keywords: Add missing keyword
* lisp/org.el: Add missing "EXPORT_FILE_NAME" that is mentioned in
13.2 Export Settings section of the manual.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25521.58663.963178.927459@gargle.gargle.HOWL
2023-01-02 12:07:17 +03:00
Ihor Radchenko 3454021483
Revert "org-babel-read: Obey `org-confirm-babel-evaluate'"
This reverts commit 10e857d428.

* lisp/ob-core.el:
(org-babel-merge-params):
(org-babel-process-params):
(org-babel-read):
* lisp/org-table.el: Add FIXME comments to places where arbitrary code
execution may happen.

The extra query is reverted until we develop a better code execution
safety system for Org.  The commit introduced too many user queries,
making the whole idea of asking users to execute code from Org files
not useful.

Link: https://orgmode.org/list/878rinadlq.fsf@localhost
2023-01-02 10:49:45 +03:00
Ihor Radchenko 1cd39c9e30
org-mode: Fix element cache updates when aligning tables during startup
* lisp/org.el (org-mode): Do not suppress modification hooks when
aligning tables.  Otherwise, cache state may become invalid.

Reported-by: Stefan <org@stefan.failing.systems>
Link: https://orgmode.org/list/87tu1wse45.fsf@localhost
2023-01-02 10:26:52 +03:00
Kyle Meyer 563a4396b6 org-assert-version: Deleting trailing whitespace
Otherwise this fails Emacs's pre-commit check.
2023-01-01 22:23:43 -05:00
Kyle Meyer 58e93869b7 Touch up copyright lines from cae528457
A few files had a copyright date of "2020-2020", and cae528457 (ported
by e0815d754) updated these to "2020, 2023-2020".  Correct these
spots.
2023-01-01 13:12:52 -05:00
Kyle Meyer 2f15b3c528 Merge branch 'km/from-emacs-29' into bugfix 2023-01-01 12:45:33 -05:00
Eli Zaretskii e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko 9cee879b36
org-assert-version: Small refactoring
* lisp/org-macs.el (org-assert-version): Make quoting "'" in the
message more readable.

Thanks to Stefan Monnier <monnier@iro.umontreal.ca> for the
suggestion.
2023-01-01 15:58:19 +03:00
Kyle Meyer e316377767 Merge branch 'km/from-emacs-29' into bugfix 2022-12-31 18:13:31 -05:00
Stefan Kangas 92a40cf7a1 Backport commit 9292f595a from Emacs
; Fix typos
9292f595a71870eec1ffdfd187b859cc990c2f0b
Stefan Kangas
Sat Dec 31 12:43:32 2022 +0100
2022-12-31 18:11:46 -05:00
Ihor Radchenko 62dc49509c
org-assert-version: Do not display "'" as "’" in the code sample
* lisp/org-macs.el (org-assert-version): Dislpay (straight-use-package
'org) literally in the warning.

Reported-by: Stephen Eglen <sje30@cam.ac.uk>
Link: https://orgmode.org/list/m2edsgq1t8.fsf@cam.ac.uk
2022-12-31 16:10:11 +03:00
Ihor Radchenko 18577a495b
org-persist-register: Fix MISC argument handling
* lisp/org-persist.el (org-persist-register): Document that MISC must
be a plist.
(org-persist--get-collection): Throw an error when MISC is not a
plist.  Fix arglist - MISC is now passed explicitly as a single
object.
(org-persist--storage-version): Bump version to avoid obsolete
malformed containers with improperly included MISC.
2022-12-31 12:39:25 +03:00
Ihor Radchenko fc4bbb28f8
org-search-view: Fix searching across inlinetasks
* lisp/org-agenda.el (org-search-view): Consider that
`outline-next-heading' may move to inlinetask.

* testing/examples/agenda-search.org: New test file.

* testing/lisp/test-org-agenda.el (test-org-agenda/org-search-view):
New test.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25514.763.379510.806150@gargle.gargle.HOWL
2022-12-27 13:10:02 +03:00
Ihor Radchenko ecfb55af0a
org-src.el: Apply common faces even when src block language mode is absent
* lisp/org-src.el (org-src-font-lock-fontify-block): Apply
`org-src-block-faces'/`org-block' faces even when no major mode is
available for the src block language.

Reported-by: duskhorn <duskhorn@proton.me>
Link: https://orgmode.org/list/zCjC9UjXEgJk8kuyi8t2K2XzO3fL7pYWynHhoYWAes9eCA1FkomCY9bss4uKZfBg60M4xUisyDqFWKVMOn1r_XzUVE7gr3ci82MEOLjGIMk=@proton.me
2022-12-27 12:47:46 +03:00
Ihor Radchenko de83f548d9
org-persist-write:file: Do not overwrite existing cached file
* lisp/org-persist.el (org-persist-write:file): Do not try to copy on
top of the cached file, when already exists.
2022-12-26 20:07:30 +03:00
Kyle Meyer 8aea340d59 Merge branch 'km/from-emacs-29' into bugfix 2022-12-26 11:00:27 -05:00
Stefan Kangas 14cbbac212 Backport commit 2608e5edc from Emacs
; Fix typos
2608e5edcca5094b61b4ccebcef160cc2bfd7f83
Stefan Kangas
Mon Dec 26 10:42:02 2022 +0100
2022-12-26 10:59:44 -05:00
Ihor Radchenko b11abb409c
org-babel-insert-result: Output strings as is for lists of strings
* lisp/ob-core.el (org-babel-insert-result): Do not use %S format for
lists of strings in :results list output.  This is more consistent
with single string output.

Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com
2022-12-26 12:24:51 +03:00
Ihor Radchenko 9c79aedec7
org-agenda: Use more machine-friendly date output for csv export
* lisp/org-agenda.el (org-fix-agenda-info): Pad the month and date
numbers with 0, making sure that the date format is always YYYY-MM-DD.

Reported-by: David O'Toole <deeteeoh1138@gmail.com>
Link: https://orgmode.org/list/CAAz1J52e7ha=rtyz=Kn=o-X48XU3oNJYF57xo5hOBnz8_Twdyg@mail.gmail.com
2022-12-26 12:21:13 +03:00
Kyle Meyer 63e073f96e org-persist: Revert space misalignment from recent commit
987fe173a (org-persist: Do better job avoiding security issue
described in `make-temp-name', 2022-12-25) carried along an unrelated
space change.
2022-12-25 11:31:56 -05:00
Ihor Radchenko 718e196830
org-back-to-heading: Fix at inlinetask END
* lisp/org.el (org-back-to-heading): Fix when at inlinetask END.
* testing/lisp/test-org.el (test-org/org-back-to-heading): Add new
test.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25508.20192.899342.932809@gargle.gargle.HOWL
2022-12-25 15:49:28 +03:00
Ihor Radchenko f138810065
org-element: Allow inlinetasks to be commented and archived
* lisp/org-element.el (org-element-inlinetask-parser): Parse
inlinetasks closer to headings.  In particular, recognize COMMENT
keyword and ARCHIVE tag in inlinetasks on parser level.
* testing/lisp/test-org.el (test-org/comment-dwim): Add tests for
inlinetasks and for uncommenting headings.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25508.20192.899342.932809@gargle.gargle.HOWL
2022-12-25 15:32:01 +03:00
hugcis 318807013c
oc-basic.el: Fix wrong type for the editors field when parsing JSON.
* lisp/oc-basic.el (org-cite-basic--parse-json): Make sure
`org-cite-basic--parse-json' produces a string for the editors field.
The function `org-cite-basic--get-author' expects a string for both the
"authors" field and the "editors" field.
The conversion to string was only done for the "authors" field in
`org-cite-basic--parse-json'. This patch fixes the issue by applying the
transformation to both "authors" and "editors".

This points to a more general issue where `org-cite-basic--get-field' is
expected to return nil or a string, but calls
`org-cite-basic--get-entry' that may return an association list.

TINYCHANGE
2022-12-25 14:35:55 +03:00
Ihor Radchenko 7f2f73c414
org-babel-read: Small fix
* lisp/ob-core.el (org-babel-read): Remove redundant `format' call for
code block body.  The body is already a string.  Make the block name
more human readable using %s `format' arg.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
Link: https://orgmode.org/list/CA+G3_PPFHcx6eeKGuvxDcuy3NjSpTnrbye0gHJePtvi2a-5wrg@mail.gmail.com
2022-12-25 13:58:06 +03:00
Ihor Radchenko 987fe173ac
org-persist: Do better job avoiding security issue described in `make-temp-name'
* lisp/org-persist.el: Create `org-persist-directory' early, when we
decide the directory name.  This way, even if third party code gets to
know the directory name in /tmp, it cannot raise file permissions by
creating `org-persist-directory' with loose access rights ahead of us.
Also, create and set `org-persist-directory' before we check if have
have proper access rights to write to it.
(org-persist-write-all): Do better job clearing
`org-persist-directory' if nothing is going to be written inside.
(org-persist-clear-storage-maybe): New function to be called before
exiting Emacs.  It is used to remove the persistent data before
exiting.  Multi-session persistence is not and must not be needed when
calling Emacs with -Q command line argument.  Call the function before
exiting Emacs in `kill-emacs-hook'.

Reported-by: Stefan Monnier <monnier@iro.umontreal.ca>
Link: https://yhetil.org/emacs-devel/jwvwn6kpmir.fsf-monnier+emacs@gnu.org
2022-12-25 12:17:36 +03:00
Ihor Radchenko e2366ac283
* lisp/org-persist.el: Do not litter /tmp when native compiling
Remove the directory created by `make-temp-file' when Emacs is called
with -Q command line argument.  Only use the return value as the
directory to be created when something is actually stored by
org-persist while running Emacs.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/alpine.DEB.2.22.394.2212211213480.270543@shell3.miskatonic.org
2022-12-21 21:43:42 +03:00
Tom Gillespie a8c9f11757
Fix missing null check for tangle links during export
* lisp/ob-tangle.el (org-babel-tangle--unbracketed-link): Add the let
bound variable l to the and statement to prevent l from being passed
to `string-match' in the event that it is nil.

When tangling nested noweb blocks during export it is possible for the
results of `org-store-link' to return nil.  This commit ensures that
the value returned for l is only passed to `string-match' when it is
non-nil, avoiding a `wrong-type-argument' (stringp nil) error.

Handling of comments and nesting of babel blocks is known to have
issues.  The bug is from 8a781d35dc
where new code was introduced to obtain the value for bare which was
not present in early code.  I'm guessing that the bug appears now
because `string-match' is called on l (aka link) at a point in time
when it was never previously called and it was thus masked because in
the old version it was impossible to call `string-match' when `link'
was nil because another variable was always nil, masking the issue.
2022-12-21 15:40:27 +03:00
Ihor Radchenko db34a7d837
* lisp/ox-html.el (org-html-link): Fix call to `org-export-get-ordinal'
Pass list of type symbols as third argument following the docstring
spec.

Reported-by: Brian Powell <powellb@hawaii.edu>
Link: https://orgmode.org/list/m2tu1s458q.fsf@hawaii.edu
2022-12-21 15:28:48 +03:00
Ihor Radchenko 2247998758
ob-core: Fix :results list when result is a table
* lisp/ob-core.el (org-babel-insert-result): Do not treat table lines
in RESULT verbatim.
* testing/lisp/test-ob-shell.el (ob-shell/results-list): Add new test.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2tu1v8gj8.fsf@me.com
2022-12-18 14:18:54 +03:00
Kyle Meyer 47d1299e48 Merge branch 'km/from-emacs-29' into bugfix 2022-12-17 17:03:48 -05:00
Stefan Kangas c8b0a0d1b6 Backport commit a15cd5504 from Emacs
; Don't quote nil in comments
a15cd55044c6bb4d4e9f9aec23b8b5b9cbcb38ac
Stefan Kangas
Thu Dec 15 02:35:00 2022 +0100
2022-12-17 17:01:59 -05:00
Ihor Radchenko 2944a2152d
org-persist: Use temporary index for emacs -Q
* lisp/org-persist.el (org-persist--disable-when-emacs-Q): Rename
`org-persist-disable-when-emacs-Q' to internal variable.  Update the
docstring.
(org-persist-read):
(org-persist-write):
(org-persist-gc): Do not disable persistence.  Persistence is
necessary for remote file caching to work within a single Emacs
session.  Instead, use temporary directory as index for emacs -Q.
2022-12-17 12:39:35 +03:00
Ihor Radchenko aa86ed534f
org-persist-write-all: Do not create index with no containers
* lisp/org-persist.el (org-persist-write-all): Do not create
`org-persist-directory' when index does not contain any data except
index version.

Link: https://orgmode.org/list/875yedw0ib.fsf@localhost
2022-12-17 12:36:51 +03:00
Leo Butler 81f2741bca
prevent error in Octave process, add tests, update test docs
* lisp/ob-octave.el (org-babel-execute:octave):

  -Ensure that the special Octave variable `ans' is bound when
  GFX-FILE is non-nil.  The glue code in
  ORG-BABEL-OCTAVE-WRAPPER-METHOD causes Octave to exit with a
  non-zero exit code when `ans' is not bound.

  -Change format control string to %S from %s.  Ensure the graphics
  filename is quoted.  If it is not, Octave may create a mis-named
  file or fail entirely.

* testing/examples/ob-octave-test.org:

  Update the Graphical tests section:
  -put in the correct headers;
  -add a remark about where to find each test.

* testing/lisp/test-ob-octave.el:

  Add the three tests ob-octave/graphics-file,
  ob-octave/graphics-file-session and ob-octave/graphics-file-space.

  -ob-octave/graphics-file: The first test verifies that the first bug
  identified above is fixed; it also verifies that graphics file
  creation works correctly for scripting.

  -ob-octave/graphics-file-session: The second test verifies graphics
  file creation works correctly for sessions.  The Octave command
  `crash_dumps_octave_core(0)' is included to prevent the creation of
  a core file (`octave-workspace').

  -ob-octave/graphics-file-space: The third test verifies that a
  graphics filename with a space in it is created correctly.

Thanks to Ihor Radchenko for helpful feedback.
Ref: https://list.orgmode.org/8735asbtfe.fsf@localhost/T/#u
2022-12-17 11:20:43 +03:00
Jeremie Juste 662e814bc0
ob-R.el: Restore the handling of org-list in as var
* ob-R.el (org-babel-R-assign-elisp): Use the patch from
ccberry@health.ucsd.edu, to print org-list as a one column table as it
was the case in release_9.5. The break in R is due commit b4e437f96 *
ob-core: Resolve named list references to simple lists.

* test-ob-R.el (ob-R-nested-list): New function to test that org list
with multiple level are handled as expected in R.

see https://list.orgmode.org/87bkofh0ir.fsf@localhost/ for context.
2022-12-14 12:36:38 +03:00
Timothy 402d2421d9
org-persist: Do not re-download url files on write
* lisp/org-persist.el (org-persist-write:url): Since the url write
function is called as part of `org-persist-write-all', it is worth
adding a check to avoid re-downloading the file if a file already exists
in the expected location.
2022-12-14 12:35:12 +03:00
Timothy 6a126e40a7
org-persist: Ensure index instantiated before read
* lisp/org-persist.el (org-persist-read): If the index is empty at the
start of `org-persist-read', load it before continuing.
2022-12-14 12:33:39 +03:00
Timothy 88329143c8
org: Use buffer-base-buffer in safe resource fns
* lisp/org.el (org--confirm-resource-safe, org--safe-remote-resource-p):
Replace instances of buffer-file-name
with (buffer-file-name (buffer-base-buffer)) so these functions work in
indirect buffers.
2022-12-14 12:33:15 +03:00
Timothy 0db972ad63
ox: Handle failure to localize link
* lisp/ox.el (org-export-link-localise): When no local copy of the link
resource could be fetched, produce a warning message and do nothing
instead of setting the link :path to nil.
2022-12-14 12:31:56 +03:00
Ihor Radchenko 4323a19b15
org-hide-drawer-startup: Add missing variable alias
* lisp/org.el (org-hide-drawer-startup): Make alias to
`org-cycle-hide-drawer-startup'.

Reported-by: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Link: https://orgmode.org/list/877cyvzrcu.fsf@gmail.com
2022-12-13 14:12:18 +03:00
Ihor Radchenko 7048876f6f
org-export-get-ordinal: Do not ignore ELEMENT type when TYPES is given
* lisp/ox.el (org-export-get-ordinal): Append ELEMENT type to TYPES,
when TYPES is non-nil.
2022-12-13 11:49:42 +03:00
Ihor Radchenko bdb4c4c66e
org-export-get-ordinal: Fix breakage in 0551eba40
* lisp/ox.el (org-export-get-ordinal): Do not return first cached
number.  Search the actual requested element.  Do not disregard TYPES
argument in the cache.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY342ee8OgWVQdv=z3V1_3rgLttb2S0v27JLjF0KiMH0qA@mail.gmail.com
2022-12-13 11:49:41 +03:00
Kyle Meyer 2a529ee57b org-element: Autoload org-element-use-cache
* lisp/org-element.el (org-element-use-cache): Autoload to silence
byte compiler warning in Emacs repo.

On Emacs's emacs-29 branch, compiling lisp/org/org-loaddefs.el gives
the following warning that stems from an autoloaded defsubst,
org-element-at-point-no-context (new to Org 9.6):

  In org-element-at-point-no-context:
  org/org-loaddefs.el:846:61: Warning: Unused lexical variable
  `org-element-use-cache'

That doesn't show up in the Org repo because mk/org-fixup.el generates
org-loaddefs.el via autoload.el's generate-file-autoloads, which adds
"no-byte-compile: t" to its output file.  However, in Emacs 29,
autoload.el is now deprecated, and the Emacs build uses
loaddefs-gen.el's loaddefs-generate--emacs-batch, which does include
no-byte-compile.
2022-12-11 15:13:31 -05:00
Ihor Radchenko 41a8666c09
org-display-inline-remove-overlay: Do better job clearing images from cache
* lisp/org.el (org-display-inline-remove-overlay): Force remove
overlay images from Emacs image cache when un-displaying inline image
overlays.  This change should: (1) slightly improve Emacs memory usage
when the number of inline images is large; (2) Clear images from cache
every time Emacs removes the overlay for any
reason.  (`org-display-inline-remove-overlay' is used in
overlay 'modification-hooks.)
2022-12-11 12:16:26 +03:00
Kyle Meyer 954a95ec5f ob-core: Revert space misalignment from recent commit
cc5427b7e (org-babel-result-to-file: Fix results file inside
attachment dir, 2022-12-07) carried along an unrelated white space
change upstream of the main change.
2022-12-10 16:52:42 -05:00
Kyle Meyer 269dce9fe7 org-table: Require org-fold-core
* lisp/org-table.el: Explicitly load org-fold-core.

'make single' warns that org-fold-core-ignore-modifications in
org-table.el (introduced a few commits back) is not known to be
defined, and the Emacs repo would show the same warning.
2022-12-10 16:15:16 -05:00
Ihor Radchenko 169333e1cb
org-footnote-sort: Improve performance
* lisp/org-footnote.el (org-footnote-sort): Group inserting the
footnote definitions into a single cache update request.  This should
improve performance.

Reported-by: arozbiz@gmail.com
Link: https://orgmode.org/list/CAJniy+MW330e8SLog4DHxzS8wvZ3OCzuwbKhUrdTCgpvtd3pkQ@mail.gmail.com
2022-12-10 13:22:12 +03:00
Ihor Radchenko 7fefc3027b
org-display-inline-images: Force-refresh image cache
* lisp/org.el (org-display-inline-images): Always refresh cached
images when displaying image overlays.  See Emacs bug#59902.  This
fixes images not updating when image file is changed on disk.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/87wn7287n2.fsf@localhost
2022-12-10 13:02:13 +03:00
Ihor Radchenko 337d805354
org-link-descriptive-ensure: Small refactoring
* lisp/ol.el (org-link-descriptive-ensure): Compact the code.

Reported-by: T.V Raman <raman@google.com>
2022-12-10 12:50:37 +03:00
Ihor Radchenko 0616b3c375
org-export-as: Fix edge case during subtree export
* lisp/ox.el (org-export-as): Make sure that narrowing includes top
heading in a subtree when subtree export is requested.  This is needed
after 927621910 changed `org-export--get-subtree-options' behavior.

Reported-by: Alejandro Pérez Carballo <apc@umass.edu>
Link: https://orgmode.org/list/m2sfhpffui.fsf@umass.edu
2022-12-10 12:43:19 +03:00
Ihor Radchenko aba51fb584
org-fold-core-save-visibility: Fix macro expansion
* lisp/org-fold-core.el (org-fold-core-save-visibility): Calculate
folds on runtime, not during macro expansion.

* testing/lisp/test-org.el (test-org/org-ctrl-c-ctrl-c): Add test
ensuring that outline visibility is preserved upon refreshing Org
setup.

Reported-by: Matt Lundin <mdl@imapmail.org>
Link: https://orgmode.org/list/87wn70tlcn.fsf@fastmail.fm
2022-12-10 12:03:53 +03:00
Ihor Radchenko 76a725317e
orgtbl-to-generic: Improve performance
* lisp/org-table.el (orgtbl-to-generic): Disable org-fold checks in
temporary buffer.  Folding state is irrelevant there.

Reported-by: Majzoub, Eric <eric.majzoub@umsl.edu>
Link: https://orgmode.org/list/tn0s4e$84u$1@ciao.gmane.io
2022-12-10 08:48:29 +03:00
Kyle Meyer 33d0263de8 Merge branch 'km/from-emacs-29' into bugfix 2022-12-09 22:52:09 -05:00
Stefan Kangas c056afc153 Backport commit 262670405 from Emacs
; Normalize GPLv3 license statements in new files
26267040549da6e7f8223bea3b5344d0d5bef527
Stefan Kangas
Fri Dec 9 00:13:00 2022 +0100
2022-12-09 22:50:54 -05:00
Stefan Kangas 1ce9da0048 Backport commit 8fb2afe05 from Emacs
; Fix typos
8fb2afe051168b2eac2bba0ee102039d0af90a05
Stefan Kangas
Thu Dec 8 07:17:47 2022 +0100
2022-12-09 22:49:40 -05:00
Ihor Radchenko 34a8133715
Revert "lisp/ox-latex.el: put labels inside example blocks"
This reverts commit 304f18cb72.

This patch will break verbatim environment as the label will be
interpreted verbatim as well.
2022-12-08 15:44:58 +03:00
Ihor Radchenko 8b6df19dc7
org-fold-core-get-regions: Search whole buffer when FROM and TO are nil
* lisp/org-fold-core.el (org-fold-core-get-regions): Fix non-intuitive
when FROM and TO are nil.  Update the docstring.

Reported-by: Daniel Mendler
2022-12-08 15:04:11 +03:00
Hugo Heagren 304f18cb72
lisp/ox-latex.el: put labels inside example blocks
* lisp/ox-latex.el (org-latex-example-block): Instead of
`org-latex--wrap-label', manually add label after
\begin{<environment>}.

This produces proper label resolution in LaTeX.  Labels before the
environment begins can be interpreted as referring to the surrounding
section.
2022-12-08 14:35:01 +03:00
Ihor Radchenko 97a780f0be
org-table-justify-field-maybe: Do not allow newlines inside cells
* lisp/org-table.el (org-table-justify-field-maybe): Remove newlines
from cell values, when present.  Newlines will alter the table cell
structure.

Reported-by: Julien Palard <julien@palard.fr>
Link: https://orgmode.org/list/638faf1b.050a0220.2bd96.904b@mx.google.com
2022-12-07 16:59:21 +03:00
Ihor Radchenko 3176ed9052
org-persist: Never write data associated with encrypted files
* lisp/org-persist.el (org-persist-write): Do not write data
associated with gpg-encrypted files.  This will avoid data leakage.
(org-persist--storage-version): Bump storage version to invalidate
previously stored, potentially leaked, data.

Reported-by: Clément Pit-Claudel <clement.pitclaudel@live.com>
2022-12-07 16:05:21 +03:00
Ihor Radchenko 5d14e88c51
org-make-tags-matcher: Fix regexp
* lisp/org.el (org-make-tags-matcher): Match
<now>/<today>/<tomorrow>/<+3d>/etc time queries.  They are allowed by
"11.3.3 Matching tags and properties" section of the manual.

Fixes regression from e022a0cea.

Reported-by: Carlo Tambuatco <oraclmaster@gmail.com>
Link: https://orgmode.org/list/87bkokgtd7.fsf@kyleam.com
2022-12-07 14:23:29 +03:00
Ihor Radchenko cc5427b7ef
org-babel-result-to-file: Fix results file inside attachment dir
* lisp/ob-core.el (org-babel-result-to-file): When file path in the
result contains attachment dir, reduce the path to relative file name
when generating attachment: link.
* testing/lisp/test-ob.el (test-ob-core/dir-attach): Add test.

Reported-by: Johan Tolö <johan@toloe.se>
Link: https://orgmode.org/list/875yesnia6.fsf@toloe.se
2022-12-07 14:13:49 +03:00
Ihor Radchenko 4dddbc1436
org-clock-update-time-maybe: Preserve point position better
* lisp/org-clock.el: Try harder to preserve point position upon
updating the clock line.  Even when `save-excursion' is not
sufficient.

Reported-by: Daniel Clemente <n142857@gmail.com>
Link: https://orgmode.org/list/CAJKAhPDVs5GRKR-cmyeNd5cQFHyKpw_=JptBzi1f0FYNTqqjzA@mail.gmail.com
2022-12-07 13:48:32 +03:00
Ihor Radchenko 7e6b55b8fd
org-element--cache-active-p: Fix when cache is disabled in indirect buffers
* lisp/org-element.el (org-element--cache-active-p): Consider cache
disabled when any of the indirect buffers do not have modification
detection.  This can be important when one uses
`combine-after-change-calls' inside an indirect buffers disabling
`after-change-functions' temporarily in the indirect buffer.

Reported-by: Feng Shu <tumashu@163.com>
Link: https://orgmode.org/list/87359z8ssb.fsf@163.com
2022-12-04 16:10:25 +03:00
Ihor Radchenko 461eb2a0ec
org-fold-core-cycle-over-indirect-buffers: Fix missing indirect capture buffers
* lisp/org-fold-core.el (org-fold-core-cycle-over-indirect-buffers):
Fix logic detecting foreign `org-fold-core--indirect-buffers'.
`current-buffer' is not always at `car'.  Before this change, capture
buffers could be missed when cycling over indirect buffers causing
subtle bugs.

Reported-by: Alexandros Prekates <aprekates@posteo.net>
Link: https://orgmode.org/list/20221128122841.2246aa08@enous
2022-12-04 16:10:19 +03:00
Ihor Radchenko 4564627415
org-babel-comit-with-output: Fix when prompt is emitted partially
* lisp/ob-comint.el (org-babel-comint-with-output): Do not rely on
output filter when detecting prompt lines.  Search for
`comint-prompt-regexp' in the full output after applying the filter.
This is needed when the filter is supplied with partial prompts.

Reported-by: Frédéric Santos <frederic.santos@u-bordeaux.fr>
Link: https://orgmode.org/list/877czca7oj.fsf@u-bordeaux.fr
2022-12-02 13:59:24 +08:00
Kyle Meyer d122c2b5b4 ox-md: Tweak a defcustom type for compatibility with Emacs<28
* lisp/ox-md.el (org-md-toplevel-hlevel): Change the type from natnum
to integer, which is less accurate but compatible with all Emacs
versions that Org supports.

This is a follow-up to the recent port of 4b2f5425d.
2022-12-01 17:26:01 -05:00
Eli Zaretskii 3159ea296f Backport commit 8b3baadf6 from Emacs
* lisp/org-clock.el (org-x11idle-exists-p): Don't try to
invoke "command x11idle" on MS-Windows and MS-DOS.  This fixes a
hang during byte-compilation of Org.

Fix compilation of Org 9.6 on MS-Windows
8b3baadf671b7b3d5058808c4655eca8bd46015e
Eli Zaretskii
Thu Dec 1 14:40:47 2022 +0200
2022-12-01 17:25:59 -05:00
Mattias Engdegård 9b856c273f Backport commit 4b2f5425d from Emacs
* lisp/ob-clojure.el
(ob-clojure-babashka-command, ob-clojure-nbb-command):
Account for the possibility of nil (commands absent).
* lisp/org.el (org-safe-remote-resources):
* lisp/ox-md.el (org-md-toplevel-hlevel):
Fix incorrect or invalid types.

Fix types in various defcustom declarations
4b2f5425d7af1a6f992ad8ce0a4452a2e778815a
Mattias Engdegård
Thu Dec 1 13:03:19 2022 +0100

[km] The natnum change will be adjusted in an upcoming commit because
     natnum not available until Emacs 28.
2022-12-01 17:25:58 -05:00
Stefan Kangas c8ad9e4b28 Backport commit 8617edfff from Emacs
; Fix typos
8617edfffd07eb80561b4de6a37c5b0b5f442e07
Stefan Kangas
Wed Nov 30 16:59:41 2022 +0100
2022-11-30 17:19:12 -05:00
Mattias Engdegård 7ba099a3fd Backport commit c3466099c from Emacs
* lisp/org-element.el (org-element--get-node-properties):
Escape literal `+`.
* lisp/org-persist.el (org-persist-load:index):
Replace line-start with string-start when the latter is meant.

Org regexp style fixes
c3466099c5f44c52ec73a1bbbb2b42de6f29ac7f
Mattias Engdegård
Wed Nov 30 13:23:38 2022 +0100
2022-11-30 08:55:24 -05:00
Kyle Meyer 5fd5912fa4 ob-core: Silence byte-compiler warning
* lisp/ob-core.el (org-babel-read-list): Reflow docstring paragraph to
silence "docstring wider than 80 characters" warning.
2022-11-29 21:22:05 -05:00
Bastien b3da427ebb Update version numbers for the 9.6 release 2022-11-29 07:34:50 +01:00
Ihor Radchenko 9276219103
org-export--get-subtree-options: Do not jump to parent subtree
* lisp/ox.el: Never jump to parent heading even when point is at an
existing heading.
* testing/lisp/test-ox.el (test-org-export/get-subtree-options): Fix
test assuming that current subtree may include parent.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY3mxi4DRTS+W-AX7bFELVujqH4DODEYPy3hyGRRuMEPSw@mail.gmail.com
2022-11-27 16:48:44 +08:00
Ihor Radchenko eed4708b66
org-babel: Add new :results discard header argument
* lisp/ob-core.el (org-babel-result-cond): Unconditionally return nil
and suppress all the processing for :results discard.
(org-babel-common-header-args-w-values):
(org-babel-sha1-hash): Add the new value to know :results value list.
* doc/org-manual.org (Handling):
* etc/ORG-NEWS (New =:results discard= header argument): Document the
new value.

Reported-by: Daniel Ortmann <daniel.ortmann@oracle.com>
Link: https://orgmode.org/list/87tu2tjary.fsf@localhost
2022-11-27 08:32:51 +08:00
Ihor Radchenko b4e437f968
ob-core: Resolve named list references to simple lists
* lisp/ob-core.el (org-babel-read-list): Return a simple list instead
of list of lists.  Document this in the docstring.
* testing/lisp/test-ob-java.el (ob-java/read-return-list):
(ob-java/read-list-return-array):
(ob-java/read-return-list-with-package): Fix tests assuming previous
behavior.
* testing/lisp/test-ob.el (test-ob/simple-variable-resolution): Add
new tests.
* etc/ORG-NEWS (List references in source block variable assignments
are now proper lists): Document the change.

This commit fixes the broken promise in the manual section 16.4
Environment of a Code Block where the named references to lists should
be converted to simple lists consisting of the top-level items.

The inconsistency existed for a while and possibly lurked into some
third-party packages.  So, announcement in NEWS is required.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/87pmdqfao4.fsf@localhost
2022-11-26 09:51:36 +08:00
Ihor Radchenko c72d5ee840
org-table-convert-refs-to-rc: Fix failing test
* lisp/org-table.el (org-table-convert-refs-to-an): Leave $0
references (current row) unchanged during conversion.
*
testing/lisp/test-org-table.el (test-org-table/org-table-convert-refs-to-an/2):
Re-enable the failing test.
2022-11-25 14:45:09 +08:00
Rudolf Adamkovič 5337a49f32
org.el: Use long option names when launching dvisvgm
* lisp/org.el (org-preview-latex-process-alist): Use long option names
when launching dvisvgm, optimizing for maintainability, instead of
brevity.  For example, use `--no-fonts' instead of `-n'.
2022-11-25 10:07:00 +08:00
Rudolf Adamkovič 52ebf6b45e
org.el: Compute bounds exactly when converting LaTeX output to SVG
* lisp/org.el (org-preview-latex-process-alist): Call `dvisvgm' with
`-e' (`--exact-bbox') instead of `-b min' (`--bbox=min') to measure
the exact bounds around visual glyphs, as opposed to using font
metrics, to avoid clipping at the edges.

Link: https://orgmode.org/list/m2v8n4w00w.fsf@me.com
2022-11-25 10:06:44 +08:00
Ihor Radchenko 670f68bea2
lisp/org-agenda.el: Obsolete unused org-let' and org-let2'
* lisp/org-agenda.el (org-let):
(org-let2):
* lisp/org-compat.el (org-let):
(org-let2): Move to org-compat and mark for removal.

P.S. Save the kittens!
2022-11-25 09:42:17 +08:00
Ihor Radchenko d4522dd4df
lisp/org.el: Fix toggling overlays in region
* lisp/org.el (org--inline-image-overlays): New function returning
overlays in region.
(org-toggle-inline-images): Respect BEG and END arguments when
determining presence of overlays.
(org-remove-inline-images): Clear up deleted overlays.

Reported-by: William Denton <wtd@pobox.com>
Link: https://orgmode.org/list/alpine.DEB.2.22.394.2211221559080.61289@shell3.miskatonic.org
2022-11-24 10:11:15 +08:00
Ihor Radchenko 1cdac8ef6a
* lisp/ob-eval.el (org-babel--get-shell-file-name): Update fixme 2022-11-24 09:49:09 +08:00
Kyle Meyer c75aec4e6c Merge branch 'km/from-emacs-master' 2022-11-23 15:13:24 -05:00
Stefan Kangas 529c2a3df1 Backport commit beaa2e495 from Emacs
; Fix typos (misspelled symbols)
beaa2e49530b8149d2c22cb5fa15b8d48f7937b6
Stefan Kangas
Mon Nov 21 15:20:11 2022 +0100
2022-11-23 15:09:24 -05:00
Rudolf Adamkovič 7f4d91040a
ox-html: Use accurate MathJax versions
* etc/ORG-NEWS (HTML export uses MathJax 3+ instead of MathJax 2):
* lisp/ox-html.el (org-html-mathjax-options): Mention Mathjax 4+
version support where applicable.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m28rk2k8so.fsf@me.com
2022-11-23 19:08:27 +08:00
Ihor Radchenko 89af7b11a4
org-sbe: Fix when the macro is expanded outside Org file
* lisp/ob-table.el (org-sbe): Do not try to execute code block during
macro expansion.
* testing/lisp/test-ob-table.el (test-ob-table/sbe): Uncomment the
test.  Update the expected return value.
2022-11-23 17:26:55 +08:00
Ihor Radchenko 07eced3639
org-make-parameter-alist: Change the argument name
* lisp/org-macs.el (org-make-parameter-alist): Change the argument
name to conventional PLIST, as the FIXME suggests.
2022-11-22 11:09:53 +08:00
Ihor Radchenko f995425d06
org-table-convert-region: Update docstring
* lisp/org-table.el (org-table-convert-region): Mention when an error
can be thrown in the docstring.
2022-11-22 10:11:33 +08:00
Stefan Kangas f78dfea63d
Remove 'org-speed-commands-user' warning
* lisp/org-keys.el (org-speed-command-help): Remove
'org-speed-commands-user' warning.
2022-11-21 19:42:43 +08:00
Kyle Meyer aed55381bd Merge branch 'km/from-emacs-master' 2022-11-20 22:30:47 -05:00
Stefan Kangas 2e0fcc14e2 Backport commit ba485eb94 from Emacs
; Fix typos
ba485eb949ddec53b1d7b5d78f3fcfbe2be60d7d
Stefan Kangas
Fri Nov 18 16:02:19 2022 +0100
2022-11-20 22:26:22 -05:00
Juanma Barranquero c53d752e61 Backport commit 623db40dd from Emacs
* lisp/ol.el (org-link-search-must-match-exact-headline):
* lisp/org-faces.el (org-column): Fix typos in docstrings.

; * lisp/*.el: Fix typos in docstrings
623db40dd1cd21623c5cecdc0abbf3ce885f92b1
Juanma Barranquero
Thu Nov 17 08:48:02 2022 +0100
2022-11-20 22:20:12 -05:00
Rudolf Adamkovič 62e1513b5a
ox-html: Update from MathJax 2 to MathJax 3+
* lisp/ox-html.el (
org-html-mathjax-options,
org-html-mathjax-template,
org-html--build-mathjax-config
): Update from MathJax 2 to 3 while maintaining compatibility.  All
legacy options should continue to work, except for the 'path' option
which must now point to MathJax 3 or later.
* testing/lisp/test-ox-html.el (
ox-html/mathjax-path-none,
ox-html/mathjax-path-default,
ox-html/mathjax-path-custom,
ox-html/mathjax-path-in-buffer,
ox-html/mathjax-options-default,
ox-html/mathjax-options-custom,
ox-html/mathjax-options-in-buffer,
ox-html/mathjax-legacy-scale-default,
ox-html/mathjax-legacy-scale-custom,
ox-html/mathjax-legacy-scale-in-buffer,
ox-html/mathjax-legacy-scale-message,
ox-html/mathjax-legacy-scale-message-in-buffer,
ox-html/mathjax-legacy-scale-ignore,
ox-html/mathjax-legacy-autonumber-ams,
ox-html/mathjax-legacy-autonumber-ams-in-buffer,
ox-html/mathjax-legacy-autonumber-none,
ox-html/mathjax-legacy-autonumber-none-in-buffer,
ox-html/mathjax-legacy-autonumber-all,
ox-html/mathjax-legacy-autonumber-all-in-buffer,
ox-html/mathjax-legacy-autonumber-message,
ox-html/mathjax-legacy-autonumber-message-in-buffer,
ox-html/mathjax-legacy-font-tex,
ox-html/mathjax-legacy-font-tex-in-buffer,
ox-html/mathjax-legacy-font-stix-web,
ox-html/mathjax-legacy-font-stix-web-in-buffer,
ox-html/mathjax-legacy-font-asana-math,
ox-html/mathjax-legacy-font-asana-math-in-buffer,
ox-html/mathjax-legacy-font-neo-euler,
ox-html/mathjax-legacy-font-neo-euler-in-buffer,
ox-html/mathjax-legacy-font-gyre-pagella,
ox-html/mathjax-legacy-font-gyre-pagella-in-buffer,
ox-html/mathjax-legacy-font-gyre-termes,
ox-html/mathjax-legacy-font-gyre-termes-in-buffer,
ox-html/mathjax-legacy-font-latin-modern,
ox-html/mathjax-legacy-font-latin-modern-in-buffer,
ox-html/mathjax-legacy-line-breaks-true,
ox-html/mathjax-legacy-line-breaks-true-in-buffer,
ox-html/mathjax-legacy-line-breaks-false,
ox-html/mathjax-legacy-line-breaks-false-in-buffer,
ox-html/mathjax-legacy-line-breaks-message,
ox-html/mathjax-legacy-line-breaks-message-in-buffer): Test MathJax in
general and also the conversion of legacy options from MathJax 2 to 3.
* testing/org-test.el (org-test-capture-messages): Add a new macro
useful for testing the messages put in the echo area.
* etc/ORG-NEWS: Document MathJax 2 to 3 upgrade, highlighting the
benefits of the new version but also mentioning the fact that the user
may need to update the `path' option in `org-html-mathjax-options'.
* doc/org-manual.org (Math formatting in HTML export): Update the link
to the MathJax CDN and the example of how to use `+HTML_MATHJAX' with
MathJax 3.  Also, remove the note on MathJax extensions, as they did
not work (and do not work) as documented.

Link: https://list.orgmode.org/orgmode/m2a667n4ax.fsf@me.com/
2022-11-21 10:44:56 +08:00
Ihor Radchenko 1d985406d8
Revert "ob-core: Do not limit table size in babel output"
This reverts commit 5347f4c75a.

`org-table-convert-region-max-lines' has been introduced explicitly
for the problem of babel output.  Therefore the commit was against the
established logic.  A different approach needs to be used to tackle
the reported problem.
2022-11-20 13:19:43 +08:00
Ihor Radchenko 5347f4c75a
ob-core: Do not limit table size in babel output
* lisp/ob-core.el (org-babel-import-elisp-from-file): Do not limit the
maximum possible resulting table to
`org-table-convert-region-max-lines'.

Reported-by: Daniel Ortmann <daniel.ortmann@oracle.com>
Link: https://orgmode.org/list/b7021ff3-60d7-863a-5579-dff60f7e1337@oracle.com
2022-11-20 13:15:44 +08:00
Ihor Radchenko 4c40fc3d4d
org: Allow spaces in #+LINK abbreviation definitions
* lisp/org.el (org-set-regexps-and-options): Allow spaces when
defining link abbreviations via #+LINK keyword.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
a new test.
* doc/org-manual.org (Link Abbreviations): Add example demonstrating
link abbreviation with spaces.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/87zgf7zujc.fsf@localhost
2022-11-20 13:15:02 +08:00
Juan Manuel Macias fcf63fb31e
lisp/ox-latex.el: fix `org-latex-guess-babel-language'
* (org-latex-guess-babel-language): If the user puts a string other
than AUTO as an argument to `\babelprovide', it gives an error when
exporting. For example:

`#+LaTeX_Header: \babelprovide[onchar=ids,import]{hebrew}'
2022-11-18 16:28:24 +08:00
Ihor Radchenko 70cee1810b
lisp/ox.el: Fix compiler warning
* lisp/ox.el (org-export--parse-option-keyword): Remove unused
variable.
2022-11-17 13:43:19 +08:00
Ihor Radchenko ad62379984
org-export: Allow "string with spaces" as #+OPTIONS: values
* lisp/ox.el (org-export--parse-option-keyword): Allow `read'ing the
option value as far as needed.  Do not restrict the value to the first
whitespace only.  This way, one can use Elisp strings with all the
escaping options as values.
* testing/lisp/test-ox.el (test-org-export/parse-option-keyword): Add
test for option value with a space inside.

Reported-by: Pierre Balayé <pierrebalaye@gmail.com>
Link: https://list.orgmode.org/orgmode/CANpQAF-n+4xhNvL8aaP8j2gJ70vbu80wmh9a4Oj0BxNHA5-yDA@mail.gmail.com/
2022-11-17 12:49:29 +08:00
Ihor Radchenko 5c247fb27b
org-html-postamble: Clarify that string value is format string
* lisp/ox-html.el (org-html-postamble): Clarify that string value of
the variable is not inserted verbatim, but used as format string.

Reported-by: Tim Cross <theophilusx@gmail.com>
Link: https://orgmode.org/list/86wn8gbvk0.fsf@gmail.com
2022-11-16 12:47:59 +08:00
Ihor Radchenko 84b4878680
ox-html: Do not allow `org-html-preamble' to be 'auto
* lisp/ox-html.el (org-html--build-pre/postamble): Avoid building
date/author/email info line when `org-html-preamble' is set to
'auto.  This is only meaningful in `org-html-postamble'.
2022-11-16 12:47:58 +08:00
Ihor Radchenko d094135388
ob-octave: Fix octave :results value parsing
* lisp/ob-octave.el (org-babel-octave-wrapper-method): Use fdisp
instead of fprintf.

Reported-by: Alexandre Duret-Lutz <adl@lrde.epita.fr>
Link: https://orgmode.org/list/217078597.347872.1639979694777@email.ionos.de
2022-11-16 12:42:58 +08:00
Kyrylo Simonov 00778ce2a6
Fix missing customization groups
* lisp/ob-tangle.el (org-babel-tangle): Add missing group definition.
(org-babel-post-tangle-hook):
(org-babel-pre-tangle-hook):
(org-babel-tangle-body-hook):
(org-babel-tangle-finished-hook):
(org-babel-tangle-comment-format-beg):
(org-babel-tangle-comment-format-end):
(org-babel-tangle-uncomment-comments):
(org-babel-process-comment-text):
(org-babel-tangle-default-file-mode): Move under `org-babel-tangle'
group.
* lisp/ol-bbdb.el (org-bbdb-anniversaries): Move under `org-agenda'
instead of a non-existent `org-bbdb'.
* lisp/ol-bibtex.el (org-bibtex): Add missing group definition.
* lisp/ol-gnus.el (org-gnus-no-server): Move under group
`org-link-follow' instead of a non-existent `org-gnus'.
* lisp/org-plot.el (org-plot): Add missing group definition.
* lisp/org.el (org-startup): Add missing group definition.
* lisp/ox-latex.el (org-latex-pdf-process): Move under
`org-export-latex' instead of a non-existent `org-export-pdf'.
* lisp/ox-man.el (org-man-pdf-process): Remove reference to
non-existent group `org-export-pdf'.

TINYCHANGE
2022-11-16 09:59:44 +08:00
Max Nikulin 08a8c9e678
org-attach.el: ID to path functions may return nil
* lisp/org-attach.el (org-attach-dir-from-id): Ignore nil values
returned by entries from `org-attach-id-to-path-function-list'.
(org-attach-dir-get-create): Signal an error suggesting customization
of `org-attach-id-to-path-function-list' if all ID-to-path functions
return nil.
(org-attach-id-to-path-function-list): Add to the docstring examples
how to handle unusual IDs.
(org-attach-id-uuid-folder-format, org-attach-id-ts-folder-format):
Return nil if ID is too short.
(org-attach-id-fallback-folder-format): New function that may be added
as the last element of `org-attach-id-path-function-list' to handle
unexpectedly short IDs.
* etc/ORG-NEWS: Advertise the change.

Earlier an obscure error like 'org-attach-id-ts-folder-format: Args out
of range: "ftt", 0, 6' was signalled in the case of unexpectedly short
ID.

Reported-by: Janek F <xerusx@pm.me>
Link: https://list.orgmode.org/KC8PcypJapBpJQtJxM0kX5N7Z0THL2Lq6EQjBMzpw1-vgQf72egZ2JOIlTbPYiqAVD4MdSBhrhBZr2Ykf5DN1mocm1ANvvuKKZShlkgzKYM=@pm.me
2022-11-16 09:47:03 +08:00
Ihor Radchenko 21413d3589
org-clock-report: Improve docstring
* lisp/org-clock.el (org-clock-report): Clarify :scope when called
from inside a heading or before first heading.  Separate :scope
description into a separate paragraph.

Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87h6z2c8pf.fsf@mat.ucm.es
2022-11-16 09:26:03 +08:00
Ihor Radchenko de2d2d928f
ob-python: Wait for session initialization on slow machines
* lisp/ob-python.el (org-babel-python--initialized): New internal flag
used to indicate that python session has been initialized in buffer.
(org-babel-python-initiate-session-by-key): Set
`org-babel-python--initialized' in `python-shell-first-prompt-hook'
when using built-in python.el.  Wait until the hook is fired before we
finish initiating the session.

This patch intends to fix CI test failures where the CPU allocation is
limited and python loading is extremely slow.
2022-11-15 11:39:04 +08:00
Ihor Radchenko 4f88116e52
org-fold-subtree: Hide blank lines at the end as well
* lisp/org-fold.el (org-fold-subtree): Hide blank lines before the
next subtree as well.  Add docstring.

Reported-by: Alexandros Prekates <aprekates@posteo.net>
Link: https://orgmode.org/list/20221114020008.03f40695@enous
2022-11-14 12:22:03 +08:00
Kyle Meyer 77d35c4eec Silence byte-compiler under 'make single'
The org-list and org-priority warnings would show up when these
changes made their way to the Emacs repo.  (The ob-eval warning
wouldn't because string-empty-p has been moved to simple.el in Emacs's
master branch.)
2022-11-13 18:01:00 -05:00
Kyle Meyer e4ed6c92b4 Merge branch 'km/from-emacs-master' 2022-11-13 17:37:11 -05:00
Stefan Kangas 801ca4c6d0 Backport commit 0f5352377 from Emacs
* lisp/org-ctags.el:
* lisp/org-protocol.el: Remove redundant installation instructions
for packages bundled with Emacs.

Remove redundant library installation instructions
0f5352377539bc2587b9bfd068de0f4b3bf8b248
Stefan Kangas
Fri Nov 11 04:29:29 2022 +0100
2022-11-13 17:32:10 -05:00
Ihor Radchenko 5a10517d02
Add missing :package-version tags in changed `defcustom'
* lisp/ob-clojure.el (ob-clojure-babashka-command):
(ob-clojure-nbb-command):
* lisp/ob-exp.el (org-babel-exp-code-template):
* lisp/ob-latex.el (org-babel-latex-pdf-svg-process):
* lisp/org-agenda.el (org-agenda-show-outline-path):
* lisp/org-capture.el (org-capture-templates):
* lisp/org-clock.el (org-clocktable-defaults):
* lisp/org-persist.el (org-persist-directory):
(org-persist-remote-files):
(org-persist-default-expiry):
* lisp/org-refile.el (org-refile-use-outline-path):
* lisp/org-src.el (org-src-lang-modes):
* lisp/org.el (org-resource-download-policy):
(org-safe-remote-resources):
(org-time-stamp-custom-formats):
(org-property-separators):
(org-preview-latex-process-alist):
(org-structure-template-alist):
* lisp/ox-latex.el (org-latex-inline-image-rules):
(org-latex-src-block-backend):
(org-latex-engraved-options):
(org-latex-engraved-theme):
* lisp/ox-md.el (org-md-toplevel-hlevel):
* lisp/ox-texinfo.el (org-texinfo-with-latex): Add :package-version
keywords to the new custom options, and those with the value or
meaning changed.
2022-11-13 15:29:15 +08:00
Ihor Radchenko f83e45526b
org-toggle-item: Move footnote-definitions out of the lists
* lisp/org-list.el (org-toggle-item): When headings contain
footnote-definitions, move them out of the list.  Footnote-definitions
must not be indented and hence cannot belong to the list.  Ensure that
definitions do not slurp the following element after the list.
Consider when the list created by `org-toggle-item' is continued by an
existing list.
* testing/lisp/test-org-list.el (test-org-list/toggle-item): Add
tests.

Reported-by: Ypo <ypuntot@gmail.com>
Link: https://orgmode.org/list/877d3k70lu.fsf@localhost
2022-11-11 13:19:01 +08:00
Ihor Radchenko 4517fba441
org-html-htmlize-output-type: Mark safe as buffer-local
* lisp/ox-html.el (org-html-htmlize-output-type): This variable is
safe to set buffer-locally as a symbol.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m28ruxklo5.fsf@me.com
2022-11-11 11:31:58 +08:00
Ihor Radchenko 10e857d428
org-babel-read: Obey `org-confirm-babel-evaluate'
* lisp/ob-core.el (org-babel-read): Do not execute arbitrary Elisp
without prompt, according to `org-confirm-babel-evaluate'.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tjct9e$179u$1@ciao.gmane.io
2022-11-10 13:52:56 +08:00
Ihor Radchenko 51bb222260
ob-tangle: Update docstrings
* lisp/ob-tangle.el (org-babel-tangle-file):
* lisp/ob-tangle.el (org-babel-tangle): Clarify return values.
2022-11-10 13:36:01 +08:00
Ilya Chernyshov 6c285af9fb
ox-icalendar: Create export backend options for deadline/scheduled-summary-prefix defcustoms
ox-icalendar.el (org-export-define-derived-backend):

Add export backend options:
:deadline-summary-prefix
:scheduled-summary-prefix

ox-icalendar.el (org-icalendar-entry):

Use :deadline-summary-prefix export backend option instead of
`org-icalendar-deadline-summary-prefix'.  If the option is not
explicitly set, use the value of the custom variable.

Use :scheduled-summary-prefix export backend option instead of
`org-icalendar-scheduled-summary-prefix'.  If the option is not
explicitly set, use the value of the custom variable.

Convert `deadline/scheduled-summary-prefix' string to iCal-compatible
format via `(org-icalendar-cleanup-string)'

TINYCHANGE
2022-11-10 10:38:06 +08:00
Bruno BARBIER 620a96dd68
org-babel-insert-result: Avoid errors in `unwind-protect' unwindforms
lisp/ob-core.el (org-babel-insert-result): Don't reset the marker
`end' if it is not defined.  Such scenario happens when
`unwind-protect' BODY forms throw an error.

Reported-by: Bruno Barbier <perso.bruno.barbier@free.fr>
Link: https://orgmode.org/list/E1osecc-00046e-UI@lists.gnu.org
2022-11-09 14:40:37 +08:00
Bruno BARBIER 7f72807aea
lisp/ob-haskell.el: Fix org-babel-script-escape expects a string
* lisp/ob-haskell.el (org-babel-interpret-haskell): Don't call
`org-babel-script-escape' when the result is nil.
2022-11-09 10:34:03 +08:00
Ihor Radchenko 8a827437a5
org--at-headline-data-p: Fix when at :post-blank after heading
* lisp/org.el (org--at-headline-data-p): Fix infinite loop when within
blank lines after empty heading.

Reported-by: David Lukeš <dafydd.lukes@gmail.com>
Link: https://orgmode.org/list/CAEPTPEw9hugOWmzhNWCzCeXzV_qNePAdz4BbOp_sanTH9ZJ+AA@mail.gmail.com
2022-11-08 21:18:42 +08:00
Bruno BARBIER 0de063a521
org-babel-interpret-haskell: Don't remove outputs that match inputs
* lisp/ob-haskell.el (org-babel-interpret-haskell): Change the call to
`org-babel-comint-with-output'.
2022-11-07 15:23:05 +08:00
Ihor Radchenko e3a7c01874
Refactor org-time-stamp-custom-formats' and org-time-stamp-formats'
* lisp/org.el (org-time-stamp-formats):
* lisp/org.el (org-time-stamp-custom-formats): Change the default
values stripping leading "<" and trailing ">".  Update the docstring
explaining the format and that leading and trailing brackets are now
ignored.  Update the :type specification to more precise.
(org-time-stamp-format): Update the argument list and docstring
allowing to use the function more flexibly to find the time stamp
format for both `org-time-stamp-formats' and
`org-time-stamp-custom-formats'.  Rename `long' argument to more
accurate `with-time'.  Ignore brackets in the `org-time-stamp-formats'
and `org-time-stamp-custom-formats'.  Allow `inactive' argument to be
`no-brackets'
(org-format-timestamp):
(org-read-date-display):
(org-insert-time-stamp):
(org-display-custom-time):
(org-timestamp-translate):
* lisp/org-compat.el (org-timestamp-format): Rename
`org-timestamp-format' to `org-format-timestamp'.  The old variant is
too similar with other `org-time-stamp-format' function.  Also, use
`org-time-stamp-format' to determine the timestamp format instead of
using `org-time-stamp-formats' directly.
* lisp/ol.el (org-store-link):
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-progress):
* lisp/org-archive.el (org-archive-subtree):
(org-archive-to-archive-sibling):
* lisp/org-clock.el (org-clock-special-range):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-element.el (org-element-timestamp-interpreter):
* lisp/org-macro.el (org-macro--find-date):
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/date):
* lisp/ox-odt.el (org-odt--format-timestamp):
(org-odt-template):
* lisp/ox.el (org-export-get-date):
* testing/lisp/test-org.el (test-org/timestamp-format): Use
`org-time-stamp-format' instead of directly examining
`org-time-stamp-custom-formats' and `org-time-stamp-formats'.  Use the
new function name `org-format-timestamp'.
* etc/ORG-NEWS (Default values and interpretations of ~org-time-stamp-formats~ and ~org-time-stamp-custom-formats~ are changed):
(~org-timestamp-format~ is renamed to ~org-format-timestamp~):
(Updated argument list in ~org-time-stamp-format~): Document the
user-facing changes.

This commit documents and unifies previously undocumented assumptions
about the values of `org-time-stamp-formats' and
`org-time-stamp-custom-formats'.  Instead of fiddling with
leading/trailing brackets in the values, expedite the time format
calculation to `org-time-stamp-format'.  The undocumented assumption
about brackets in user option `org-time-stamp-custom-formats' is not
relaxed making the docstring correct.

Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87k04ppp1t.fsf@localhost
2022-11-07 15:05:37 +08:00
Adam Porter 155dc778e8
* lisp/org.el: (org-get-indirect-buffer) Allow indirect base buffers
Previously, calling this function on an indirect buffer would fail,
preventing the user from making a new indirect buffer based on an
indirect buffer (e.g. imagine the user makes an indirect buffer for a
large subtree, then wants to make another one for a subtree of that).
Now, the base buffer of the buffer is used, when applicable.

Also, the function is partially rewritten to be clearer, and a
docstring is added.

Link: https://orgmode.org/list/8b2c1814-2c6f-fdca-8ba7-63c415bfca5e@alphapapa.net
2022-11-07 11:16:08 +08:00
Daniel Ziltener 5e0c5c186d
org-babel: Add new "strip-tangle" :noweb argument value
* lisp/ob-tangle.el (org-babel-tangle-single-block): Strip noweb tags
from block if :noweb has been set to "strip-tangle".
* lisp/ob-core.el (org-babel-common-header-args-w-values): Add
"strip-tangle" as new allowed value.
* lisp/ob-core.el (org-babel-noweb-p): Add "strip-tangle" at the
appropriate positions.
* testing/lisp/test-ob-tangle.el (ob-tangle/strip-tangle): Add new test
case for "strip-tangle".
* doc/org-manual.org (Noweb Reference Syntax): Adjust documentation for
the noweb header argument.
* etc/ORG-NEWS: Add entry for new header argument value.

This patch adds the "strip-tangle" option for the :noweb header
argument.  This strips the noweb tags before tangling the block.  This can
be useful for e.g. testing purposes where one wants to use a block as
test case that can be both run inline as well as tangled into a file for
automated testing.

TINYCHANGE
2022-11-07 10:54:13 +08:00
Ihor Radchenko 26a2811b06
org-cite-basic-export-bibliography: Skip missing bibliography keys
* lisp/oc-basic.el (org-cite-basic-export-bibliography): Ignore
citation keys that are not present in bibliography.  Previously, an
error was thrown.
2022-11-06 15:44:44 +08:00
Leo Butler 9abf1b5167
lisp/ob-maxima.el: correct placement of $ in command string
* ob-maxima.el (org-babel-maxima:execute): Commit 6156b57bdf fixed a
quoting problem encountered on windows. However, the dollar sign ($)
is part of the maxima command string and needs to be escaped on
gnu/linux.

Reported by: Eric Fraga
Ref:
https://list.orgmode.org/950eb41c-1c8a-c891-af8d-276f6a452eaa@electrum-bikes.pl/T/#m4b5a54551604e5b3ec21f317c4a31b547ccada68

TINYCHANGE
2022-11-06 10:51:06 +08:00
Ihor Radchenko 946abeb49a
org-sting-width: Do no err in dedicated windows
* lisp/org-macs.el (org-string-width): Do not err when current window
is dedicated.  Force-remove dedicated status temporarily during the
call.  This should be safe as we only need to take over the window
temporarily to hook into Emacs display and calculate the string
width.

Reported-by: Bruno BARBIER <brubar.cs@gmail.com>
Link: https://orgmode.org/list/63662793.5d0a0220.62647.3003@mx.google.com
2022-11-05 17:38:37 +08:00
Ihor Radchenko 3e010d81dc
org-element-adopt-elements: Skip nil children
* lisp/org-element.el (org-element-adopt-elements): Ignore nil
children instead of throwing an error.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25445.34286.700495.260710@gargle.gargle.HOWL
2022-11-05 12:02:02 +08:00
Ihor Radchenko a3b9bb8faa
org-lint: Fix #+INCLUDE keyword parsing
* lisp/org-lint.el (org-lint-wrong-include-link-parameter): Use
non-greedy regexp to parse included file name.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/ceef41267fcb44cdcbd7986f599bf332@posteo.net
2022-11-05 11:31:37 +08:00
Ihor Radchenko 0d60013f0e
org-attach-attach: Fix when `org-attach-store-link-p' is t
* lisp/org-attach.el (org-attach-attach): Store link to the original
file location when `org-attach-store-link-p' is set to t, as promised
by the variable docstring.
2022-11-05 11:00:15 +08:00
Ihor Radchenko 094ee4490d
org-attach-store-link-p: Explain all the values in the docstring
* lisp/org-attach.el (org-attach-store-link-p): Detail what each of
the allowed values mean, in addition to the :type tags.
2022-11-05 11:00:14 +08:00
Rudolf Adamkovič f7b16402e6
org-babel: Never throw away standard error
* lisp/ob-eval.el (org-babel-eval-error-notify): Do not insert
superfluous whitespace.
* lisp/ob-eval.el (org-babel-eval): Show standard error even if the
command exits with a zero code.
* testing/lisp/test-ob-shell.el(
ob-shell/standard-output-after-success,
ob-shell/standard-output-after-failure,
ob-shell/error-output-after-success,
ob-shell/error-output-after-failure,
ob-shell/error-output-after-failure-multiple,
ob-shell/exit-code,
ob-shell/exit-code-multiple
): Add tests to avoid regressions.
2022-11-04 10:48:38 +08:00
Ihor Radchenko 2924c77848
org-compat: Add missing argument to `connection-local-get-profiles'
* lisp/org-compat.el (with-connection-local-variables): Add missing
required argument to the `connection-local-get-profiles' call.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tk0pjd$ebo$1@ciao.gmane.io
2022-11-04 10:41:59 +08:00
Bastien bd468136dd lisp/ob-sql.el: Add Daniel Kraus as the maintainer 2022-11-03 09:27:36 +01:00
Rudolf Adamkovič 17425599cf
ob-latex: Call Inkscape with descriptive arguments
* lisp/ob-latex.el (org-babel-latex-pdf-svg-process): Use descriptive
arguments, such as '--export-area-drawing' instead of '-D', to
optimize for readability and not brevity (which makes sense for
interactive use, which does not apply here).
2022-11-03 15:27:49 +08:00
Rudolf Adamkovič aaccbb2f98
ob-latex: Export the full area of the drawing
* lisp/ob-latex.el (org-babel-latex-pdf-svg-process): Add the argument
-D (--export-area-drawing) to avoid sub-point cuts on hi-DPI screens,
where Inkscape sometimes cuts off a single physical pixel from the
exported drawing.
2022-11-03 15:27:48 +08:00
Ihor Radchenko 210630e546
org-odt-link: Fix relative file links
* lisp/ox-odt.el (org-odt-link): Append an extra "../" to relative
links.  This is needed to conform with OpenOffice convention to treat
base path inside the odt archive.  The path containing the odt file is
thus "../".

Reported-by: Ihor Radchenko <yantar92@posteo.net>
Link: https://orgmode.org/list/87ilkc30wd.fsf@localhost
2022-11-03 14:18:36 +08:00
Ihor Radchenko 5bc6741a5a
org-clock-update-time-maybe: Update the containing timestamps as well
* lisp/org-clock.el (org-clock-update-time-maybe): Update the
containing timestamps inside the clock, not only the clock sum.

Reported-by: Bruce E. Robertson <brucer42@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53393
2022-11-01 15:52:25 +08:00
Ihor Radchenko 9987451252
org-babel-execute-src-block: Do not err on virtual src blocks
* lisp/ob-core.el (org-babel-execute-src-block): Handle no block at
point.  Do not err when block info does not have position data.

Reported-by: Alan Schmitt <alan.schmitt@polytechnique.org>
Link: https://orgmode.org/list/87r0yol8kp.fsf@m4x.org
2022-11-01 10:12:54 +08:00
Daniel Kraus fbbc8b55cf
ob-sql.el: Respect all params when using dbconnection
* etc/ORG-NEWS (Miscellaneous): Document the change.
* lisp/ob-sql.el (org-babel-find-db-connection-param): Make it
possible to overwrite parameters that are set from :dbconnection.
2022-11-01 09:55:35 +08:00
Ihor Radchenko 5dc8ea0abe
org-paste-subtree: Fix when `kill-ring' is empty
* lisp/org.el (org-paste-subtree): Allow pasting from system
clipboard.
2022-11-01 09:41:38 +08:00
Ihor Radchenko 33cbb11d5a
org-kill-is-subtree-p: Handle clipboard
* lisp/org.el (org-kill-is-subtree-p): Allow `current-kill' to return
clipboard (even when `kill-ring' is empty).  Do not throw error when
clipboard is also empty.
2022-11-01 09:28:48 +08:00
Max Nikulin 57abbd4b92
org.el: Fix first call of `org-paste-subtree'
* lisp/org.el (org-paste-subtree): Do not check `kill-ring' before
calling `current-kill' since the latter can pull content of clipboard.

First call of `org-paste-subtree' failed if nothing had been yanked
before since Emacs start but system clipboard had text with valid
subtree originating from other application.  The bug was where since
the commit adding `org-paste-subtree'.

If both `kill-ring' and system clipboard are empty then `current-kill'
generates meaningful error.
2022-11-01 09:26:50 +08:00
Ihor Radchenko 6ef33b6dd6
org-latex-src-block--listings: Put options within lstlisting environment
* lisp/ox-latex.el (org-latex-src-block--listings): Do not use global
\lstset to set options.  Prefer optional argument to lstlisting
environment instead.

Reported-by: Denis Bitouzé <denis.bitouze@univ-littoral.fr>
Link: https://orgmode.org/list/87pmepvb7u.fsf@example.com
2022-10-31 16:15:11 +08:00
Ihor Radchenko c12175003a
org-ctags: Fix interactive calls to `visit-tags-table'
* lisp/org-ctags.el (org-ctags-get-filename-for-tag):
(org-ctags-all-tags-in-current-tags-table):
(org-ctags-rebuild-tags-file-then-find-tag): Fix the calls.
2022-10-31 14:22:40 +08:00
Ihor Radchenko 2ab762e93b
ob-scheme: Use new `geiser' function when available
* lisp/ob-scheme.el (geiser): Add new declare.
(org-babel-scheme-get-repl): When possible, call the newer `geiser'
instead of the obsolete `run-geiser'.
2022-10-31 14:22:39 +08:00
Daniel Kraus bd68ece99c
ob-clojure.el: Auto detect backend
* lisp/ob-clojure.el (org-babel-clojure-backend): Set the backend
to an available cli program or elisp package.
2022-10-30 12:18:58 +01:00
Ihor Radchenko e0a87eba18
org-element-cache: Fix cache updates from indirect buffers
* lisp/org-element.el (org-element--cache-active-p):
(org-element--cache-put):
(org-element--cache-process-request):
(org-element--parse-to): Ensure that cache updates are done in base
buffer.
(org-element--cache-remove): Ensure that cache updates are done in base
buffer.  Watch for cache size to be non-negative.
2022-10-30 10:14:51 +08:00
Ihor Radchenko e675affe93
org-macs: Add new macro `org-with-base-buffer'
* lisp/org-macs.el (org-with-base-buffer): New macro to run code in
base buffer of current or given buffer.
* lisp/org-element.el (org-element-org-data-parser):
(org-element--cache-find):
(org-element--cache-sync):
(org-element--cache-before-change):
(org-element--cache-after-change):
(org-element--cache-submit-request):
(org-persist-after-read-hook): Use the new macro.
2022-10-30 10:14:50 +08:00
Ihor Radchenko a182add4a4
org-clock-x11idle-program-name: Fix link to x11idle source code
* lisp/org-clock.el (org-clock-x11idle-program-name): Fix the link to
default x11idle program.  It is not distributed via WORG.
2022-10-30 10:14:49 +08:00
Daniel Kraus a51cf1cc6b
ob-clojure.el: Fix bug with inline comments
* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Filter out
  nil values from cider evaluation.
2022-10-29 22:22:12 +02:00
Kyle Meyer 0681babab4 Fix recent doc string quoting issues
* lisp/org-agenda.el (org-agenda-show-outline-path):
* lisp/org.el (org-display-outline-path): Surround symbols with `...'
rather than using leading quote.

See 6013cb161 (Fix doc string quoting problems with ', 2022-07-25) for
a more detailed explanation.
2022-10-29 15:49:04 -04:00
Kyle Meyer 6ca9022dc4 ob-lob: Clean up spacing to pass Emacs's pre-commit check
* lisp/ob-lob.el (org-babel-lob-get-info): Remove trailing whitespace
from docstring.
2022-10-29 15:23:00 -04:00
Kyle Meyer bfc859fedf org-cycle: Silence byte-compiler under 'make single'
These are warnings that would show up when these changes made their
way to the Emacs repo.
2022-10-29 15:22:58 -04:00
Kyle Meyer 0b6a138bd3 ob-core: Silence byte-compiler 2022-10-29 15:15:29 -04:00
Kyle Meyer 27bc5c9a28 Merge branch 'km/from-emacs-master' 2022-10-29 15:15:03 -04:00
Stefan Kangas 4f0a4e07fd Backport commit db2ed9f33 from Emacs
; Fix several symbol name typos
db2ed9f333879e5ac283fb48c8b06ed4022f0af9
Stefan Kangas
Wed Oct 26 23:04:23 2022 +0200
2022-10-29 14:22:29 -04:00
Nikolay Kudryavtsev 6156b57bdf
ob-maxima.el: Fix execution on MS Windows
* ob-maxima.el (org-babel-execute:maxima): Change command line
invocation to a one that should work everywhere.

TINYCHANGE
2022-10-29 14:03:10 +08:00
Ihor Radchenko 7880695221
org-set-tags-command: Fix handling `org-loop-over-headlines-in-active-region'
* lisp/org.el (org-set-tags-command): Respect the non-nil value of
`org-loop-over-headlines-in-active-region'.  The code is adapted from
similar uses in other commands.

Reported-by: Alex Giorev <alex.giorev@gmail.com>
Link: https://orgmode.org/list/CAMq3WZh1sGW+BNKW1hZA+wP=iFskzShF-D-wUqWYqb_EponZ8g@mail.gmail.com
2022-10-29 13:25:38 +08:00
Ihor Radchenko c70a422082
org-babel-execute-src-block: Ensure that buffer is not changed
* lisp/ob-core.el (org-babel-execute-src-block): Ensure that we insert
results into the buffer where the src block is located.  Even when the
execution yields changing current buffer.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CAJ51ETqMBqiHy+W3CZ+EtSPzVb1ihbX6v+NQsZKojN6jF8zoBQ@mail.gmail.com
2022-10-29 12:43:03 +08:00
Ihor Radchenko a51bb2c448
org-x11idle-exists-p: Do not demand X window system at load time
* lisp/org-clock.el (org-x11idle-exists-p): Do not check if load-time
`window-system' is `x'.  Instead, rely on the check in
`org-user-idle-seconds'.

Emacs may start as a daemon and hence `window-system' may not yet be
`x' during startup.

Reported-by: Julien Cubizolles <j.cubizolles@free.fr>
Link: https://orgmode.org/list/871qqs6gqs.fsf@free.fr
2022-10-29 10:44:08 +08:00
Ihor Radchenko b93a61af9c
org-latex-line-break-safe: Use safer value of "\\[0pt]"
* lisp/ox-latex.el (org-latex-line-break-safe):
(org-latex-table-row):
Change \empty ending to explicit optional argument.  \empty still has
undesired side effects in some cases.

* testing/lisp/test-org-table.el (test-org-table/to-latex):
* testing/lisp/test-ox-latex.el (test-ox-latex/verse): Update tests.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://orgmode.org/list/87o7u9rz1a.fsf@posteo.net
2022-10-29 10:34:05 +08:00
Daniel Kraus 0e175f11fd
lisp/ob-clojure.el: Fix header argument :var binding
* lisp/ob-clojure.el (org-babel-expand-body:clojure): Always quote
the variables passed from org-mode in Clojure let binding.
When a variable is a table or list, it's value is "(..data..)"
and without quotes, Clojure would try to execute the first
value as a function.
2022-10-28 11:50:03 +02:00
Bastien efcfaca72d lisp/ob-clojure.el: Update headers 2022-10-28 10:48:16 +02:00
Ihor Radchenko d87a496b54
org-babel-eval-error-notify: Always display exit code
* lisp/ob-eval.el (org-babel-eval-error-notify): Display exit code
even when stderr is not empty.

Link: https://orgmode.org/list/m21qqux0ga.fsf@me.com
2022-10-27 11:49:05 +08:00
Ihor Radchenko 6bbd08f5aa
org-datetree-insert-line: Fix blank line insertion
* lisp/org-datetree.el (org-datetree-insert-line): Use
`org--blank-before-heading-p' check.

* testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
(test-org-datetree/find-month-create):
(test-org-datetree/find-iso-week-create): Explicitly set
`org-blank-before-new-entry' assumed throughout the tests.

Note that the `auto' behavior in `org-blank-before-new-entry' is
somewhat arbitrary.  It currently prefers no blank lines by
default (when no other headings are present in the buffer).  I went
with fixing the tests rather than changing
`org--blank-before-heading-p' to prefer inserting blank lines.  This
should make lesser impact on the end users.

Reported-by: Richard Walker <walkerrichardj@gmail.com>
Link: https://list.orgmode.org/orgmode/CAFyNgSE4mAt+b0Ks8L9bg2LbHcXnayOh+bYyONTQ4jN+zx3C1w@mail.gmail.com/
2022-10-26 15:25:24 +08:00
stardiviner 46b71f9108
org.el: Support auto display inline images when cycling
* lisp/org.el (org-toggle-inline-images): Support region.
(org-display-inline-images): Fix refresh argument logic.
(org-remove-inline-images): Support region.

* lisp/org-keys.el (org-toggle-inline-images): Update arguments.

* lisp/org-cycle.el (org-cycle-inline-images-display): Add new option to
control whether auto display inline images when cycling.
(org-cycle-display-inline-images): Add new hook function to auto display
inline images when cycling.
(org-cycle-hook): Add `org-cycle-display-inline-images' into cycling
hook by default.

* doc/org-manual.org (Exporting):
* etc/ORG-NEWS: Document the new option.
2022-10-26 12:43:07 +08:00
Ihor Radchenko 9490baa8bc
ob-python: Handle newer version of python-mode.el
* lisp/ob-python.el (py-choose-shell):
(py-toggle-shells): Use the new function name.
(py-default-interpreter): Remove the variable that is no longer
provided by python-mode.el.
(org-babel-python-initiate-session-by-key): Use `py-choose-shell'.

Reported-by: Christian Köstlin <christian.koestlin@gmail.com>
2022-10-26 12:40:05 +08:00
Ihor Radchenko bb40848458
org-odt-plain-text: Fix stripping spaces around plain-text segments
* lisp/ox-odt.el (org-odt-plain-text): Do not strip whitespace around
individual plain-text objects.

Reported-by: András Simonyi <andras.simonyi@gmail.com>
Link: https://orgmode.org/list/CAOWRwxC2MTqAmXVXtLJi39f=KEC-6tmWJ6XC3OMTXqvC2hC_xw@mail.gmail.com
2022-10-26 12:33:55 +08:00
Ihor Radchenko e022a0cea1
org-make-tags-matcher: Do not treat PROPERTY="[X]" as timestamp match
* lisp/org.el (org-make-tags-matcher): Improve heuristics used to
detect timestamps in the matcher.

Reported-by: Daniel J. Sinder <djsinder@gmail.com>
Link: https://orgmode.org/list/CAHND-wwBsoAQs2a5XTGKyX-=fFL5AwCPup=uA+R=FRH=1rUeVg@mail.gmail.com
2022-10-25 18:36:25 +08:00
Ihor Radchenko cd835dcad8
org-babel-demarcate-block: Fix when within blank after src block
* lisp/ob-core.el (org-babel-where-is-src-block-head): Clarify that
return value is nil within blank after src block.
(org-babel-demarcate-block): Insert new block inheriting language when
within blank lines after existing src block.  Document the behavior.

Reported-by: dalanicolai <dalanicolai@gmail.com>
Link: https://orgmode.org/list/CACJP=3nCekgX4RuYBWf=R_2t05-s4ikx-L9qP7W0cSicNG55BA@mail.gmail.com
2022-10-25 17:38:35 +08:00
Mikhail Skorzhinskii c3aa6a6d43
org-refile.el: Show refile targets with a title
* lisp/org-refile.el (org-refile-get-targets): Use a document
title (#+TITLE) instead of file or buffer name in outline path, if a
corresponding customisation option is set to 'title.  Fallback to a
filename if there is no title in the document.

* lisp/org-refile.el (org-refile-use-outline-path): Add a new option
'title, see above.
2022-10-25 14:53:14 +08:00
Mikhail Skorzhinskii 55767b792e
org-agenda.el: Show document title in outline path
* lisp/org-agenda.el (org-agenda-show-outline-path): Add an option to
show a document title at start of an outline path, instead of a file or
a buffer name.

* lisp/org.el (org-display-outline-path): Show a document title (#+TITLE
value) and an outline path in an echo area if the customisation option
is set to 'title.  Fallback to a file or a buffer name if the document
title is absent.
2022-10-25 14:53:14 +08:00