alphapapa / org-ql

A searching tool for Org-mode, including custom query languages, commands, saved searches and agenda-like views, etc.
GNU General Public License v3.0
1.35k stars 104 forks source link

Support for timestamps with internal time ranges (events) #371

Closed hpfr closed 6 days ago

hpfr commented 9 months ago

Org QL does not currently match timestamps with internal time ranges, commonly used for events. These are different from time/date ranges where two timestamps are connected by --.

The example from the manual:

* Discussion on climate change
  <2006-11-02 Thu 20:00-22:00>

Interestingly, the latest Org Syntax document just defines times as:

TIME (optional) An instance of the pattern H:MMREST where H represents a one to two digit number (and can start with 0), and M represents a single digit. REST can contain anything but \n or closing bracket.

I was wondering if the Org QL behavior was by design or simply because you don’t personally use these. I think this could be fixed by changing the timestamp regexp, but the predicate code is pretty complex, so I don’t know the full implications of that.

Somewhat related to https://github.com/alphapapa/org-ql/issues/159


Matching these timestamps would be another step towards fully replacing the Org agenda with Org QL (and its caching!). There is currently no mechanism for generating an Org agenda-like time grid, but I think it makes sense for Org QL to limit its scope to simply returning (and in the case of org-ql-view, displaying) lists of headings. Matching timestamps with internal time ranges would mean a package like calfw could leverage a calfw-org-ql backend rather than the org-agenda-based calfw-org.

alphapapa commented 9 months ago

This is a nicely written bug report, but please see #237, which it duplicates.

hpfr commented 9 months ago

I must have only searched issues. Well, now there is an issue that PR can close :sweat_smile:

alphapapa commented 9 months ago

Yeah, probably good to have this as an issue, and since you wrote it up so well, might as well use this one. :)

alphapapa commented 6 days ago

v0.8.7 will allow such ranges to be matched simply, but matching depending on the specific inner time ranges will not work yet. That will require some refactoring, and so it will be done in a future version (maybe v0.9, maybe not).