Commit Graph

2103 Commits

Author SHA1 Message Date
Ihor Radchenko bc51dfcb74
org-agenda-kill: Fix deleting wrong entry when Org buffer is narrowed
* lisp/org-agenda.el (org-agenda-kill): Use `org-with-point-at' to
jump to origin Org buffer from agenda.  It automatically widens the
buffer.
(org-remove-subtree-entries-from-agenda): Temporarily lift narrowing
when calculating the list of headings to clean up from the agenda.

Link: https://old.reddit.com/r/emacs/comments/1cog1fb/agenda_kills_wrong_item_in_orgmode_when_buffer_is/
2024-05-11 19:32:50 +03:00
Ihor Radchenko db5478108c
org-agenda-tree-to-indirect-buffer: Obey `org-indirect-buffer-display'
* lisp/org-macs.el (org-display-buffer-in-window): New helper function
to display buffer in specific window (when it is live).
* lisp/org.el (org-tree-to-indirect-buffer): By default, reuse the
window previously used for an existing indirect buffer, if it is in
the same frame.
* lisp/org-agenda.el (org-agenda-do-tree-to-indirect-buffer): Remove.
(org-agenda-tree-to-indirect-buffer): Merge with
`org-agenda-do-tree-to-indirect-buffer' and remove special handling of
the existing indirect buffer window that overrides
`org-indirect-buffer-display'.
(org-agenda-do-context-action): Force `org-indirect-buffer-display' to
be 'other-window when displaying subtree at point in
org-agenda-follow-mode.

This patch reverts 35d6d9f50, implementing an alternative fix for
stabilizing indirect buffer window selection.  Unlike the existing
fix, it utilizes display buffer action and does not cause clashes with
custom `org-indirect-buffer-display'.

Reported-by: JV <misc@jeffvalk.com>
Link: https://orgmode.org/list/1a4c7a04-8536-40c7-899e-ba433a1252fd@jeffvalk.com
2024-05-11 16:19:52 +03:00
Ihor Radchenko 4131926984
org: New Org-wide custom option `org-sort-function'
* lisp/org-macs.el (org-sort-function): New customization defining how
Org mode should sort headlines, table lines, agenda lines, etc.
(org-string<):
(org-string<=):
(org-string>=):
(org-string>): Use the new customization.
(org-string<>): Add docstring.
(org-sort-function-fallback): New helper function to help users on
MacOS where `string-collate-lessp' is not reliable.
* lisp/oc-basic.el (org-cite-basic--field-less-p):
* lisp/org-agenda.el (org-cmp-category):
(org-cmp-alpha):
* lisp/org-list.el (org-sort-list):
* lisp/org-mouse.el (org-mouse-list-options-menu):
* lisp/org-table.el (org-table-sort-lines):
* lisp/org.el (org-tags-sort-function):
(org-sort-entries):
* lisp/ox-publish.el (org-publish-sitemap): Honor the new
customization.
* lisp/org-mouse.el (org-mouse-tag-menu):
(org-mouse-popup-global-menu):
* lisp/org-agenda.el (org-cmp-tag): Honor `org-tags-sort-function' and
falling back to `org-string<' if note set.
* etc/ORG-NEWS (New option controlling how Org mode sorts things
~org-sort-function~): Announce the change.

This change aims to standardize the way Org mode performs sorting of
user data.  In particular, it addresses issues with oddities of string
collation rules on MacOS and tricky language environments like
Turkish.

Link: https://orgmode.org/list/87jzleptcs.fsf@localhost
2024-05-11 12:34:30 +03:00
Ihor Radchenko c8bd2092b1
org-agenda-mode: Honor hidden link descriptions
* lisp/org-agenda.el (org-agenda-mode): Hide 'org-link invisibility
spec, as in Org mode.

Reported-by: Bastien <bzg@gnu.org>
Link: https://orgmode.org/list/87seyww65g.fsf@gnu.org
2024-05-05 20:27:13 +03:00
Ihor Radchenko 5da0eb6ea7
org-element-timestamp-parser: Allow time in diary sexp timestamps
* lisp/org-agenda.el (org-agenda-get-timestamps):
* lisp/org-element.el (org-element--timestamp-regexp): Adjust
timestamp regexp.
(org-element-timestamp-parser): Support the new syntax for diary sexp
timestamps.  The diary sexp is now stored in :diary-sexp property and
the time/time range is stored as usual.
(org-element-timestamp-interpreter): Interpret diary timestamp
according to its building blocks rather than raw value.
* testing/lisp/test-org-agenda.el (test-org-agenda/diary-timestamp):
New test checking for agenda support of times in diary timestamps.
*
testing/lisp/test-org-element.el (test-org-element/timestamp-interpreter):
Add parser tests.
* doc/org-manual.org (Timestamps): Add an example of the new syntax to
the manual.
* etc/ORG-NEWS (Diary type timestamps now support optional
time/timerange): Document the Org syntax addition.

This syntax modification is fixing an omission in org-element.el.  In
the past, org-agenda had explicit support for diary timestamps with
time/timerange, but that support was ad-hoc.  Now, after org-agenda
switched to use parser, we must modify Org syntax to fix the feature
regression.
2024-05-03 13:42:06 +03:00
Ihor Radchenko a2e5685e49
Do not use org-fold to hide link parts
* lisp/ol.el (org-link--link-folding-spec):
(org-link--description-folding-spec):
(org-link-descriptive-ensure): Remove.
(org-toggle-link-display): Rely upon font-lock to update link display.
* lisp/org-agenda.el (org-agenda-mode): Remove no-longer-necessary
org-fold initializer.
* lisp/org-fold.el (org-fold-initialize): Remove link-related fold
types.
(org-fold-show-set-visibility):
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org.el (org-do-emphasis-faces):
(org-unfontify-region): Remove special handling of link folds.
* lisp/org.el (org-mode): Remove folding setup for links.
(org-activate-links--text-properties): Remove.
(org-activate-links): Honor `org-link-descriptive' dynamically.

This change reflects de-facto situation where we cannot use folding
system to hide links reliably.  Even though we promise in Org 9.6 that
hidden parts of the link can be searched, the way it can be
implemented is not reliable and is working around upstream mechanisms.
Upstream changes are necessary to properly support isearch in text
hidden using text properties; workarounds attempted in org-fold-core
do not cut it because too many built-in Emacs libraries and also
third-party libraries rely upon internal implementation details of
isearch (due to limitations of its API).
2024-05-02 12:29:27 +03:00
Ihor Radchenko dba92f72d3
Merge branch 'bugfix' 2024-04-22 16:44:27 +03:00
Ihor Radchenko 0db82ee8f8
org-agenda-manipulate-query: Fix repeated canceled calls
* lisp/org-agenda.el (org-agenda-manipulate-query): When called
multiple times, discarding edits, prevent accumulating trailing + + +
- +{} in the query string.

Reported-by: Carlos Pita <carlosjosepita2@gmail.com>
Link: https://orgmode.org/list/87r1be97xd.fsf@localhost
2024-04-22 16:42:08 +03:00
Ihor Radchenko 78e9dd0c42
Fix when user customization makes Org dialogues pop up in new frames
* lisp/ol.el (org-insert-link):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
* lisp/org-attach.el (org-attach):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-goto.el (org-goto-location):
* lisp/org-macs.el (org-mks):
* lisp/org-table.el (org-table-fedit-finish):
* lisp/org.el (org-offer-links-in-entry):
* lisp/ox.el (org-export-dispatch): Arrange the dialogue window to be
killed when it is displayed in a new frame.
`save-window-configuration' is not enough in such scenarios.  Use
`quit-window' instead.
* lisp/org-table.el (org-table-edit-formulas): Prohibit popping up
table editor in a new frame.  This is because the major mode for
formula editing makes assumptions about where the editor window is
located and does not work reliably in a separate frame.

Reported-by: Björn Bidar <bjorn.bidar@thaodan.de>
Link: https://orgmode.org/list/87jzlcoxuq.fsf@
2024-04-10 15:42:52 +03:00
Ihor Radchenko be80f4319f
fixup! Honor `display-buffer-alist' when creating dialogues
Fix Emacs <29 compatibility.
2024-04-07 16:02:35 +03:00
Ihor Radchenko 18fbb9985f
Honor `display-buffer-alist' when creating dialogues
* lisp/org-macs.el (org-display-buffer-split): New function to display
just the new buffer and current buffer visible in the frame.  To be
used as `display-buffer' ACTION parameter.
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
(org-agenda-fit-window-to-buffer):
(org-agenda-prepare-window):
(org-agenda-switch-to):
* lisp/org-capture.el (org-capture-place-template):
* lisp/org-goto.el (org-goto-location):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org.el (org-tree-to-indirect-buffer):
(org-fast-todo-selection):
(org-add-log-note):
(org-fast-tag-selection):
(org-submit-bug-report):
* lisp/ox.el (org-export--dispatch-ui): Get rid of calling
`delete-other-windows' manually.  Instead, make use of
`org-display-buffer-slip' + `pop-to-buffer'/`display-buffer'.  This
way, user overrides in `display-buffer-alist' are honored.
* lisp/org-plot.el (org-plot/gnuplot):
* lisp/org.el (org-offer-links-in-entry): When `delete-other-windows'
cannot be avoided, make it ignore errors in the frames where
displaying a lone window is forbidden.
2024-04-07 13:34:13 +03:00
Ihor Radchenko 5fa0f0c6fe
Support completion boundaries when completing olp, tags, and agenda filter
* lisp/org-agenda.el (org-agenda-filter-completion-function):
* lisp/org-refile.el (org-olpath-completing-read):
* lisp/org-tags.el (org-tags-completion-function): Add support for
orderless/flex completion styles that require boundaries operation.
2024-03-22 13:50:45 +03:00
Ihor Radchenko 1b99cccbe9
Merge branch 'bugfix' 2024-03-21 15:56:36 +03:00
Ihor Radchenko 5dbf930c2d
org-agenda-clock-cancel: Unmark clocking tasks in the agenda buffer
* lisp/org-agenda.el (org-agenda-clock-cancel): When canceling clock,
remove clocking overlays from current agenda buffer.
2024-03-21 15:55:21 +03:00
Anand Deopurkar 8ac99c33f0
org-agenda.el: Fix org-agenda-write to avoid duplicates
* lisp/org-agenda.el (org-agenda-write): Make sure headlines are not
duplicated when writing to an `org' file, even if they are repeated in
the agenda view.

For example, a headline may appear multiple times in the agenda
view (for example, if it has multiple time stamps).  But
org-agenda-write should write it only once to the output `org' file.

TINYCHANGE
2024-03-03 16:44:54 +03:00
Tim Ruffing 356072c1d6
org-agenda: Make sure skipping warning/delay days never increases their number
* lisp/org-agenda.el (org-agenda-get-deadlines, org-agenda-get-scheduled):
Use minimum of warning/delay days specified in timestamp cookie and the
limit specified by `org-agenda-skip-deadline-prewarning-if-scheduled' or
`org-agenda-skip-scheduled-delay-if-deadline`, respectively.
* testing/lisp/test-org-agenda.el (test-org-agenda/skip-deadline-prewarning-if-scheduled):
New test.

Link: https://orgmode.org/list/59e48dfe744dc9409ff47183255bc64e92d26d88.camel@timruffing.de

TINYCHANGE
2024-02-27 15:40:18 +03:00
Ihor Radchenko fef873b1cf
org-agenda-get-restriction-and-command: Do not leave window around
* lisp/org-agenda.el (org-agenda-get-restriction-and-command): When
agenda selection is aborted or completed by any means, quit agenda
command selection window.

Reported-by: Björn Bidar <bjorn.bidar@thaodan.de>
Link: https://list.orgmode.org/orgmode/87il2ai916.fsf@/
2024-02-27 12:18:34 +03:00
Ihor Radchenko 19db45f2cc
org-agenda-filter-by-category: Fix using truncated category as a filter
* lisp/org-agenda.el (org-agenda-format-item): Do not store truncated
category in 'org-category property when `org-agenda-prefix-format'
causes truncation.  This leads to agenda filters assuming truncated
version of the category as the true value, which is incorrect.

Reported-by: John Mathena <jmmathena@gmail.com>
Link: https://orgmode.org/list/CADywB5Lonxw-t1H7cvK+Au3oWq=EsB=Bthj13pt03MRP-Fn-4w@mail.gmail.com
2024-02-24 12:33:27 +03:00
Ihor Radchenko 62956196d0
org-agenda: Fix entries with timestamps without day name
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-progress): When matching specific date in timestamp,
do not demand that timestamp to contain day name.

Reported-by: Stephen J. Eglen <sje30@cam.ac.uk>
Link: https://orgmode.org/list/874jejrij6.fsf@localhost
2024-02-08 16:01:29 +01:00
Ihor Radchenko b26745b985
org-agenda: Fix meaning of 'repeated-after-deadline value of `org-agenda-skip-scheduled-if-deadline-is-shown'
* lisp/org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown):
Move 'repeated-after-deadline value into a new custom option.
(org-agenda-skip-scheduled-repeats-after-deadline): Create a new
custom option to make agenda hide scheduled entries repeated past
deadline.
* lisp/org-agenda.el (org-agenda-get-scheduled): Use the new custom
option.  Do not demand deadline to be actually shown when deciding
whether to skip scheduled repeats past deadline.  This fixes a bug
when repeats continue to be displayed if past deadline is not
displayed within agenda span.
* doc/org-manual.org (Repeated tasks): Adjust manual entry, mentioning
the new custom option.
* etc/ORG-NEWS (~repeated-after-deadline~ value of
~org-agenda-skip-scheduled-repeats-after-deadline~ is moved to a new
customization): Announce the change.
*
testing/lisp/test-org-agenda.el (test-org-agenda/skip-scheduled-repeats-after-deadline):
Add new test.

Reported-by: Morgan Smith <Morgan.J.Smith@outlook.com>
Link: https://orgmode.org/list/874jft6vpj.fsf@localhost
2024-02-07 13:21:34 +01:00
Andrew Hyatt f490c1548a
org-agenda: New customization `org-agenda-start-with-archives-mode'
* lisp/org-agenda.el: Add `org-agenda-start-with-archives-mode'.
(org-agenda-mode): Set value of `org-agenda-archive-mode' according to
value of new variable `org-agenda-start-with-archives-mode'.

* doc/org-manual.org: Note new variable in the documentation of
`org-agenda-archives-mode'.

* etc/ORG-NEWS: Note change to add
`org-agenda-start-with-archives-mode'.
2024-01-29 17:56:42 +01:00
Ihor Radchenko 78dc58508d
Obsolete org-switch-to-buffer-other-window and org-no-popups
* lisp/org-compat.el (org-switch-to-buffer-other-window):
(org-no-popups): Move from org-macs.el and mark obsolete.
* lisp/ob-lilypond.el (org-babel-lilypond-execute-tangled-ly):
(org-babel-lilypond-mark-error-line):
* lisp/ol.el (org-insert-link):
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
(org-agenda-prepare-window):
(org-agenda-goto):
(org-agenda-open-link):
(org-agenda-clock-goto):
(org-agenda-diary-entry-in-org-file):
(org-agenda-add-entry-to-org-agenda-diary-file):
(org-agenda-show-the-flagging-note):
* lisp/org-attach.el (org-attach):
* lisp/org-capture.el (org-capture-place-template):
(org-capture-fill-template):
* lisp/org-clock.el (org-clock-select-task):
* lisp/org-macs.el (org-mks):
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org-table.el (org-table-edit-field):
(org-table-edit-formulas):
(org-table-show-reference):
* lisp/org.el (org-fast-todo-selection):
(org-add-log-note):
(org-fast-tag-selection):
* lisp/ox.el (org-export-stack-view):
(org-export--dispatch-ui): Use `switch-to-buffer-other-window'.
* etc/ORG-NEWS (Org mode no longer disallows configuring
~display-buffer-alist~ to open Org popups in other frame): Document
the breaking change.

Reported-by: Jan Seeger
Link: https://orgmode.org/list/87pmr3mfq3.fsf@localhost
2024-01-24 15:00:26 +01:00
Ihor Radchenko a19a72f7d3
org-agenda: Fix grid lines when `org-agenda-default-appointment-duration' is non-nil
* lisp/org-agenda.el (org-agenda-add-time-grid-maybe): Let-bind
`org-agenda-default-appointment-duration' to nil when formatting the
grid lines.  Otherwise, `org-agenda-format-item' logic fails to
produce the expected result.
* testing/lisp/test-org-agenda.el (test-org-agenda/time-grid): Add new
test set covering the bug and several simpler cases.
* testing/examples/agenda-file2.org (two): New test file example.

Reported-by: Detlef Steuer <steuer@hsu-hh.de>
Link: https://orgmode.org/list/87edv5fv1w.fsf@localhost
2024-01-17 15:40:24 +01:00
Ihor Radchenko 6592c766d2
org-agenda-bulk-mark: Fix mark not being visible when column view is active
* lisp/org-agenda.el (org-agenda-bulk-mark): Use 'before-string in the
mark overlay to make sure that higher-priority Org agenda columns
overlay is not making the mark completely invisible.

Link: https://old.reddit.com/r/orgmode/comments/13jbjep/is_it_possible_to_show_a_selection_mark_in/
2024-01-11 14:12:32 +01:00
Ihor Radchenko f22be2878f
org-agenda: Fix hard-coded day lengths when calculating timestamp regexp
* lisp/org-agenda.el (org-agenda-get-timestamps):
(org-agenda-get-progress): Do not assume that all the timestamps have
length of exactly 12 (English).  Use options argument for
`org-time-stamp-format' instead to drop brackets from the timestamp.
2024-01-10 16:07:11 +01:00
Ihor Radchenko d0a917ab23
org-agenda-get-progress: Fix detecting time when todo keyword contains ]
* lisp/org-agenda.el (org-agenda-get-progress): Improve accuracy
matching time inside state note.

The old code failed to match time in
- State "[X]"        from "[ ]"        [2022-10-25 Tue 10:00]

Link: https://old.reddit.com/r/orgmode/comments/ycshlg/orgagendalogmode_does_not_display_time_for/
2024-01-10 16:07:06 +01:00
Kyle Meyer 72a2db86d9 Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
Po Lu 9f1d6dfd73 Backport commit 8e1c56ae4 from Emacs
; Add 2024 to copyright years
8e1c56ae46754dd7baedff49a464f078f0e9912d
Po Lu
Tue Jan 2 09:47:10 2024 +0800
2024-01-06 15:48:23 -05:00
Ihor Radchenko fa198cbbe4
org-agenda-search-headline-for-time: Ignore all the timestamps in headings
* lisp/org-agenda.el (org-agenda-format-item): When
`org-agenda-search-headline-for-time' is non-nil, exclude timestamps
in headings from searching the time.
(org-agenda-search-headline-for-time): Remove warning about timestamps
in headings from the docstring.
* etc/ORG-NEWS (~org-agenda-search-headline-for-time~ now ignores all
the timestamp in headings): Announce the change.

Reported-by: rameiko87@posteo.net
Link: https://orgmode.org/list/dc5c0aa3748f5d7ad8b79bea674266e7@posteo.net
2024-01-06 13:29:43 +01:00
Nafiz Islam a27a1b87b5
lisp/org-agenda.el (org-todo-list): Rename variables and format
* lisp/org/org-agenda.el
(org-todo-list): Use `org-today' directly for `calendar-gregorian-from-absolute'.
(org-todo-list): Replace `date' with `today' (`date' is no longer used).
(org-todo-list): Replace `kwds' with `todo-keywords'.
(org-todo-list): Replace `rtn' with `todo-entries'.
(org-todo-list): Replace `rtnall' with `all-todo-entries'.
(org-todo-list): Replace some `and' with `when' and `cond'.
(org-todo-list): Some whitespace changes.

TINYCHANGE
2024-01-04 16:00:07 +01:00
Morgan Smith 11e16e5f9e
lisp/org-agenda.el: Check agenda type earlier
lisp/org-agenda.el (org-agenda-goto-date): Check agenda type earlier.
Also remove redundant error.

When this function is run on a todo agenda the user is given the
undescriptive error "(wrong-type-argument listp "todo")" because we
attempt to parse the 'org-last-args text-property prematurely.  With
this change users will get the much better error "Not allowed in
'todo'-type agenda buffer or component".
2023-12-24 12:11:16 +01:00
Ihor Radchenko 7505055f58
org-agenda-to-appt: Do not hard-code not-done todo keywords
* lisp/org-agenda.el (org-agenda-to-appt): Use org-todo-regexp and
org-not-done-regexp to determine whether an even is already done.

Reported-by: Raffael Stocker <r.stocker@mnet-mail.de>
Link: https://orgmode.org/list/yplmsf4ac6va.fsf@mnet-mail.de
2023-12-12 12:55:11 +01:00
Ihor Radchenko a1fa521975
org-agenda-format-item: Do not call `org-get-outline-path' in non-Org buffer
* lisp/org-agenda.el (org-agenda-format-item): Avoid invoking Org
parser when we are not actually in Org buffer.  Add commentary
explaining when it can happen.

Reported-by: Will O'Brien <will.08rien@gmail.com>
Link: https://orgmode.org/list/m2leawo9zo.fsf@hazy.com
2023-11-17 15:04:28 +02:00
bzg 201625f7e2 lisp/org-agenda.el: Display commands in a more consistent order
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Display commands in a more consistent order.
2023-10-16 10:30:03 +02:00
Ihor Radchenko fa7542d74c
* lisp/org-agenda.el (org-agenda-get-progress): Fix clock log entries
Do not alter match data when calling `org-get-category'.  The
subsequent code assumes that match data is not altered.
2023-10-16 10:34:14 +03:00
Ihor Radchenko e1569918cc
org-agenda: Handle inactive ranges when displaying inactive timestamps
* lisp/org-agenda.el (org-agenda-get-timestamps): Skip inactive
ranges.  Previously, inactive ranges were treated as two individual
timestamps.
(org-agenda-get-blocks): Handle inactive ranges when
`org-agenda-include-inactive-timestamps' is non-nil.  Append
`org-agenda-inactive-leader' when formatting inactive ranges.

Reported-by: Cletip Cletip <clement020302@gmail.com>
Link: https://orgmode.org/list/87jzru8mjt.fsf@localhost
2023-10-11 12:02:18 +03:00
Ihor Radchenko 558db89e40
Backport 7cc208af9 fix from main 2023-10-10 18:42:11 +03:00
Ihor Radchenko c61ec6255d
org-agenda-get-scheduled: Fix call to `org-time-string-to-time'
* lisp/org-agenda.el (org-agenda-get-scheduled): Do not pass timestamp
object to `org-time-string-to-time'.  Convert it to string first.

Reported-by: Carlo Tambuatco <oraclmaster@gmail.com>
Link: https://orgmode.org/list/CAJb92EzRWO6v3MRVbU0XwQomx-A1eYvFaOaBsJemB85Y4nJ1eg@mail.gmail.com
2023-09-19 11:24:10 +03:00
Ihor Radchenko 6307a774a7
org-agenda-get-scheduled: Fix call to `org-time-string-to-time'
* lisp/org-agenda.el (org-agenda-get-scheduled): Do not pass timestamp
object to `org-time-string-to-time'.  Convert it to string first.

Reported-by: Carlo Tambuatco <oraclmaster@gmail.com>
Link: https://orgmode.org/list/CAJb92EzRWO6v3MRVbU0XwQomx-A1eYvFaOaBsJemB85Y4nJ1eg@mail.gmail.com
2023-09-19 11:22:00 +03:00
Ihor Radchenko 7cc208af91
org-agenda: Do not err on SCHEDULED/DEADLINE with inactive timestamp
* lisp/org-agenda.el (org-agenda-get-deadlines):
(org-agenda-get-scheduled): Ignore SCHEDULED/DEADLINE set to inactive
timestamps.  Previously, an error would be thrown.

Reported-by: Christian Barthel <bch@online.de>
Link: https://orgmode.org/list/875y5tlouo.fsf@localhost
2023-08-18 15:19:25 +03:00
Ihor Radchenko 3b49db8755
Revert "Prefer `string-search' when matching exact strings"
This reverts commit e9110a8dd7.

`string-search' is not available in Emacs<28 and also always
case-sensitive.
2023-08-18 11:00:13 +03:00
Ihor Radchenko f285ae37b3
org-agenda-get-todos: Fix for todo keywords that can be interpreted as regexp
* lisp/org-agenda.el (org-agenda-get-todos): Use `regexp-quote' to
match keywords.
(org-select-this-todo-keyword): Add docstring, clarifying the allowed
values.
* testing/lisp/test-org-agenda.el (test-org-agenda/todo-selector): Add
new test.

Reported-by: spookygostee@gmail.com
Link: https://orgmode.org/list/87jztuzzpl.fsf@gmail.com
2023-08-17 14:15:14 +03:00
Ihor Radchenko 7c6302e203
org-agenda-show-new-time: Fix when window is very narrow
* lisp/org-agenda.el (org-agenda-show-new-time): When window is
narrower than timestamp, do not try to display timestamps starting at
negative column.

Reported-by: Nick Römer <nick.romer@skynet.be>
Link: https://orgmode.org/list/4196e86e.19136.1891ceef131.Webtop.154@skynet.be
2023-07-05 16:12:19 +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 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 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 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
Ihor Radchenko fefaadc2d5
org-element: Optimize working with match data and Emacs regexps
* lisp/org-element.el: Add commentary explaining some regexp-related
optimizations useful for the parser.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225
(org-element--headline-deferred):
(org-element-item-parser):
(org-element-item-interpreter):
(org-element--list-struct):
(org-element-plain-list-parser):
(org-element-example-block-parser):
(org-element-fixed-width-interpreter):
(org-element-paragraph-parser):
(org-element-src-block-parser):
(org-element-table-parser):
(org-element--parse-generic-emphasis):
(org-element-export-snippet-interpreter):
(org-element-link-parser):
(org-element--current-element):
(org-element--collect-affiliated-keywords):
(org-element-parse-buffer):
(org-element-normalize-string):
(org-element-normalize-contents):
(org-element--parse-to):
(org-element--cache-before-change):
(org-element--cache-for-removal):
(org-element-context): Avoid storing match data unless strictly
necessary.  Explain the necessity in places where we have to use
`save-match-data'.  Prefer `looking-at-p' (does not alter match data)
to `looking-at'.  Simplify regexps.  Update docstrings clearly
indicating when match data might be modified.
* lisp/org.el:
(org-offer-links-in-entry):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-agenda.el: Fix places where we need to protect match data.
2023-07-01 14:35:53 +03:00