Commit Graph

5740 Commits

Author SHA1 Message Date
Ihor Radchenko 6c917e8904
org-timestamp-change: Fix increasing range with prefix arg
* lisp/org.el (org-modify-ts-extra): Treat INCREMENT-STEP argument as
multiplier for minutes.
(org-timestamp-change): Add commentary.  Make sure that minutes are
incremented by prefix argument when incrementing time range without
rounding.

Reported-by: Jorge P. de Morais Neto <jorge+list@disroot.org>
Link: https://orgmode.org/list/87wnoezd15.fsf@disroot.org
2023-09-19 15:31:43 +03:00
Ihor Radchenko a098c07973
* lisp/org.el (org-modify-ts-extra): Refactor the code
Rename arguments and variables to be more readable.  Add commentary
explaining the code.  Update the docstring, documenting the important
details and describing all the function arguments.
2023-09-19 14:57:20 +03:00
Ihor Radchenko edcb8eca5f
(org-fast-tag-selection): Honour tag groups when using <TAB> input
* lisp/org.el (org--add-or-remove-tag): New helper function to toggle
tags taking into account tag groups.
(org-fast-tag-selection): Factor out the tag toggling code into a new
function and re-use it in both key selection branch and in the <TAB>
completion interface.

Reported-by: sreenivas sumadithya <sumadithya@gmail.com>
Link: https://orgmode.org/list/CAHVqzFVP9KhrC5ZG_GUHbXZRBVg+PU+tR91vSfrnirLo7_T5Ug@mail.gmail.com
2023-09-19 12:43:00 +03:00
Ihor Radchenko aee3f2227f
* lisp/org.el (org-mode): Initialize cache before parsing buffer keywords
If we load cache after `org-set-regexp-and-options', we may do double
job as `org-set-regexp-and-options' by itself queries cache.
2023-09-16 11:40:56 +03:00
Ihor Radchenko df0539d678
* lisp/org.el (org-cdlatex-mode): Try to load texmathp
Attempt to load texmathp before setting advice.  `texmathp' is
optional and must be loaded before `cdlatex'.
2023-09-14 12:37:12 +03:00
Ihor Radchenko 515e4ed49b
* lisp/org.el (org--get-expected-indentation): Remove redundant cond clause
Reported-by: No Wayman <iarchivedmywholelife@gmail.com>
Link: https://orgmode.org/list/87wmwzdwx8.fsf@gmail.com
2023-09-10 10:38:19 +03:00
Jens Schmidt 234650af2e
org-make-tags-matcher: Re-add quoting of property names
* lisp/org.el (org-make-tags-matcher):
* testing/lisp/test-org.el (test-org/map-entries): Move special cased
handling of LEVEL properties.  Add tests for other special cased
properties TODO and CATEGORY.

* lisp/org.el (org-make-tags-matcher):
* doc/org-manual.org (Matching tags and properties):
* testing/lisp/test-org.el (test-org/map-entries): Re-add and extend
quoting of property names in search strings.

Link: https://orgmode.org/list/87h6oq2nu1.fsf@gmail.com
2023-09-03 09:48:41 +03:00
Ihor Radchenko 1665283f25
Merge branch 'bugfix' 2023-08-24 10:18:02 +03:00
Liu Hui 973e50c839
* lisp/org.el (org-at-timestamp-p): Fix match groups in docstring
The docstring was not accurate from the times when group information
was added to it.  The patch uses the groups, as they appear in the
function code itself.
2023-08-24 10:16:22 +03:00
Ihor Radchenko 19a1a5024b
Update version number for the 9.6.8 release 2023-08-22 10:35:22 +03:00
Ihor Radchenko 7219b006bd
org-element: Fix loading obsolete persistent caches
* lisp/org-element.el (org-element-cache-version): New constant
defining the current cache version.
(org-element-cache-reset): Use the new variable.
* lisp/org.el (org-mode): Assert loading the correct cache version.

Reported-by: Gregor Zattler <telegraph@gmx.net>
Link: https://orgmode.org/list/87350cvm3d.fsf@no.lan
2023-08-21 13:24:41 +03:00
Ihor Radchenko 299193bf09
org-display-remote-inline-images: Add new allowed value t
* lisp/org.el (org-display-remote-inline-images): Allow value t as
alias to cache.
(org--create-inline-image): Handle t value.
2023-08-20 14:15:49 +03:00
Ihor Radchenko 7a4784b122
org-fast-tag-selection: Fix when C-g is pressed
* lisp/org.el (org-fast-tag-selection): Fix "no catch" error.  But do
not directly set `quit-flag' as it was done in the earlier versions.
Instead, call `keyboard-quit', allowing it to perform the necessary
cleanups.
2023-08-20 09:36:40 +03:00
Ihor Radchenko e17ca87994
Merge branch 'bugfix' 2023-08-20 09:30:59 +03:00
Ihor Radchenko 7b38670e69
fixup! org-insert-heading: Fix when folded text is kept right at the new heading
* lisp/org.el (org-insert-heading): Fix missing newline when inserting
before existing heading.
* testing/lisp/test-org.el (test-org/insert-heading): Add test
checking for the fixed failure.  Update tests.
(test-org/insert-todo-heading-respect-content): Update tests.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/ubrugh$be1$1@ciao.gmane.io
2023-08-20 09:28:15 +03:00
Ihor Radchenko 54f8b0bfd0
Merge branch 'bugfix' 2023-08-19 10:55:08 +03:00
Ihor Radchenko 52bc95676c
org-insert-heading: Fix when folded text is kept right at the new heading
* lisp/org.el (org-insert-heading): Do not slurp blank lines after
previous heading into the contents of the newly added one.  These
blank lines might be folded and we end up with point before folded
spaces * <point>...
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
(test-org/insert-todo-heading-respect-content): Do not expect trailing
newline after the newly added heading.  The test did not intentionally
test this particular behavior (other tests do not expect trailing
newlines to be _always_ added).

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/ubpcoi$f7n$1@ciao.gmane.io
2023-08-19 10:52:25 +03:00
Ihor Radchenko 928f2d7fb0
Revert "org-return: Do not insert inside folded region"
This reverts commit a25d00d5df.

Direct call to `org-fold-check-before-invisible-edit' is no longer
necessary on main.  We use `org-fold-catch-invisible-edits-commands'.
2023-08-19 10:27:09 +03:00
Ihor Radchenko 73e332a307
Merge branch 'bugfix' 2023-08-19 10:27:00 +03:00
Ihor Radchenko a25d00d5df
org-return: Do not insert inside folded region
* lisp/org.el (org--newline): When called interactively, check for
invisible edits.

Reported-by: Kaiyu Zheng <kaiyu_zheng@alumni.brown.edu>
Link: https://orgmode.org/list/87wmxs8hxt.fsf@localhost
2023-08-19 10:23:40 +03:00
Ihor Radchenko d1e4b93519
org-copy-subtree: Do not consider inlinetask to be a subtree of its own
* lisp/org.el (org-copy-subtree): Go up to parent heading when we are
at or inside inlinetask.
2023-08-17 14:25:43 +03:00
Jens Schmidt f689eb44f1
org-make-tags-matcher: Add starred property operators, fix quoting
* lisp/org.el (org-make-tags-matcher): Add starred property operators.
Recognize additional operators "==", "!=", "/=".  Clean up and
document match term parsing.  Remove needless and buggy unquoting of
minus characters in property and tag names.
(org-op-to-function): Recognize additional inequality operator "/=".

* doc/org-manual.org (Matching tags and properties): Add documentation
on starred and additional operators.  Document allowed characters in
property names and handling of minus characters in property names.

* testing/lisp/test-org.el (test-org/map-entries): Add tests for
starred and additional operators.  Add tests for property names
containing minus characters.

* etc/ORG-NEWS: (~org-tags-view~ supports more property operators):
Add announcement on starred and additional operators.

Link: https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a2367d2@vodafonemail.de
2023-08-08 10:01:00 +03:00
Ihor Radchenko da8fabf464
org-delete-indentation: Fix Emacs 26 compatibility
* lisp/org.el (org-delete-indentation): `delete-indentation' in Emacs
26 does not yet accept region boundaries.  Provide compatibility
fallback.
2023-08-06 10:22:18 +03:00
Ihor Radchenko 8dfd8c987c
org-format-latex: Add FIXME
* lisp/org.el (org-format-latex): Mark `overlay-recenter' call for
removal after Emacs 28 support is dropped.
2023-08-05 16:14:25 +03:00
Ihor Radchenko 8d6ec48b84
org-end-of-subtree: Fix when inside inlinetask
* lisp/org.el (org-end-of-subtree): Do not consider inlinetasks as
dedicated subtrees.
* testing/lisp/test-org.el (test-org/end-of-subtree): New test.
2023-08-05 09:48:10 +03:00
Ihor Radchenko 63e8cac2ca
org-goto-sibling: Fix when called from inlinetask
* lisp/org.el (org-goto-sibling): Do not try to find inlinetask
siblings.  Clarify the docstring.
* testing/lisp/test-org.el (test-org/goto-sibling): New test.
2023-08-02 16:06:02 +03:00
Ihor Radchenko 345d4e09b5
org-insert-drawer: Make sure that point is left inside drawer
* lisp/org.el (org-insert-drawer): Leave and reveal point inside
drawer even when we insert property drawer or drawer around region, as
advertised by the docstring.
2023-08-02 15:42:53 +03:00
Ihor Radchenko f9d2d92f42
Merge branch 'bugfix' 2023-08-02 08:18:15 +03:00
Ihor Radchenko 6c1ff952fe
Make transient overlay lists permanent-local
* lisp/org-clock.el (org-clock-overlays):
* lisp/org-colview.el (org-columns-overlays):
* lisp/org-num.el (org-num--overlays):
* lisp/org-table.el (org-table-header-overlay):
(org-table-coordinate-overlays):
* lisp/org.el (org-custom-properties-overlays):
(org-occur-highlights):
(org-inline-image-overlays): Mark as permanent-local to not lose track
of the overlays when changing major modes.

Reported-by: Eli Qian <eli.q.qian@gmail.com>
Link: https://orgmode.org/list/871qgmeleu.fsf@gmail.com
2023-08-02 08:16:47 +03:00
Ihor Radchenko 01bf57488c
lisp/org.el: Define `org-rear-nonsticky-at' defsubst before its first usage
This fixes compiler warning.
2023-07-30 12:26:49 +03:00
Ihor Radchenko d5006e195a
Merge branch 'bugfix' 2023-07-30 12:22:09 +03:00
Ihor Radchenko dc78f09465
org-up-heading-safe: Fix when parent is not a heading
* lisp/org.el (org-up-heading-safe): Do not assume that
`org-element-parent' is always a heading.  Use `org-element-lineage'
to get parent heading specifically.  Move point to current heading
even when no parent heading is available, as expected by some of the
other Org routines.  Document moving point when no parent.
* testing/lisp/test-org.el (test-org/up-heading-safe): Add tests.

Reported-by: Daniel Liden <djliden91@gmail.com>
Link: https://orgmode.org/list/CAG=u__pAT9k_AsRG6cpyPPUt0__5S7o=3a8WWkAijuPPuGc7Cg@mail.gmail.com
2023-07-26 11:01:34 +03:00
Ihor Radchenko 724135ddaf
fixup! org-do-emphasis-faces: Make sure that 'invisible property is not sticky 2023-07-19 10:05:30 +03:00
Ihor Radchenko 3e3b873d3f
org-do-emphasis-faces: Make sure that 'invisible property is not sticky
* lisp/org.el (org-do-emphasis-faces): Mark invisible text property in
emphasis markers non-sticky.  This is usually not a problem as we
manage invisible text property via font-lock.  However subtle bugs may
exist with non-interactive calls to Elisp primitives that inherit text
properties (like `indent-to').

Reported-by: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Link: https://orgmode.org/list/8b691a7f-6b62-d573-e5a8-80fac3dc9bc6@vodafonemail.de
2023-07-18 11:10:46 +03:00
Ihor Radchenko 1967aa43e5
org-src-preserve-indentation: Refactor handling src block flags
* lisp/org-src.el (org-src-preserve-indentation-p): New function
checking whether block should preserve indentation.  This function
abstracts away the check for block type, indentation flag, and
customized `org-src-preserve-indentation' value.
(org-src--edit-element):
* lisp/ob-core.el (org-babel--normalize-body):
(org-babel-read-element):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-element.el (org-element-example-block-interpreter):
(org-element-src-block-interpreter):
* lisp/org.el (org-fixup-indentation):
(org-indent-region):
* lisp/ox.el (org-export-unravel-code): Use the new function instead
of duplicating code.

* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Add FIXME.  We
do not have access to the block element here and cannot easily check
the flag.

* lisp/ob-tangle.el (org-babel-tangle-single-block):
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org.el (org-indent-line): Check block flag in addition to `org-src-preserve-indentation'.

This commit unifies logic deciding whether to preserve block
indentation into a single place to avoid confusion.
2023-07-13 11:51:15 +03:00
Ilya Chernyshov c74c4ab18d
lisp/org-element.el: Add new timestamp property :range-type
The new property is needed to reduce ambiguity when interpreting the
parsed data.

* lisp/org-element.el (org-element-timestamp-interpreter): Preserve old
behavior when :range-type is `nil'.  Take into account :range-type
value when interpreting ranges.  When :range-type is `timerange',
return a timerange (<YYYY-mm-DD HH:MM-HH:MM>).  If :range-type is
`daterange' return a daterange (<...>--<...>).  When :range-type is
nil, return a daterange (as it was before).  When :range-type is
`daterange' or `timerange' and :type is `active'/`inactive', throw an
error.
(org-element-timestamp-parser): Add :range-type property.

* lisp/org.el (org-timestamp-split-range): Make sure that :range-type
is nil for a split timestamp.

* testing/lisp/test-org-element.el
(test-org-element/timestamp-interpreter): Add new tests.
(test-org-element/timestamp-parser): Add tests for :range-type
property.

* etc/ORG-NEWS (Major changes and additions to Org API): Add news about this property.

Link: https://list.orgmode.org/orgmode/87y1ot6dqz.fsf@gmail.com/
2023-07-12 11:12:46 +03:00
Ihor Radchenko 0b6f9f8677
Fix typo in `org-todo-log-states' variable name
* doc/org-manual.org (Priorities):
* lisp/org.el (org-update-parent-todo-statistics): Fix incorrect
spelling of `org-todo-log-states' variable.

Reported-by: Evgenii Klimov <eugene.dev@lipklim.org>
Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://list.orgmode.org/orgmode/e900a08d-11af-9106-423e-28a2befe813d@gmail.com/
2023-07-11 12:06:52 +03:00
Sébastien Miquel 2e2ed40553
org-src.el: Use native value of `indent-tabs-mode' for indentation
* lisp/org.el (org-indent-line): Simplify native indentation inside
src block.  Ensure we add the org indentation if the line is empty.
* lisp/org-macs.el (org-do-remove-indentation): Preserve
indentation (spaces vs tabs) past the common indentation to remove.
Do not empty blank lines.
* lisp/org-src.el (org-src--contents-for-write-back): Preserve the
native indentation (spaces vs tabs).  If necessary, add a common org
indentation to the block according to org's `indent-tabs-mode'.
(org-src-font-lock-fontify-block): Display the native indentation tab
characters with a fixed width, according to the native tab width
value, to preserve vertical alignement in the org buffer.
* testing/lisp/test-org-src.el (test-org-src/indented-blocks): Update
tests.  Indentation no longer obeys `indent-tabs-mode' from the org
buffer, but is separated in an eventual org part, and the native part.

Link: https://list.orgmode.org/87a5wcez7e.fsf@localhost/T/#t
2023-07-07 11:58:43 +03:00
Evgenii Klimov 402f72ad4f
lisp/org.el: Add final hooks to S-/M-/S-M-cursor commands
* lisp/org.el (org-metaleft-final-hook, org-metaright-final-hook,
org-metaup-final-hook, org-metadown-final-hook): Define final hooks
for S-cursor commands.
(org-metaleft, org-metaright, org-metaup, org-metadown): Add final
hooks to M-commands and document them in the docstring.

* lisp/org.el (org-shiftup, org-shiftdown, org-shiftright,
org-shiftleft): Document hooks for S-cursor commands in the docstring.

* lisp/org.el (org-shiftmetaleft-final-hook,
org-shiftmetaright-final-hook, org-shiftmetaup-final-hook,
org-shiftmetadown-final-hook): Define final hooks for the S-M-cursor
commands.
(org-shiftmetaleft, org-shiftmetaright, org-shiftmetaup,
org-shiftmetadown): Add final hooks to the S-M-cursor commands and
document hooks in the docstring.

* etc/ORG-NEWS (New final hooks for Modifier-Cursor keys): Document
new hooks.

TINYCHANGE
2023-07-05 13:40:19 +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 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 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 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 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 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 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 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