Skip to content

org-ql-search: sort headers according to timestamp globally #416

Answered by alphapapa
timmli asked this question in Q&A
Discussion options

You must be logged in to vote

Still it would be interesting to see how this could be achieved with org-ql.

You would need to provide a sort function that collects timestamps in an entry and chooses one (e.g. the earliest or latest) to compare with the one chosen from the other entry. You can see some similar code here:

org-ql/org-ql.el

Lines 2325 to 2388 in e41fe90

(org-ql-defpred (ts ts-active ts-a ts-inactive ts-i)
(&key from to _on regexp _with-time
(match-group 0) (limit (org-entry-end-position)))
"Return non-nil if current entry has a timestamp in given period.
Without arguments, return non-nil if entry has a timestamp.
TYPE may be `active' to match active timestamps, `…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@timmli
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by timmli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants