Commit Graph

26362 Commits

Author SHA1 Message Date
Ihor Radchenko c0cdc5f77c
* lisp/org.el (org-at-heading-p): Do not call redundant `bolp' 2023-05-14 14:08:18 +02:00
Ihor Radchenko 546f2d86d1
org-add-prop-inherited: Avoid modifying S
* lisp/org.el (org-add-prop-inherited): Do not modify argument by side
effect.  Modifying strings may cause unexpected issues when working
with constant strings.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62847
2023-05-14 14:05:27 +02:00
Ihor Radchenko c8e8f4e3c2
org-fold--reveal-headline-at-point: Fix edge case with invisible subtree 2023-05-14 14:04:41 +02:00
Ihor Radchenko 6fd6b94cd5
org-element-parse-buffer: Use "property" term consistently 2023-05-14 14:01:18 +02:00
Ihor Radchenko aafa0c2828
org-element: Cache commonly used property value strings in obarray
* lisp/org-element.el (org-element--string-cache): New obarray holding
common strings in Org AST.
(org-element--get-cached-string): New function retrieving interned
string object.
(org-element-drawer-parser):
(org-element-dynamic-block-parser):
(org-element-footnote-definition-parser):
(org-element-headline-parser):
(org-element-inlinetask-parser):
(org-element-item-parser):
(org-element-special-block-parser):
(org-element-keyword-parser):
(org-element-node-property-parser):
(org-element-src-block-parser):
(org-element-citation-parser):
(org-element-citation-reference-parser):
(org-element-export-snippet-parser):
(org-element-footnote-reference-parser):
(org-element-inline-babel-call-parser):
(org-element-inline-src-block-parser):
(org-element-link-parser):
(org-element-macro-parser): Reuse string objects that are likely to
occur in parsed elements.
2023-05-14 14:00:44 +02:00
Ihor Radchenko ec694f00de
org-element-inlinetask-parser: Store boolean instead of larger integer 2023-05-14 13:56:05 +02:00
Ihor Radchenko b70ef01ff2
org-element: Prefer property values that occupy less memory
* lisp/org-element.el (org-element-subscript-parser):
(org-element-superscript-parser): Use boolean values where it is
sufficient.
2023-05-14 13:55:35 +02:00
Ihor Radchenko 57eb97fa35
org-element: Consistently drop text properties when parsing
* lisp/org-element.el (org-element-headline-parser):
(org-element-inlinetask-parser):
(org-element-item-parser):
(org-element-example-block-parser):
(org-element-src-block-parser):
(org-element-link-parser):
(org-element-timestamp-parser): Do not preserve text properties in the
element property values that are strings.
2023-05-14 13:52:57 +02:00
Ihor Radchenko ef4d8adcaa
fixup! org-lint: Lint malformed timestamps 2023-05-13 12:42:05 +02:00
Ihor Radchenko ab542a6532
org-lint: Lint malformed timestamps
* lisp/org-lint.el (org-lint-timestamp-syntax): New linter checking
timestamp syntax.

Link: https://list.orgmode.org/orgmode/87a6c3urkv.fsf@localhost/
2023-05-13 12:39:25 +02:00
Ihor Radchenko 30b790f42b
org-refile: Fix heading being removed when refiling into itself
* lisp/org-refile.el (org-refile): Throw an error when attempting to
refile heading into itself and the point is not at bol.
* testing/lisp/test-org.el (test-org/refile): Add tests.

Reported-by: Oliver Epper <oliver.epper@gmail.com>
Link: https://list.orgmode.org/orgmode/CAP8tsuSEScO+Q7=g7kL=9Dk-95reJvUmLoyqmJjd2-ZM6iycfA@mail.gmail.com/
2023-05-11 12:07:27 +02:00
Ihor Radchenko 6e6354c074
org-tags-expand: Do no modify buffer's syntax table by side effect
* lisp/org.el (org-mode-tags-syntax-table): New variable holding
syntax table for tags.
(org-mode): Initialize tag syntax table.
(org-make-tags-matcher): Match tags using appropriate syntax table.
(org-tags-expand): Do no modify syntax table by side effect.

Reported-by: Mattias Engdegård <mattias.engdegard@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#68
2023-05-08 13:23:15 +02:00
Ihor Radchenko fdea20084d
org-element-cache-map: Fix edge case
* lisp/org-element.el (org-element-cache-map): Fix when we use
NEXT-RE/FAIL-RE, the initial cached guess is not right, and the
NEXT-RE hits not-yet-cached element.
2023-05-07 14:56:54 +02:00
Max Nikulin ed0cfbd7b5
org-clock.el: Fix week start != 1
* lisp/org-clock.el (org-clock-special-range): Prevent returning
previous week for `thisweek' KEY when WSTART is 0.  Treat both 0 and 7
as Sunday.
* testing/lisp/test-org-clock.el (test-org-clock/special-range): New
test for `thisweek' and various WSTART arguments.

It seems only the case of weeks starting on Monday was tested.
Other variants caused shifted intervals.

Bug report: Marcin Borkowski. What is a week?
Mon, 10 Apr 2023 05:35:44 +0200.
<https://list.orgmode.org/87h6to1ka7.fsf@mbork.pl>
2023-05-07 10:03:52 +02:00
Ihor Radchenko 8944124edf
Revert "org-persist-gc: GC collections without persist file"
`org-persist-gc' is ran before `org-persist-write-all' and we may not
yet have all the persist files written.  Absence of a persist files is
thus not a sign that collection is expired.

This reverts commit e11073d17d.
2023-05-06 17:50:18 +02:00
Ihor Radchenko 080710797a
fixup! org-babel-common-header-args-w-values: Add docstring 2023-05-03 19:51:33 +02:00
Ihor Radchenko f268819d19
org-babel-common-header-args-w-values: Add docstring
* lisp/ob-core.el (org-babel-common-header-args-w-values): Add missing
docstring.
2023-05-03 19:19:28 +02:00
Ihor Radchenko e11073d17d
org-persist-gc: GC collections without persist file
* lisp/org-persist.el (org-persist-gc): Do not store collections that
lack persist file.  Such collection may emerge, for example, when
writing fails or gets blocked for some reason (in
`org-persist-before-write-hook' or when associated with encrypted
file).

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/CAM9ALR_F4gjWxOVh_Eq14NOC9nF6g0Cv1jAKb=p4FjPvjqSkWQ@mail.gmail.com
2023-05-03 12:55:26 +02:00
Ihor Radchenko 5ec364a1ae
org-cite-list-bibliography-files: Preserve relative bibliography paths
* lisp/oc.el (org-cite-list-bibliography-files): When the bibliography
path is relative to the exported file location, keep the path
relative.  Resolve relative paths for bibliographies from SETUPFILE as
well.

* testing/lisp/test-oc.el (test-org-cite/list-bibliography-files):
* testing/examples/sub-bib/include-relative-bib.org:
* testing/examples/sub-bib/include-global-bib.org: New test.

Link: https://orgmode.org/list/CAO48Bk_upR4h-xd0YL+FxeKtWvDoqH+Eju6F_Vzds_m6oxBKcg@mail.gmail.com
2023-05-02 14:47:56 +02:00
Gerard Vermeulen e58bbded5c
lisp/ob-lisp: fix `org-babel-execute:lisp' for use with Sly
* lisp/ob-lisp (org-babel-execute:lisp): by default, Sly and Slime
talk with different RPC server programs with different names.
Specialize the prefix of eval-and-grab-output to Slime (prefix swank:)
or to Sly (prefix slynk:).
2023-05-02 14:09:37 +02:00
Ihor Radchenko 9ea50ca211
Use `calendar-buffer' constant to refer to calendar buffers
* lisp/org-agenda.el (org-agenda-diary-entry-in-org-file):
* lisp/org.el (org-read-date):
(org-eval-in-calendar):
(org-timestamp-change):
(org-recenter-calendar):
(org-get-date-from-calendar): Use `calendar-buffer' instead of
hard-coded "*Calendar*".

Reported-by: Thuna <thuna.cing@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61546
2023-05-02 13:35:12 +02:00
Ihor Radchenko 05c3e59de1
org-manual: Document how to profile performance
* doc/org-manual.org (Feedback): Document how to deal with performance
degradation, add new index entries.
2023-05-01 14:41:17 +02:00
Ihor Radchenko 7ddc86a2ca
Merge branch 'bugfix' 2023-05-01 12:16:48 +02:00
Ihor Radchenko 08077812ef
org-clock-update-time-maybe: Fix return value
* lisp/org-clock.el: Ensure that we return expected value.
* testing/lisp/test-org-clock.el
(test-org-clok/org-clock-update-time-maybe): Add new test.
2023-05-01 12:15:09 +02:00
Kyle Meyer e5ae9c0ce7 Merge branch 'bugfix' 2023-04-30 19:55:54 -04:00
Stefan Monnier 2993f482c1 Backport commit 2bcf11d0e from Emacs
* lisp/org-macs.el (org--inhibit-version-check): Fix docstring.

2bcf11d0efecd18a1be8bcf0ac1a1dadb14d971a
Stefan Monnier
Sun Apr 30 09:41:13 2023 -0400
2023-04-30 19:34:05 -04:00
Kyle Meyer 2ab083dd1a Merge branch 'km/from-emacs-master' into bugfix
Both Org bugfix's 52dc48050 (Handle compiler warnings from Emacs
master, 2023-04-27) and Emacs master's 4f0849a9e6d (Remove unused
values in effect context, 2023-04-09) comment out an unused condition
in org-babel-insert-result to silence a compiler warning that's new to
the Emacs master branch.  However, the changes are slightly different,
so the next sync to emacs-29 will trigger a conflict when merged to
master.

Takes Emacs's variant to 1) avoid the conflict and 2) undo the
unrelated space change from Org's variant.  (52dc48050 improved the
comment slightly, but it's not worth the conflict.)
2023-04-30 19:32:33 -04:00
Mattias Engdegård b77a209f78 Backport commit 4f0849a9e from Emacs
* lisp/ob-core.el (org-babel-insert-result): Silence
ignored-return-value warnings about calls to side-effect-free
functions in the last clause of `cond` statements whose values are
unused.

Remove unused values in effect context
4f0849a9e6d29e25d23e061bd81bacce9468856d
Mattias Engdegård
Sun Apr 9 16:45:40 2023 +0200
2023-04-30 19:19:03 -04:00
Ihor Radchenko 921e0e8bc1
Update version number for the 9.6.5 release 2023-04-30 19:28:18 +02:00
Ihor Radchenko 128742418b
Merge branch 'bugfix' 2023-04-30 19:18:58 +02:00
Ihor Radchenko a686c7b609
ox-odt: Throw actual error when export fails
* lisp/ox-odt.el (org-odt--export-wrap): Throw an error rather than a
warning when export fails.
2023-04-30 19:18:21 +02:00
Ihor Radchenko c756f8a853
org-odt-plain-text: Fix when TEXT is a blank string
* lisp/ox-odt.el: Do not re-fill newlines when TEXT only contains
spaces.

Reported-by: Damien Cassou <damien@cassou.me>
Link: https://orgmode.org/list/87ttwxphm6.fsf@cassou.me
2023-04-30 19:12:42 +02:00
Ihor Radchenko c265d964f9
ox-odt: Improve some warning messages
* lisp/ox-odt.el (org-odt--translate-latex-fragments): Reference
`org-odt-with-latex' variable in the warning to direct users what to
do.  Only display the warning when there are LaTeX fragments to
convert.
2023-04-30 19:07:26 +02:00
Ihor Radchenko 310a668917
org-compile-file-commands: Fix return value when PROCESS is a function
* lisp/org-macs.el (org-compile-file-commands): Make sure that we
always return a list, as expected by `org-compile-file'.  Document the
return value in the docstring.  Also, document ERR-MSG argument.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CALEYq0_DsD2Ofw1XG4=EbEbJ9nr5_jWoU1+7-kUkmZF=ELhd5Q@mail.gmail.com
2023-04-30 18:42:02 +02:00
Ihor Radchenko 09cf89f712
org-delete-indentation: Support region selection
* lisp/org.el (org-delete-indentation): Support active region when the
first line in region is a heading.  Clarify in the docstring that
region is ignored with prefix argument.

Reported-by: Spencer Baugh <sbaugh@janestreet.com>
Link: https://orgmode.org/list/ier3552edfr.fsf@janestreet.com
2023-04-30 17:02:58 +02:00
Ihor Radchenko 76c3340557
* doc/org-manual.org: Fix obsolete variables
(Summary of In-Buffer Settings): Fix description of custom timestamp
overlay format.
2023-04-30 13:48:59 +02:00
Ihor Radchenko 989cc51499
Prefer "timestamp" over "time-stamp"
* lisp/org.el (org-time-stamp-formats):
(org-timestamp-formats):
(org-time-stamp-rounding-minutes):
(org-timestamp-rounding-minutes):
(org-time-stamp-custom-formats):
(org-timestamp-custom-formats):
(org-time-stamp):
(org-timestamp):
(org-time-stamp-inactive):
(org-timestamp-inactive):
(org-insert-time-stamp):
(org-insert-timestamp):
(org-toggle-time-stamp-overlays):
(org-toggle-timestamp-overlays):
(org-time-stamp-to-now):
(org-timestamp-to-now):
* lisp/ox.el (org-export-time-stamp-file):
(org-export-timestamp-file): Rename using "timestamp" term, keeping
the old name as alias.
* doc/org-manual.org: Update all the uses, adding #+findex and
 #+vindex entries.  Keep the alias names for searchability.

Adjust all the callers.

The following "time-stamp" uses are unchanged:
1. `org-time-stamp-format' where obsolete and _different_ function
   `org-timestamp-format' still exists.
2. :time-stamp-file property in export INFO plist.  Changing this
   would be breaking.
3. ORG-NEWS remains unchanged.
2023-04-30 13:48:52 +02:00
Ihor Radchenko eb6cabdee5
mk: Expand shell commands once only
* mk/targets.mk (GITVERSION):
(GITSTATUS):
(DATE):
(YEAR): Only expand the variables once, not in every make sub-process.
Previous code ran pwd/date/git in every make sub-process, slowing
things down significantly and unnecessarily.
2023-04-30 11:38:23 +02:00
Ihor Radchenko 42e95938ed
org-latex-compile: Fix erasing PDF output buffer late
* lisp/ox-latex.el (org-latex-compile): Clear the PDF output log
buffer before running compile command.

Fixes regression introduced in 0dfbf0c3.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CALEYq0_t38_gsmjE-qgPCX07-V0P8FYwYEt9R4AT0dZ_SnXRuA@mail.gmail.com
2023-04-30 10:17:09 +02:00
Ihor Radchenko 52d9961f50
org-set-tags-command: Provide more useful error when before first heading
* lisp/org.el (org-set-tags-command): Produce more useful error
message when point is before first heading.
2023-04-28 12:59:19 +02:00
Ihor Radchenko f067a4bd43
org-attach-tag: Work around error when before first heading
* lisp/org-attach.el (org-attach-tag): Avoid error thrown when trying
to set tags before first heading.  This is not a proper fix, but it
will at least allow attaching files to Org file.  The tagging will be
skipped for now, until setting FILETAGS is supported by Org API.
2023-04-28 12:52:09 +02:00
Ihor Radchenko 7e75571f02
Handle more compiler warnings from Emacs master
* lisp/org-macs.el (org-id-uuid): Use built-in `time-convert' instead
of function defined in org-compat.  `time-convert' can already be used
as it is available in Emacs 26.
2023-04-27 22:45:47 +02:00
Ihor Radchenko a8dbe8eb38
Merge branch 'bugfix' 2023-04-27 22:42:58 +02:00
Ihor Radchenko 52dc48050e
Handle compiler warnings from Emacs master
* lisp/ob-core.el (org-babel-insert-result): Comment out unused `cond'
clause.  Still leave it there for readability of the logic.
* lisp/org.el (org-agenda-restrict-begin):
(org-agenda-restrict):
(org-agenda-restrict-end): Mark variables from org-agenda.
2023-04-27 22:42:39 +02:00
Ihor Radchenko ef800e3bec
org--collect-keywords-1: Handle FIXME
* lisp/org.el (org--collect-keywords-1): Do not inhibit SETUPFILE in
read-only buffers.

It is unclear what kind of edge case the FIXME is trying to solve.
Yet, there is no reason to inhibit SETUPFILE processing in all the
read-only buffers (which may happen, for example, when refreshing Org
setup with C-c C-c).  Finally, if there is some bug in Gnus (if any)
we should better report it instead of using unexplained workaround.
2023-04-27 22:18:35 +02:00
Ihor Radchenko 2bc510217a
org-element--cache-find: Remove statistics gathering code
* lisp/org-element.el (org-element--cache-find): Do not collect
hashing statistics.  According to
https://orgmode.org/list/87sfffawfe.fsf@localhost, it is quite useful
for a fraction of users, yielding up to 30% recent cache queries being
memoized.  Add additional commentary.  Also, slight refactoring.
(org-element--cache-hash-nocache):
(org-element--cache-hash-statistics):
(org-element-cache-hash-show-statistics): Remove.
2023-04-27 15:26:56 +02:00
Ihor Radchenko 9e42842a82
org-persist: Fix :last-access being set on every write
* lisp/org-persist.el (org-persist-write:generic): Do not set
:last-access on write, unless writing first time.  Otherwise,
:last-access may never trigger expiration.
2023-04-26 23:39:49 +02:00
Ihor Radchenko eaf274909f
Consistently allow null character in block and drawer bodies
Also, do not use [^\000] as a poor-man's replacement for
(rx (or any newline)).

* lisp/ob-core.el (org-babel-src-block-regexp):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs):
* lisp/org-compat.el (org-hide-block-toggle-all):
* lisp/org-element.el:
* lisp/org-feed.el (org-feed-read-previous-status):
(org-feed-parse-rss-feed):
(org-feed-parse-rss-entry):
* lisp/ox-org.el (org-org-publish-to-org):
* testing/lisp/test-ob-tangle.el:
* lisp/org.el (org-block-regexp):
(org-clock-drawer-re): Use \(.\|\n\) regexp instead of [^\000].
(org-latex-regexps): Do not try to match \000 inside latex fragments -
we now use parser for this purpose.

Reported-by: Tommy Kelly <tommy.kelly@verilab.com>
Link: https://orgmode.org/list/875yfk9vlv.fsf@localhost
2023-04-25 21:06:50 +02:00
Zelphir Kaltstahl d97ba5ba52
org-babel-expand-body:scheme: define header arg vars using define
* ob-scheme.el (org-babel-expand-body:scheme,
org-babel-expand-header-arg-vars:scheme): Change the way header
argument :var variables are expanded for for Scheme source blocks.  Use
`define' instead of wrapping using `let'.

Wrapping binding definitions using `let' can lead to issues with GNU
Guile and potentially other Scheme dialects.  GNU Guile will only get
to the body of the let at evaluation time, not at macro expansion
time.  If the let form wraps any imports of libraries that define
macros, then those imported macros are seen too late and their
corresponding forms inside the body of the let are not
expanded.  Using `define' to define bindings avoids this problem, at
least in GNU Guile.

For more context see the mailing list discussion at: https://lists.gnu.org/archive/html/emacs-orgmode/2023-03/msg00087.html

TINYCHANGE
2023-04-25 14:25:30 +02:00
Ihor Radchenko e065b53a4a
Merge branch 'bugfix' 2023-04-24 14:27:42 +02:00