Commit graph

268 commits

Author SHA1 Message Date
Adam Porter
527c6f5123 Docs: (deadline-warning) Fix docstring 2019-10-02 15:48:00 -05:00
Adam Porter
c286ab1967 Add: (org-ql-select) Accept a function for buffers-files 2019-10-02 11:58:28 -05:00
Adam Porter
ead91f7894 Fix: ts dependency
0.2-pre is the current version, not 0.2.
2019-09-26 21:35:25 -05:00
Adam Porter
5864c28cdb Refactor/Add: agenda->view/search, view-sidebar
Squash-merging branch wip/refactor-org-ql-agenda.

Squashed commit of the following:

commit 60d73b071830ab8f0355687a1d325a4791eeb29b
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Sep 18 04:30:55 2019 -0500

    WIP: Tidy

commit 36f65638cdb585553c0f90ef48b3908700461014
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Sep 18 04:24:45 2019 -0500

    WIP: Tidy

commit f7bae3ac8c250c4e42b79157656603da91185574
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Sep 18 04:10:36 2019 -0500

    WIP: Tidy

commit 8791b0de3404cfff9e110969b8aa30c753319335
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Sep 18 04:05:18 2019 -0500

    WIP: Remove unnecessary defvars

commit 0dd8d259a31e279ad76188640f6731f8fdf0ae88
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Sep 18 04:03:27 2019 -0500

    WIP: (org-ql-search.el) Require org-super-agenda

commit 76981fbcd3eba7d1b8d096c094a013953c2d3333
Author: Adam Porter <adam@alphapapa.net>
Date:   Mon Sep 16 19:49:07 2019 -0500

    WIP: More refactoring

commit a3e58f4d44aa804bfd9ff537aca53647dd068329
Author: Adam Porter <adam@alphapapa.net>
Date:   Mon Sep 16 19:21:20 2019 -0500

    WIP: View list sidebar

commit 56f27cd87f0ef246d31328e4c7a41ad2a1c57553
Author: Adam Porter <adam@alphapapa.net>
Date:   Sat Aug 31 22:25:09 2019 -0500

    WIP: Split org-ql-agenda into org-ql-view and org-ql-search
2019-09-26 21:34:51 -05:00
Adam Porter
8f2a02264f Add/Fix: Set case-fold for preambles
And use for (todo) preambles.
2019-09-18 01:33:15 -05:00
Adam Porter
f55fe7ef79 Fix: (heading) Only match against heading text
It should not match against e.g. tags strings or to-do keywords.  Note
that the (regexp) predicate still matches against those, because it
searches entire entries, from heading stars to the next entry.
2019-09-11 22:02:14 -05:00
Adam Porter
5574f33682 Change: (regexp) Match all regexps
This seems more useful, because it makes it easier to narrow down
results, which is the most common way to search.
2019-09-11 21:59:39 -05:00
Adam Porter
d336554e9c Fix: (org-ql-select) Remove extra quote
Oops.
2019-09-09 20:48:31 -05:00
Adam Porter
6a93e887cc Comment: Remove done TODOs
I wish I could remember to remove these when I commit the code that
does them!
2019-09-09 20:48:28 -05:00
Adam Porter
1ff21dc0c8 Fix: (org-ql--get-tags) For Org 9.2
org-get-tags takes no arguments.
2019-09-09 14:58:21 -05:00
Adam Porter
21d0fadecf Fix: Require org-element
I don't know if this is actually required, but it should silence a
compiler warning.
2019-09-09 14:57:48 -05:00
Adam Porter
ea2ed02c84 Add: (path) predicate 2019-09-09 14:08:48 -05:00
Adam Porter
29c3cdd360 Add: (heading) Preambles 2019-09-09 13:41:31 -05:00
Adam Porter
2f9a7ab6b7 Change: (heading) Match all regexps
This makes more sense and should be more useful.
2019-09-09 13:40:56 -05:00
Adam Porter
f6bd02b355 Comment: Tidy preamble function 2019-09-09 13:38:58 -05:00
Adam Porter
deb78e51c7 Merge: 0.2.1 2019-09-09 09:07:44 -05:00
Adam Porter
55694f17fc Fix: (descendants) matched against parent heading
It matched against parent headings instead of only descendants, which
caused some queries to return incorrect results.

Released as 0.2.1.
2019-09-09 09:05:13 -05:00
Adam Porter
8a624bdf0d Change: (heading) Accept multiple regexps 2019-09-06 12:04:12 -05:00
Adam Porter
8a812323fc Fix: (--tags-at) Respect tag inheritance options
Respect org-use-tag-inheritance and org-tags-exclude-from-inheritance.

Fixes #43.  Thanks to Josiah Schwab (@jschwab) for reporting.
2019-09-06 11:55:59 -05:00
Adam Porter
f55aae782c Add: tags-all, tags& 2019-09-05 15:51:40 -05:00
Adam Porter
ca9ab3e6a5 Add: Tag cache, inherited/local tags predicates 2019-09-05 15:51:40 -05:00
Adam Porter
0b20be451f Meta: 0.3-pre 2019-09-04 05:29:52 -05:00
Adam Porter
0adc23d34d Release: 0.2 2019-08-31 23:49:26 -05:00
Akira Komamura
3a5e4a1e11 Fix: Add autoloads
Fixes #36.  Thanks to Akira Komamura (@akirak).
2019-08-31 23:43:49 -05:00
Adam Porter
ad9de23987 Comment: Update some to-dos 2019-08-31 23:28:12 -05:00
Adam Porter
8d57a69125 Change/Fix: (--select-cached) Query-cache key and narrowing
1.  It seems that caching was broken in
3adaf4e5fc, because I changed what key
was used to retrieve from the cache but not the key that was used to
store in the cache.  I guess I hadn't noticed the performance
difference.  It should be fixed now.

2.  While making this fix, the test suite caught a bug in the new,
almost-fixed version that was caused by not including the preamble in
the key, and it only did so because the tests ran sequentially in the
same Emacs, making use of caching.  If each test were independent and
ran with a clean cache, it wouldn't have caught the bug, and it would
undoubtedly have been quite a head-scratcher, or even a hair-puller,
at some future time.

3.  And I would have pushed a version including that bug if I didn't
have a git pre-push hook that runs the tests, because somehow I missed
running the tests on that particular change.

So, lessons reinforced: tests are good; automated tests are better;
enforced tests are best.

4.  Narrowed queries are now cached using point-min/max in the buffer.
This will be especially helpful for the WIP recursive queries feature.
I do wonder if the overhead of caching might be a drawback in some
cases, however some simple benchmarks of recursive queries that return
about 2,000 results shows a large improvement from caching, reducing
runtime from 3.12 to 0.24 seconds, so it's probably worth it, overall.
2019-08-31 23:24:36 -05:00
Adam Porter
802bc462d6 Change: (children, descendants) Return after finding one match
A simple optimization that can be significant in large subtrees.
2019-08-30 09:32:03 -05:00
Adam Porter
e839397579 Fix: Planning-related predicates searched too far into entries
Planning-line-related predicates searched entire entries, which could
find lines that looked like planning lines but were not.  For example, in an
entry talking about tiny.el, in a source code block, in Elisp comments
that had text resembling an Org planning line, that text would be
found by the regexp search, and the predicate would then attempt to
parse the match, which could fail.

Now the regexp search for planning-line-related predicates is bound by
the end of the line after the heading, which is the only place that
actual Org planning lines are supposed to be.
2019-08-30 05:29:05 -05:00
Adam Porter
a99759d4d9 Add: (priority) Preambles and plain predicate style 2019-08-25 23:24:53 -05:00
Adam Porter
a52d421fd7 Add: random sorter 2019-08-25 20:14:31 -05:00
Adam Porter
f26052eb79 Fix: (org-ql-select) Properly accept arbitrary sort function
Fixes #37.  Thanks to Milan Zamazal (@mz-pdm).
2019-08-25 20:08:51 -05:00
Adam Porter
0585c368bd Fix: (regexp) Properly join multiple regexps
Fixes #39.  Thanks to Milan Zamazal (@mz-pdm).
2019-08-25 19:51:26 -05:00
Adam Porter
027bb89373 Fix: (deadline-warning) Handle plain timestamp elements
Sometimes org-element-context returns an element like:

    (planning (:closed (timestamp (:type inactive ...))
               :deadline (timestamp (:type active ...))
               :scheduled (timestamp (:type active ...))
              :begin 93706 ...))

Other times it returns just:

    (timestamp (:type active ...))

Even with point in the same position, immediately after the deadline
timestamp.  I don't know why, and it might even be a bug that's been
fixed in newer version of Org.

Anyway, this handles both.
2019-08-19 13:31:13 -05:00
Adam Porter
ed32701772 Change/Fix: Restore today arguments to ts-related predicates
Also, DRY some code into a macro.  Much cleaner.
2019-08-19 03:30:38 -05:00
Adam Porter
f8f18716ae Change: Move some timestamp-predicate arg processing
Those pcase clauses looked nice and clean, but putting the logic in
the macrolet lets us use number arguments to the keywords, which is
useful.

Eventually I may want to unify this, or put it in the defpred macro.
2019-08-19 03:30:37 -05:00
Adam Porter
49d0fa8306 Add: Timestamp selectors :on a number
This ought to be pretty thorough now.
2019-08-19 03:30:37 -05:00
Adam Porter
ab3d1178b9 Add: Call some ts-type predicates with a number/auto 2019-08-19 03:30:37 -05:00
Adam Porter
99a18dff2a Comment: Add TODO 2019-08-18 21:08:35 -05:00
Adam Porter
6aeb3030c6 Add: Customization group 2019-08-16 12:15:09 -05:00
Adam Porter
317a460c1d Tidy: (org-ql--parse-time-string) Remove
Unused now.  It served well.
2019-08-13 21:29:05 -05:00
Adam Porter
eb38cf6b06 Comment: Clarify 2019-08-13 21:28:20 -05:00
Adam Porter
4a9379c83e Comment: Correct comments 2019-08-13 21:27:13 -05:00
Adam Porter
ae8b0c740c Change: (ts) Use ts-in 2019-08-13 21:11:58 -05:00
Adam Porter
94d499bcf3 Meta: Update description 2019-08-13 19:43:17 -05:00
Adam Porter
6b9b985c1e Change: Use ts for all timestamp-related selectors
This is much simpler, and it seems quite fast with the preambles.
2019-08-13 17:06:39 -05:00
Adam Porter
40b36ecad2 Comment: Add TODO 2019-08-13 17:02:38 -05:00
Adam Porter
1d69ab7b20 Fix: (org-ql-query) Indentation declaration 2019-08-13 16:26:56 -05:00
Adam Porter
9f8101779c Change: (ts) Accept ts structs 2019-08-13 16:08:10 -05:00
Adam Porter
559764aedd Comment: Remove task
Basically done.  Also, I think :from/:to/:on are ultimately better
than numeric comparators like <=, because it's easier to express a
range of dates.
2019-08-13 15:38:47 -05:00
Adam Porter
3856e61800 Fix: (org-ql-select) Don't search hidden/special buffers 2019-08-13 15:05:47 -05:00