Commit Graph

26699 Commits

Author SHA1 Message Date
Justin Vallon f18fad60b6
org-id-uuid: Use compat org-time-convert-to-list for emacs <27.1
* lisp/org-macs.el (org-id-uuid): Use `org-time-convert-to-list'
instead of `time-convert', which is not yet available in Emacs 26.
2023-07-05 13:28:38 +03:00
Evgenii Klimov 48fffa5dac
org-insert-link: Keep the link in `org-stored-links' if it was not inserted
* lisp/ol.el (org-insert-link): Keep the link in `org-stored-links' if
the command was interrupted by the user during the reading of a
description from the minibuffer.

TINYCHANGE
2023-07-04 13:43:21 +03:00
Ihor Radchenko e34b72eec6
org-make-tags-matcher: Do not try collecting tags from non-Org buffers
* lisp/org.el (org-make-tags-matcher): When building tag completion
table, do not attempt to call `org-get-buffer-tags' when current
buffer is not an Org buffer.

Reported-by: Colin Baxter <m43cap@yandex.com>
Link: https://orgmode.org/list/87ilb1fakk.fsf@yandex.com
2023-07-03 15:28:08 +03:00
Ihor Radchenko 38f87aa30a
Update Ihor Radchenko's email address
* lisp/ob-gnuplot.el:
* lisp/org-cycle.el:
* lisp/org-element-ast.el:
* lisp/org-fold-core.el:
* lisp/org-fold.el:
* lisp/org-persist.el: Update contact email of the maintainer/author.
2023-07-03 11:08:49 +03:00
Ihor Radchenko 02ad2a114f
lisp/org-element-ast.el: Fix copyright notice
Make copyright consistent with the rest of Org.
2023-07-03 11:06:55 +03:00
Ihor Radchenko 948c896448
Rename `org-element-property-1' to `org-element-property-raw'
The new name is more readable.

Link: https://orgmode.org/list/87sfail69e.fsf@localhost
2023-07-01 14:36:32 +03:00
Ihor Radchenko 66c8e94732
lisp/org-element-ast.el: Fix typo in commentary 2023-07-01 14:36:31 +03:00
Ihor Radchenko f97aeaa243
org-fold-core--isearch-setup: Use `add-function'
* lisp/org-fold-core.el (org-fold-core--isearch-setup): Use
add-function, respecting the value of `isearch-filter-predicate'.
(org-fold-core--isearch-filter-predicate-overlays): Remove.

Link: https://yhetil.org/emacs-devel/87o7lxpip9.fsf@web.de
2023-07-01 14:36:31 +03:00
Ihor Radchenko 7f337a2b95
org-fold-core: Fix isearch with `org-fold-core-isearch-open-function'
* lisp/org-fold-core.el (org-fold-core--with-isearch-active): New
macro, signaling `org-fold-core-region' to store newly created folds
in `org-fold-core--isearch-overlays'.
(org-fold-core-region): Respect the new macro.  Respect fold priority
for overlays.
(org-fold-core--isearch-setup): Do not run
`org-fold-core--clear-isearch-overlays' twice.
(org-fold-core--isearch-show): Fix when point is not on the match.
(org-fold-core--isearch-show-temporary): Rewrite, limiting to overlays
only and simplifying the code.
(org-fold-core--create-isearch-overlays): Extend link folds to full
link.
(org-fold-core--clear-isearch-overlay): Do not expect to be called in `isearch-mode-end-hook'.
* lisp/org-fold.el (org-fold--isearch-reveal): Respect argument.
2023-07-01 14:36:30 +03:00
Ihor Radchenko afbbebff3f
org-fold-core-get-folding-spec: Respect `org-fold-core-style'
* lisp/org-fold-core.el (org-fold-core-get-folding-spec): Only
consider folding using a single (currently selected) folding style.

Multiple fold styles may be present during isearch - we do not want to
mix them.
2023-07-01 14:36:29 +03:00
Ihor Radchenko 383d5dacb7
org-fold-show-set-visibility: Fix lineage visibility
* lisp/org-fold.el (org-fold-show-set-visibility): Do not reveal
everything, including drawers under heading when point is outside
drawers.  Reveal individual folding specs one by one, within their
folding bounds.
2023-07-01 14:36:28 +03:00
Ihor Radchenko 52c63f5cce
org-lint-export-option-keywords: Small refactoring
* lisp/org-lint.el (org-lint-export-option-keywords): Use
`org-element-post-affiliated'.
2023-07-01 14:36:28 +03:00
Ihor Radchenko 37a58cc6ee
org-agenda-skip: Do not alter match data
* lisp/org-agenda.el (org-agenda-skip): Never alter match-data.  The
callers often use `re-search-forward' and do not expect the match data
to be altered.
2023-07-01 14:36:27 +03:00
Ihor Radchenko f2dd1eea41
org-find-open-clocks: Fix false positives
* lisp/org-clock.el (org-find-open-clocks): Ensure that we only match
actual clock elements, not everything matching `org-clock-re',
including clocks inside verbatim environments.
2023-07-01 14:36:26 +03:00
Ihor Radchenko 759676b308
org-fold-core--isearch-show: Do not fully rely on `point'
* lisp/org-fold-core.el (org-fold-core--isearch-show): Make use of the
passed argument.  Do not just rely on `point' being at the isearch
match.

This partially fixes edge case with point being moved to the end of
the folded region during isearch.
2023-07-01 14:36:25 +03:00
Ihor Radchenko e18263fceb
org-element--substring: Fix when buffer is narrowed
* lisp/org-element.el (org-element--substring): Ignore narrowing.
2023-07-01 14:36:25 +03:00
Ihor Radchenko fcde1f779d
test-org-element/at-point: Add new test
* testing/lisp/test-org-element.el (test-org-element/at-point): Test
when point is not in current buffer.
2023-07-01 14:36:24 +03:00
Ihor Radchenko 9249275738
fixup! etc/ORG-NEWS: Document Org API changes 2023-07-01 14:36:23 +03:00
Ihor Radchenko 81e85bda2b
Fix Emacs 27 compatibility
* lisp/org-element-ast.el (org-element-create): Do not use `length='
that is not yet available.
(org-element-property-inherited): Do not use `ensure-list' that is not
yet available.
2023-07-01 14:36:22 +03:00
Ihor Radchenko 21d3b888c6
org-element-create: Fix Emacs 28 compatibility
* lisp/org-element-ast.el (org-element-create): Do not use `plistp'
that is not yet available in older Emacs.
2023-07-01 14:36:22 +03:00
Ihor Radchenko f895be1ad9
org-element--properties-mapc: Small refactoring
* lisp/org-element-ast.el (org-element--properties-mapc): Do not use
`pcase' - we are not testing for complex patterns here.
2023-07-01 14:36:21 +03:00
Ihor Radchenko 5a3224a325
etc/ORG-NEWS: Document Org API changes
* etc/ORG-NEWS (Major changes and additions to Org API):
(New functions and changes in function arguments): Document the
changes and additions to Org API.
2023-07-01 14:36:20 +03:00
Ihor Radchenko ea401fb1f4
org-agenda-ignore-properties: Bump :package-version
* lisp/org.el (org-agenda-ignore-properties): Remove :version keyword
and bump :package-version after changing the allowed values.
2023-07-01 14:36:19 +03:00
Ihor Radchenko 96b754c105
org-get-category, org-get-tags: Clarify that match data is modified
* lisp/org.el (org-get-category):
(org-get-tags): Update docstrings, documenting that these functions
may modify match data.
2023-07-01 14:36:19 +03:00
Ihor Radchenko a04e16bd11
lisp/org-macs.el: Restructure file outline, fixing compiler warning
Add new section "Misc", moving all the functions that do not belong to
other sections below.  This also fixes defun order for
`org-compile-file' that needs `org-trim' to be defined.
2023-07-01 14:36:18 +03:00
Ihor Radchenko 5ed3e1dfc3
org-refresh-category-properties: Do not check element cache
* lisp/org.el (org-refresh-category-properties): Do not check if
org-element-cache is active.  This function is now obsolete and can
only be called on purpose by third-party code that probably expects
the text properties to be assigned regardless whether the cache is
active.

This commit also fixes compiler warning as
`org-element--cache-active-p' is not declared anymore in lisp/org.el.
2023-07-01 14:36:17 +03:00
Ihor Radchenko 9ed7956afd
org-element: Use constant values for fixed deferred properties
* lisp/org-element.el (org-element--headline-archivedp):
(org-element--headline-footnote-section-p):
(org-element--headline-raw-value):
(org-element--headline-parse-title-raw):
(org-element--headline-parse-title-parse):
(org-element--headline-deferred):
(org-element--get-global-node-properties):
(org-element--headline-parent-deferred): New internal constants
holding deferred values used by parser.  These values are not a
subject of modification and thus can be re-used instead of
re-allocating a new instance for every new parsed element.
(org-element--headline-parse-title):
(org-element-headline-parser):
(org-element-org-data-parser):
(org-element-inlinetask-parser):
(org-element--parse-to): Use the new constants.

This patch aims for smaller memory footprint of Org AST and cache.
2023-07-01 14:36:16 +03:00
Ihor Radchenko 48e4a76b99
org-element: Avoid computing static regexps dynamically
* lisp/org-element.el (org-element--headline-comment-re):
(org-element--timestamp-raw-value-regexp): New internal regexp
constants.
(org-element--headline-parse-title):
(org-element-timestamp-parser): Use the new constants.
2023-07-01 14:36:15 +03:00
Ihor Radchenko 5a1dd94309
org-element: Avoid slow `end-of-line'
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#98
2023-07-01 14:36:15 +03:00
Ihor Radchenko f93d855c51
Prefer `forward-line' over `beginning-of-line'
The latter is much slower.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#98
2023-07-01 14:36:14 +03:00
Ihor Radchenko 1c7c67b3c6
org-indent-drawer, org-indent-block: Remove unnecessary checks
* lisp/org.el:
(org-indent-block):
(org-indent-drawer): Do not try to check drawer/block twice.
2023-07-01 14:36:13 +03:00
Ihor Radchenko f63000cca8
org-element--current-element: Use "nogroup" versions of regexps
* lisp/org-element.el (org-element-dynamic-block-open-re-nogroup):
(org-element--latex-begin-environment-nogroup): New constants for
internal regexps.
(org-element-comment-parser):
(org-element--current-element-re):
(org-element--current-element): Prefer string constants instead of
repeated plain strings that may be considered different by Emacs
regexp compiler.  Also, avoid groups in these regexps as creating
groups makes Emacs regexp matches allocate extra memory.  Finally,
avoid using \{N\} constructs in regexps as they are slightly more
costly for regexp engine.
2023-07-01 14:36:12 +03:00
Ihor Radchenko 110601ce74
org-element--current-element: Add FIXME 2023-07-01 14:36:12 +03:00
Ihor Radchenko b0a2deaec6
org-element--current-element: Faster property drawer check
* lisp/org-element.el (org-element--current-element): Slight
optimization of checking for property drawer at point.  `forward-line'
is significantly faster compared to `beginning-of-line'.
`skip-chars-forward' also provides a bit of improvement compared to
`looking-at-p'.

Reported-by: Mattias Engdegård <mattias.engdegard@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#80
2023-07-01 14:36:11 +03:00
Ihor Radchenko a80efaf460
org-element-node-property-parser: Remove unnecessary regexp search
* lisp/org-element.el (org-element-node-property-parser): Remove
unnecessary `re-search-forward'.  It always triggers as long as
`org-property-drawer-re' only allow node properties inside property
drawer.  Also, remove unnecessary `case-fold-search' setting that has
no meaning since we do not match against specific letters.
2023-07-01 14:36:10 +03:00
Ihor Radchenko 3ce57e17a0
org-item-re: Convert into defsubst
* lisp/org-list.el (org-item-re): Use faster `defsubst'.  This
function is called very frequently when parsing Org buffers by
`org-element--current-element'.
2023-07-01 14:36:09 +03:00
Ihor Radchenko b2482d9cc4
* testing/lisp/test-org-element.el: Add new tests
(test-org-element/type):
(test-org-element/type-p):
(test-org-element/org-element-property-1):
(test-org-element/property):
(test-org-element/properties-resolve):
(test-org-element/secondary-p):
(test-org-element/class):
(test-org-element/ast-map):
(test-org-element/properties-mapc):
(test-org-element/properties-map):
(test-org-element/org-element-create):
(test-org-element/put-property):
(test-org-element/set):
(test-org-element/lineage-map): add new and extend tests according to
the new API.
2023-07-01 14:36:09 +03:00
Ihor Radchenko 5c05ac198a
testing: Test with and without cache in more cases 2023-07-01 14:36:08 +03:00
Ihor Radchenko 16d7cdcf52
org-manual: Remove unused drawer properties to disable 2023-07-01 14:36:07 +03:00
Ihor Radchenko 01351f3eab
Restructure file organization 2023-07-01 14:36:06 +03:00
Ihor Radchenko 2b96501070
org-element: Simplify drawer and property drawer regexps
* lisp/org-element.el (org-element-drawer-re-nogroup): New constant
regexp matching drawer line without creating regexp groups.
(org-element--current-element): Use the new constant.
* lisp/org.el (org-drawer-regexp): Ensure that it is the same with
org-element version and mark for removal/alias.
(org-property-drawer-re): Simplify, removing unnecessary matching of
node property structures.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#62
2023-07-01 14:36:05 +03:00
Ihor Radchenko 39466ecf47
org-element-cache: Do not check for deferred :parent unnecessarily
* lisp/org-element.el (org-element--cache-remove):
(org-element--cache-interrupt-p):
(org-element--cache-sync):
(org-element--cache-process-request):
(org-element--parse-to):
(org-element--cache-submit-request):
(org-element--cache-for-removal): use `org-element-property-1' to
retrieve parent without checking if it is deferred.  All the cached
elements have proper parent.
2023-07-01 14:36:05 +03:00
Ihor Radchenko e1a2ea65ef
Allow syntax nodes to be supplied in place of POM in API functions
* lisp/org-agenda.el (org-agenda-entry-get-agenda-timestamp):
* lisp/org-element.el (org-element-context):
* lisp/org-habit.el (org-is-habit-p):
* lisp/org-id.el (org-id-get):
* lisp/org-macs.el (org-with-point-at):
* lisp/org.el (org-fast-tag-selection):
(org-get-tags):
(org-entry-properties):
(org--property-local-values):
(org-entry-get):
(org-entry-delete):
(org-entry-remove-from-multivalued-property):
(org-entry-member-in-multivalued-property):
(org-entry-put-multivalued-property):
(org-entry-get-with-inheritance):
(org-entry-put):
(org-read-property-value):
(org-read-property-value):
(org-property-get-allowed-values): Allow POM to be a cached Org syntax
node.
2023-07-01 14:36:04 +03:00
Ihor Radchenko 7dee228569
org-element-at-point-no-context: Update docstring 2023-07-01 14:36:03 +03:00
Ihor Radchenko 598d7bbcf2
Remove APPT_WARNTIME text property cache
* lisp/org.el (org-agenda-ignore-properties):
(org-agenda-prepare-buffers): Remove APPT_WARNTIME cache.
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-sexps):
(org-agenda-get-deadlines):
(org-agenda-get-scheduled): Use `org-entry-get' to retrieve
APPT_WARNTIME.
2023-07-01 14:36:02 +03:00
Ihor Radchenko 5898fcf269
Remove unused declares 2023-07-01 14:36:01 +03:00
Ihor Radchenko 7c549f4841
org-babel-tangle-collect-blocks: Switch to org-element API 2023-07-01 14:36:01 +03:00
Ihor Radchenko ebbdd67a2a
Remove effort property cache
* lisp/org-compat.el (org-refresh-effort-properties): Obsolete.
* lisp/org-clock.el (org-clock-in):
* lisp/org.el (org-default-properties):
(org-edit-agenda-file-list)
(org-set-property-and-value): Remove unnecessary calls to
`org-refresh-effort-properties'.
(org-agenda-ignore-properties): Update the allowed values.
2023-07-01 14:36:00 +03:00
Ihor Radchenko 2efc7fcfdc
org-agenda-get-scheduled: Switch to org-element API 2023-07-01 14:35:59 +03:00
Ihor Radchenko 06aba04f75
org-agenda-get-deadlines: Switch to org-element API 2023-07-01 14:35:58 +03:00