1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-03 08:30:03 +00:00
Commit Graph

25458 Commits

Author SHA1 Message Date
Ihor Radchenko
cb8bf4a0d0
org-babel-expand-references: Fix :noweb-ref expansion
* lisp/ob-core.el (org-babel-expand-noweb-references): Do not rely on
reference cache being populated as a condition that all the references
in buffer have been processed.  Set this information explicitly.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Add new test.
2022-09-17 15:52:24 +08:00
Ihor Radchenko
8cc821bda2
org-agenda-get-sexps: Query headline at point once in skip function
* lisp/org-agenda.el (org-agenda-get-sexps): Provide headline at point
for `org-agenda-skip'.
2022-09-16 12:32:34 +08:00
Ihor Radchenko
1de67d0b41
org-element--cache-sync: Quit early when no cache requests are queued
* lisp/org-element.el (org-element--cache-sync): Check
`org-element--cache-sync-requests' value early and quit if there are
none.  This reduces the number of conditions checked when the request
queue is empty.
2022-09-16 12:31:32 +08:00
Max Nikulin
6d8d7fba61
ol.el: Mention that `org-insert-link' may edit existing link
* lisp/ol.el (org-insert-link): Add completion by description and edit
link features to the docstring.
2022-09-16 11:49:06 +08:00
Max Nikulin
69b36beac7
ol.el: Always prompt for description in `org-insert-link'
* lisp/ol.el (org-insert-link): Do not bypass code trying to generated
description and prompt user when link path and description are
identical.  Make behavior of description prompt more consistent.

Remove confusing `auto-desc' local variable.  Originally the variable
was added with implementation of completion of stored link target by the
description in the commit 1e34c5d34 Bastien Guerry, "org.el: Fontify
links to current buffer when inserting a link",
2012-08-03 14:08:20 +0200.  The feature was broken soon by the commit
7f096ad37 Tony Day, "org-insert-link: Use ido when inserting links",
2012-10-12 14:39:53 +1100.  Last decade users were not asked to edit
description in the case of the same link target and description
(a remained side effect of 1e34c5d34).  Recent commit 0432f4fe6 Max
Nikulin, "ol.el: Restore complete by description for insert link",
2022-09-10 17:23:13 +0700 restored completion by description.
Due to the commit 4fc2c8dd8 Ihor Radchenko, "org-store-link: Default to
empty description for target/custom-id links", 2022-08-10 13:25:26 +0800
description identical to link path became a more rare case.

An alternative would be fixing condition to allow users to edit
description when it is the same as the path, but use stored description
without additional interaction when the link is chosen by description
completion.  Despite it was likely the original intention, always asking
the user to confirm or edit description may be more consistent behavior.
2022-09-16 11:49:05 +08:00
Ihor Radchenko
e3348ccc03
org-batch-test-init: Remove dead code
* testing/org-batch-test-init.el (lambda): Remove the code that has
never been working.  One could still rewrite the code using
`autoloadp', but it would break things terribly and should not be
needed as autoload does not need to be updated after changing the
`load-path'.  See
https://orgmode.org/list/jwvedwczhbv.fsf-monnier+emacs@gnu.org
2022-09-16 11:33:26 +08:00
Ihor Radchenko
6074a22bcb
testing: Address FIXMEs identified in 1a5e3f931
* testing/lisp/test-ob.el (test-ob/blocks-with-spaces):
(test-ob/specific-colnames):
* testing/lisp/test-oc.el (test-org-cite/export-capability):
* testing/lisp/test-ol.el (test-org-link/store-link):
* testing/lisp/test-org.el (test-org/set-regexps-and-options):
* testing/org-test.el (org-test-base-dir): Address typos and
non-existent variables.

(missing-test-dependency): Use `define-error'.
(org-test-load): Set `org-id-locations-file' when running tests.

* testing/lisp/test-ox.el (test-org-export/bind-keyword): Clarify
about variable symbol defined inside setupfile #+BIND statemtn.
2022-09-16 11:30:16 +08:00
Ihor Radchenko
17b51973bd
* lisp/org.el (org-log-beginning): Fix parens 2022-09-15 19:23:52 +08:00
Stefan Monnier
1a5e3f931c
testing: Make all files use lexical-binding
Mainly, add the corresponding cookie, but also add various `require`s
so that the compiler knows which vars should be trated as dynbound.
This does not fix all the warnings, but does try to eliminate
all those about "unused" variables.  For the variables truly unused,
the patch usually adds an underscore to their name to silence the warning.

Some of the fixes affect files which already used `lexical-binding`.
Not sure why the test worked before: maybe because the tests were run
without compiling them first (which could cause some of the
missing `require`d packages to be autoloaded before we got to the
problematic code, thus hiding the problem)?

I found some suspicious code, for which I added FIXMEs.

There are also a few changes to the main files.

* lisp/org-protocol.el (org-protocol-check-filename-for-protocol):
Don't call `server-edit` if it's not yet defined.  [ Needed to get
the tests to pass. ]

* lisp/ob-core.el (org-babel-temporary-directory)
(org-babel-temporary-stable-directory): Always define (and use nil
if we don't want to create a directory for it).  Simplify the code based
on the fact that (defvar V E) only evaluates E if V is not yet `boundp`.
(org-babel-temp-file, org-babel-temp-stable-file)
(org-babel-remove-temporary-directory)
(org-babel-remove-temporary-stable-directory): Adjust accordingly.

* lisp/org.el (org-log-beginning): Add FIXME.

* testing/org-test.el: Require `org` and `org-id`.
(org-id-locations-file): Don't `defconst` it.
(org-test-at-id, org-test-in-example-file, org-test-at-marker)
(org-test-with-temp-text, org-test-with-temp-text-in-file): Move edebug
specs into `declare` (and simplify them).
(org-test-with-tramp-remote-dir--worker): Declare dynbound tramp vars.
(org--compile-when): Fix quoting of `exp`.
(org-test-load): Tweak regexps.

* testing/org-batch-test-init.el: Tweak regexp, remove dead code and
add a FIXME about it.

* testing/lisp/test-ox.el: Require `ox` instead of
erroring out if it's not already loaded.  Also require `org-inlinetask`.
(org-test-with-parsed-data): Silence warnings when `info` is not used.
(test-org-export/bind-keyword): Add FIXME.

* testing/lisp/test-ox-publish.el: Require `org-test` and `ox-publish`.
(test-org-publish/resolve-external-link): Expose lambdas to
the compiler.  Remove unused var `ids`.
(test-org-publish/get-project-from-filename): Remove unused var `file`.

* testing/lisp/test-org.el: Require `org-macs`, `org`,
`org-inlinetask`, `org-refile`, and `org-agenda`.
(test-org/org-read-date): Declare `org-time-was-given` as dynbound.
(test-org/set-regexps-and-options): Add FIXME.

* testing/lisp/test-org-timer.el: Require `org-timer`.

* testing/lisp/test-org-table.el: Require `ox`.

* testing/lisp/test-org-protocol.el: Require `org-protocol` instead of
erroring out if it's not already loaded.  Also require `capture`, and
add missing `provide` statement.

* testing/lisp/test-org-pcomplete.el: Require `org`.

* testing/lisp/test-org-list.el: Require `org-list` and `org`.

* testing/lisp/test-org-lint.el: Require `org-footnote` and `org-lint`.

* testing/lisp/test-org-footnote.el: Require `org-footnote`.

* testing/lisp/test-org-element.el: Require `org-element` instead of
erroring out if it's not already loaded.  Also require `org` and
`org-inlinetask`.

* testing/lisp/test-org-duration.el: Require `org-duration`.

* testing/lisp/test-org-datetree.el: Require `org-datetree`.

* testing/lisp/test-org-colview.el: Require `org-colview`,
`org-duration`, and `org-inlinetask`.

* testing/lisp/test-org-clock.el: Require `org-duration` and `org-clock`.

* testing/lisp/test-org-archive.el: Require `org-archive`.

* testing/lisp/test-org-agenda.el
(test-org-agenda/bulk-custom-arg-func): Add FIXME.

* testing/lisp/test-ol.el: Require `ol` and `org-id`.
(test-org-link/store-link): Declare `org-store-link-props` and add FIXME.

* testing/lisp/test-oc.el (test-org-cite/export-capability): Add FIXME.

* testing/lisp/test-ob.el: Require `ob-core`, `org-src`, `ob-ref`,
and `org-table`.
(test-ob/eval-header-argument): Rename `foo` to `test-ob--foo` and
declare it as dynbound.
(test-ob/blocks-with-spaces, test-ob/specific-colnames): Add FIXME.
(test-ob/noweb-expansions-in-cache):
Declare `noweb-expansions-in-cache-var` as dynbound.

* testing/lisp/test-ob-tangle.el: Require `org` and `ob-tangle`.

* testing/lisp/test-ob-shell.el:
* testing/lisp/test-ob-python.el: Require `ob-core`.

* testing/lisp/test-ob-lob.el: Require `ob-lob`.
(temporary-value-for-test): Declare as dynbound.

* testing/lisp/test-ob-plantuml.el: Require `ob-plantuml` instead of
erroring out if it's not already loaded.
* testing/lisp/test-ob-lilypond.el: Require `ob-lilypond` instead of
erroring out if it's not already loaded.  Use `with-current-buffer`.

* testing/lisp/test-ob-julia.el: Require `ob-core`.

* testing/lisp/test-ob-java.el (org-babel-temporary-directory):
Remove dead code now that `org-babel-temporary-directory` is always bound.

* testing/lisp/test-ob-exp.el: Require `ob-exp`, `org-src`, and `org-test`.
(ob-exp/evaluate-all-executables-in-order):
Declare `*evaluation-collector*` as dynbound.

* testing/lisp/test-ob-emacs-lisp.el (ob-emacs-lisp/dynamic-lexical-edit)
(ob-emacs-lisp/dynamic-lexical-execute):
Rename dynbound var to `ob-emacs--x` and declare it as such.

* testing/lisp/test-ob-R.el: Require `ob-core`.
(ess-ask-for-ess-directory, ess-history-file): Declare vars.
2022-09-15 19:17:19 +08:00
Ihor Radchenko
2d38026581
Do not assert Org version in root Org libraries
* lisp/org-compat.el:
* lisp/org-macs.el: Do not check Org version.  These two libraries are
the base libraries required to generate the Org version.  The version
is not yet known when loading them; or, worse, built-in
`org-git-version' may be defined from built-in Org distribution.

Fixes https://orgmode.org/list/cdf0bc7d-3ed1-e1ce-84bb-239575a9c0b9@oracle.com
2022-09-15 12:28:57 +08:00
Ihor Radchenko
86c4635dba
test-org-link/store-link: Update tests for 4fc2c8dd8
* testing/lisp/test-ol.el (test-org-link/store-link): Do not expect
duplicating raw link in the file link description.
2022-09-13 22:11:05 +08:00
Ihor Radchenko
f8d740f707
org-log-beginning: Fix edge case when we create logbook at eob
* lisp/org.el (org-log-beginning): Fix edge case when current headline
is the last headline in the buffer and does not have a final newline.

Fixes https://orgmode.org/list/m21qvi8er5.fsf@ntnu.no
2022-09-13 22:02:11 +08:00
Ihor Radchenko
8ec328e827
org-log-beginning: Fix for headline at eob with no trailing newline
* lisp/org.el (org-log-beginning): Fix edge case when there is a
headline at the end of buffer and that headline does not have a
trailing newline.

Fixes https://orgmode.org/list/m24k0ffjyd.fsf@ntnu.no
2022-09-13 21:50:18 +08:00
Ihor Radchenko
4fc2c8dd89
org-store-link: Default to empty description for target/custom-id links
* lisp/ol.el (org-store-link): Use empty description by default (ask user).
2022-09-13 21:05:37 +08:00
Max Nikulin
c3d6672cfd
ol.el: Avoid links like "[[target][file:~/org/test.org::target]]"
* lisp/ol.el (org-store-link): Do not set description for "<<target>>"
links to avoid case when it is more detailed than link target.

While inserting to the same file, file part of the link target is
stripped, description is inserted without modification.  I do not think,
file path adds real value in comparison to "[[target]]" link to some
point in the same file.  A side effect is user prompt for description
since link and description are not identical any more.
2022-09-13 20:59:52 +08:00
Max Nikulin
f7b8510283
ol.el: Skip #CUSTOM_ID when <<target>> link is stored
* list/ol.el (org-store-link): Suppress storing of
"file:file.org::#custom_id" link when point is <<target>>.

CUSTOM_ID link is stored as additional option, so new chunk of code
introduced by b4b35fc92 is not necessary. It prevented adding of
"file:file.org::*Heading" link and caused duplication of
"file:file.org::#custom_id" link.

Reported-by: Fr Ml <fr_ml@t-online.de>
Link: https://orgmode.org/list/aadb23f3-c0fe-19aa-be79-50e51d16c41a@t-online.de/
2022-09-13 20:59:51 +08:00
Max Nikulin
543a23a57d
Revert "lisp/ol.el: Fix bug when storing links"
This reverts commit b4b35fc92d.

Avoid duplication of CUSTOM_ID links.
2022-09-13 20:59:51 +08:00
Ihor Radchenko
2737128aa7
org-back-to-heading: Use cache
* lisp/org.el (org-back-to-heading): Use element cache when cache is
active.
2022-09-13 20:59:13 +08:00
Ihor Radchenko
4d8c6fbf7a
org-up-heading-safe: Consider inlinetasks
* lisp/org.el: Consider inlinetasks in the element-cache branch of the
code.

Fixes https://orgmode.org/list/CAP7OBx+G8nF1D7ci=QoduHXgqZRLkPZuDZeu8vEHEsAQ3qn3hw@mail.gmail.com
2022-09-13 20:57:31 +08:00
Max Nikulin
0432f4fe6b
ol.el: Restore complete by description for insert link
* lisp/ol.el (org-insert-link): Allow completion of link target by its
description.  Almost certainly the feature was removed unintentionally.

Link descriptions were added to completion options in
the commit 1e34c5d34 Bastien Guerry,  "org.el: Fontify links to current
buffer when inserting a link", 2012-08-03 14:08:20 +0200
in response to
https://list.orgmode.org/877gw6ocva.fsf@okhotsk19.lowtem.hokudai.ac.jp/T/#u
Yagnesh Raghava Yakkala, "#+LABEL and CUSTOM_ID with reftex",
Mon, 21 May 2012 04:45:29 +0900

List of description was removed from completion options
likely because `ido-completing-read' signals an error in the case of nil
variant (that is not uncommon for links with no description), see the
commit 7f096ad37 Tony Day, "org-insert-link: Use ido when inserting
links", 2012-10-12 14:39:53 +1100 and the discussion of the patch
- https://list.orgmode.org/04D0E787-A8A1-4246-8DD2-D607E38D61BA@gmail.com/T/#u
  tony day.  [PATCH] * org-insert-link: use ido when inserting links.
  Fri, 12 Oct 2012 14:58:29 +1100
- https://list.orgmode.org/5CE03302-7C87-44BE-B4AF-A6A92C96C803@gmail.com/T/#u
  tony day.  [PATCH] org-insert-link: allow ido usage when inserting
  links.  Fri, 14 Sep 2012 19:21:50 +1000
- https://list.orgmode.org/0CADA13B-8A22-4F34-91B1-2232997C1F04@gmail.com/T/#u
  tony day.  [PATCH] org-insert-link: allow ido usage when inserting
  links. Fri, 12 Oct 2012 14:56:10 +1100
- https://list.orgmode.org/97F9790D-3C7F-490B-BE9B-1A652BB9F187@gmail.com/
  tony day.  PATCH: using ido when inserting links.
  Fri, 14 Sep 2012 18:58:43 +1000

Since auto-desc variable added by first commit was not removed
by second one, I assume that disabling the feature was a side effect
rather than the purpose.
2022-09-11 19:38:52 +08:00
Ihor Radchenko
c9db3c51ab
test-org-clock/clocktable/step: Add test for the new ":step quarter"
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/step): Add
new test case.
2022-09-09 21:16:46 +08:00
Ihor Radchenko
583c01c084
etc/ORG-NEWS: Document new ":step quarter" value
* etc/ORG-NEWS (Clock table can now produce quarterly reports):
Document the new feature introduced in 3f3ff643d.
2022-09-09 21:06:25 +08:00
Joost Helberg
3f3ff643d2
org-clock: Make quarter work as parameter for :step in clocktable
Hi,

many years ago a colleague and myself wrote a patch for quarters into
org-mode/clocktable for blocks, today I noticed that :step should allow
'quarter' as an argument too. Here's the tiny patch to allow that.

* doc/org-manual.org (The clock table): Document the new clocktable
option.
* lisp/org-clock.el:
(org-clocktable-steps): Add new 'quarter allowed value.

TINYCHANGE
2022-09-09 21:02:56 +08:00
Ihor Radchenko
7c20552ed6
org-babel-load-languages: Link to the manual for language list
* lisp/org.el: Update docstring linking to the manual for the list of
supported babel languages.

Reported in https://orgmode.org/list/86fsh61a3u.fsf@gmail.com
2022-09-09 19:16:40 +08:00
Max Nikulin
f25b308af6
org.el: Avoid dlink identifiers in `org-open-file'
* lisp/org.el (org--file-apps-entry-locator-p): Rename from
`org--file-apps-entry-dlink-p'.
(org-open-file): Avoid confusing "dlink" part of some identifiers.
Earlier `dlink' local variable was removed to prevent an issue with
distorted case of link components.
2022-09-09 19:03:51 +08:00
Max Nikulin
6e9ea3a076
org.el: Preserve case for link subgroups from `org-file-apps'
* lisp/org.el (org-open-file): Avoid matching of `org-file-apps' records
against the link converted to downcase since it caused incorrect
substitutions to the command.

Consider the following entry

    (add-to-list
     'org-file-apps
     '("\\.PDF\\(?:\\.[gx]z\\|\\.bz2\\)?::\\(#[^:]*\\)::\\(.+\\)\\'"
      . "okular --find %2 -- %s%1"))

and the link
<file:///usr/share/doc/bash/bashref.pdf::#Redirections::before>
Without the patch

    okular --find before -- /usr/share/doc/bash/bashref.pdf\#redirections

command is executed and the application can not resolve internal
cross-reference anchor.

In https://list.orgmode.org/4B51D104.9090502@jboecker.de/T/#u
https://list.orgmode.org/k2jfb2eb6811004041733zf176e0aq8367924746db81f5@mail.gmail.com/T/#u
the purpose of `dlink' is not clarified, so I assume that the only
purpose is to allow matching file suffixes, e.g. ".pdf" vs ".PDF".
2022-09-09 19:03:50 +08:00
Max Nikulin
33686b9955
org.el: Pass link match data to `org-file-apps' functions
* lisp/org.el (org--file-apps-entry-dlink-p): Fix it to pass match data
to handler functions from `org-open-file' alist when pattern field of
`org-file-apps' contains regexp subgroups.

Update `org--file-apps-entry-dlink-p' to use current convention for action
field of `org-file-apps' structure.  Currently it may be a function while
earlier s-expression was allowed.  Obsolete test wrongly separated actions
able to handle regexp subgroups matched in the link.  An example when
match data were not passed to the handler function:

    (add-to-list
     'org-file-apps
     '("\\.pdf\\(?:\\.gz\\|\\.bz2\\|\\.xz\\)?\\(?:::.*\\)?\\'"
        . my-open-pdf-locator))

Notice that lambda functions passed `consp' test, so namely
`defun' is required to reproduce the issue.

This change was missed in the commit:

     c8a3ab1e4 2016-02-03 18:30:17 +0100
     Nicolas Goaziou: `org-file-apps' accept functions instead of sexp

For discussion of the issue with evaluation of arbitrary expression see
https://list.orgmode.org/CALn3zoh+ACSU09eRurfwKjmCnw7i-_0KX7tA2jWqtu=vvQepLQ@mail.gmail.com/T/#u
Michael Brand. org-player and switch to lexical binding in org.el.
Sun, 17 Jan 2016 19:58:38 +0100
2022-09-09 19:03:49 +08:00
Mikhail Skorzhinskii
eb5ef0ae14
ox-icalendar.el: Customize vevent summary prefix
* lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prefix): A new
customization option to control summary prefix in exported scheduled
events.
* lisp/ox-icalendar.el (org-icalendar-deadline-summary-prefix): A new
customization option to control summary prefix in exported deadline
events.
* lisp/ox-icalendar.el (org-icalendar-entry): Use configurable summary
prefixes for scheduled and deadline events, instead of hardcoded ones.
2022-09-08 13:29:00 +08:00
Ihor Radchenko
fe90cab956
lisp/ox.el: Rename abnormal hook names to end with "-functions"
* lisp/ox.el (org-export-before-processing-functions):
(org-export-before-parsing-functions): Rename
`org-export-before-processing-hook' and
`org-export-before-parsing-hook' to use "-functions" suffix as these
hooks are abnormal hooks and we need not to use "-hook" suffix in
abnormal hooks.
* lisp/org-compat.el (org-export-before-processing-hook):
(org-export-before-parsing-hook): Declare obsolete.
* lisp/org-attach.el (org-export-before-parsing-functions): Use the
new hook name.
2022-09-06 21:42:11 +08:00
Ihor Radchenko
e73c5b7d0d
Fix Emacs 29 compiler warnings
* lisp/oc-basic.el (org-cite-basic--parse-bibliography): Do not use
obsolete `buffer-file-name' generalized variable.  Prefer
`set-visited-file-name'.
* lisp/ol-bibtex.el (org-indent-region): Declare function.
(org-bibtex-import-from-file): Remove unused variable.
* lisp/ol.el (org-link--decode-compound): Use `ash' instead of
obsolete `lsh'.
* lisp/org-macs.el: Do no use obsolete generalized variable
`buffer-string'.
* lisp/org-plot.el (org-plot/redisplay-img-in-buffer):
* lisp/org.el (image-flush):
(org-display-inline-images): Use `image-flush' instead of obsolete
`image-refresh'.
* lisp/ox.el (org-export-to-file): Quote ' in the docstring.

All other changes are changing obsolete `point-at-bol' and
`point-at-eol' to `line-beginning-position' and `line-end-position'.
2022-09-06 20:50:59 +08:00
Ihor Radchenko
0c055d2d31
org-compat: Add forward-compatibility for argument changes in adviced functions
* lisp/org-compat.el (outline-flag-region):
(outline-next-visible-heading):
(outline-back-to-heading):
(outline-on-heading-p):
(outline-hide-sublevels):
(outline-toggle-children): Accept arbitrary extra arguments and pass
them to original function if its arglist changes in future.

This patch is following the "no-breakage" policy:
>> I won't break your user experience.
https://bzg.fr/en/the-software-maintainers-pledge/
2022-09-06 20:14:23 +08:00
Ihor Radchenko
a3788bd8be
org-scan-tags: Fix messed match groups in eeb4fa8c0
* lisp/org.el (org-scan-tags): Match space after TODO keyword outside
group and match the TODO-keyword in its own group.
2022-09-05 18:50:52 +08:00
Bruno BARBIER
8151d52574
ob-shell: Use `process-file' when stdin or cmdline
lisp/ob-shell.el (org-babel-sh-evaluate): Use `process-file' (instead
of `call-process-shell-command') so that `org-babel-sh-evaluate' will
invoke file name handlers based on `default-directory', if needed,
like when using a remote directory.

lisp/org-compat.el (with-connection-local-variables): New
compatibility macro.

testing/lisp/test-ob-shell.el (ob-shell/remote-with-stdin-or-cmdline):
New test.

testing/org-test.el (org-test-with-tramp-remote-dir): New macro.

Fixes https://list.orgmode.org/CKMOBWBK709F.1RUN69SRWB64U@laptop/.
2022-09-05 18:31:39 +08:00
Ihor Radchenko
eeb4fa8c09
org-scan-tags: Fixup a1c923afd
* lisp/org.el: Drop missed 'words argument to `regexp-opt'.
2022-09-05 18:14:05 +08:00
Max Nikulin
76a5f30034
ol-info: Use org function instead of subr-x
* lisp/org-macs.el (org-unbracket-string): Handle empty suffix string.
* lisp/ol-info.el (org-info--link-file-node):
(org-info-description-as-command): Use `org-trim' and
`org-unbracket-string' instead of `string-trim' and
`string-remove-prefix' from the subr-x package.
2022-09-05 14:33:32 +08:00
Max Nikulin
1b647b00d0
ORG-NEWS: `org-info-description-as-command'
* etc/ORG-NEWS: Mention that `org-info' uses `:insert-description',
a new feature of `org-link-parameters'.
2022-09-05 14:33:27 +08:00
Max Nikulin
ac2d0a249e
org.el: Fix percent substitutions in `org-open-file'
* lisp/org.el (org--open-file-format-command): New function with better
coverage of mailcap RFC 1524 syntax.  Do not replace percent character
in file name or link component, fix substitution of multiple regular
expression groups matched in the link target.
(org-open-file): Use `org--open-file-format-command' instead of inline
code.
* testing/lisp/test-org.el (org-test/org--open-file-format-command):
Tests for `org--open-file-format-command'.

The primary goal of moving code outside of `org-open-file' function is to
make it testable.

It should fix the following issues:
- Maxim Nikulin. greedy substitution in org-open-file.
  Wed, 20 Jan 2021 23:08:35 +0700.
  https://list.orgmode.org/ru9ki4$t5e$1@ciao.gmane.io
- Rodrigo Morales. Org mode links: Open a PDF file at a given page
  and highlight a given string. Tue, 02 Mar 2021 15:07:32 -0500.
  https://list.orgmode.org/87lfb5pbej.fsf@gmail.com
2022-09-05 13:27:14 +08:00
Ihor Radchenko
7811fc5925
org-compat: Fix incorrect usage of `apply' in ea665792b
* lisp/org-compat.el:
(outline-next-visible-heading):
(outline-back-to-heading):
(outline-on-heading-p):
(outline-hide-sublevels):
(outline-toggle-children): Use `funcall' instead of `apply'.  The
former does not expect the last argument to be a list of arguments.
2022-09-04 12:41:01 +08:00
Ihor Radchenko
e81a094383
Assert all the Org files to load the same Org version
* lisp/org-compat.el (org-assert-version): New macro comparing Org
version at compile time and laod time.

Add `org-assert-version' call to all files:

* lisp/org-macs.el:
* lisp/org-crypt.el:
* lisp/org-ctags.el:
* lisp/org-cycle.el:
* lisp/org-datetree.el:
* lisp/org-duration.el:
* lisp/org-element.el (avl-tree):
* lisp/org-entities.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-fold-core.el:
* lisp/org-fold.el:
* lisp/org-footnote.el:
* lisp/org-goto.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-keys.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-macro.el:
* lisp/org-mobile.el:
* lisp/org-mouse.el:
* lisp/org-num.el:
* lisp/org-pcomplete.el:
* lisp/org-persist.el:
* lisp/org-plot.el:
* lisp/org-protocol.el:
* lisp/org-refile.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-tempo.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-beamer.el:
* lisp/ox-html.el:
* lisp/ox-icalendar.el:
* lisp/ox-koma-letter.el:
* lisp/ox-latex.el:
* lisp/ox-man.el:
* lisp/ox-md.el:
* lisp/ox-odt.el:
* lisp/ox-org.el:
* lisp/ox-publish.el:
* lisp/ox-texinfo.el:
* lisp/ox.el:
2022-09-04 12:24:55 +08:00
Ihor Radchenko
1f1d8f909a
org-element-cache-map: Do not disable GC
* lisp/org-element.el: Do not disable GC.  This can make Emacs hang in
some particularly bad scenarios.  It is better to lose on performance
a bit compared to Emacs GC hanging.

The edge case is described in https://github.com/emacs-citar/citar/issues/397#issuecomment-1236226809
2022-09-04 10:01:03 +08:00
Bastien
dc102f509a Merge branch 'bugfix' 2022-09-03 21:00:12 +02:00
Bastien
8ef6205a56 lisp/org.el: Bump version to 9.5.5 2022-09-03 20:54:27 +02:00
Ihor Radchenko
a1c923afda
org-scan-tags: Allow arbitrary character classes in todo keywords
* lisp/org.el (org-scan-tags): Do not assume that todo keywords are
words.

Fixes https://orgmode.org/list/C5370FC1-ABBB-4FA1-8364-5B1DF0FB4755@irq0.org
2022-09-03 16:12:22 +08:00
Ihor Radchenko
ea665792b2
org-compat: Use define-advice' instead of defadvice'
* lisp/org-compat.el (outline-flag-region):
(outline-next-visible-heading):
(outline-back-to-heading):
(outline-on-heading-p):
(outline-hide-sublevels):
(outline-toggle-children): Use `define-advice', remove redundant
interactive specs, and use `derived-mode-p' instead of `eq'
`major-mode'.

Suggested by Stefan Monnier.
2022-09-03 16:07:48 +08:00
Rudolf Adamkovič
710b6ca70e
Fix under-documented MathJax indentation option
* lisp/org/ox-html.el (org-html-mathjax-options): Add an example of a
valid value for the 'indent' MathJax option the docstring.
2022-09-02 20:43:40 +08:00
Rudolf Adamkovič
74d1a8c758
Fix incorrectly documented auto-numbering of MathJax equations
* lisp/org/ox-html.el (org-html-mathjax-options): Fix incorrect
choices for the 'autonumber' MathJax option in the docstring.
2022-09-02 20:43:40 +08:00
Ihor Radchenko
e36c3cc21b
org-babel-sh-evaluate: Do not issue string :results value
* lisp/ob-shell.el (org-babel-sh-evaluate): Do not assume that
:results value always yields string value.  Avoid error when results
is nil.
2022-09-01 23:08:55 +08:00
Ihor Radchenko
5bb699e0fd
org-babel-insert-result: Do not err when inline src block returns nil
* lisp/ob-core.el (org-babel-insert-result): Do not throw error when
src block returns nil or "".

Originally reported in
https://reddit.com/r/orgmode/comments/wy78gi/inline_noweb_or_some_way_to_use_src_block_results/imiw1b0/
2022-09-01 21:16:50 +08:00
Ihor Radchenko
09406b1c98
org-macs: Make sure that fontification does not move point
* lisp/org-macs.el (org-looking-at-fontified):
(org-buffer-substring-fontified): Wrap fontification call into
`save-excursion' for safety.
2022-09-01 21:16:50 +08:00
Bastien
f3f60e4ddb lisp/oc-csl.el: Add András Simonyi as the maintainer 2022-09-01 09:41:13 +02:00