Commit graph

467 commits

Author SHA1 Message Date
Adam Porter
90aa62a5af Change/Fix: (org-ql--add-agenda-markers) Rename and use copy-marker
org-agenda-new-marker sometimes raises "selecting deleted buffer"
errors, and other times returns markers that don't point into a
buffer (I don't even know how that's possible).  copy-marker always
works, so we'll use it, even though it might leave markers hanging
around which theoretically could affect performance over time (but
isn't Emacs still supposed to GC them?  I'm not sure).

Also, rename it to org-ql--add-markers, since we're not adding
"agenda" markers anymore.
2018-08-22 14:15:28 -05:00
Adam Porter
a9a4ac33d8 Change: Remove org-ql-agenda--add-markers
We use org-ql--add-agenda-markers now.
2018-08-22 14:14:11 -05:00
Adam Porter
a2d8ed2eeb Add: Caching
Seems to work well so far.  Hopefully no bugs will be found (ha,
ha)...

Fixes #6.  Thanks to @yantar92 for suggesting!
<https://www.reddit.com/r/emacs/comments/990swh/querying_org_files_for_due_items_and_showing/e4kduul/>
2018-08-22 14:03:48 -05:00
Adam Porter
cdbe750b7c Fix: Don't treat an element's :begin property as a marker
Only markers are markers.  Also add FIXME about tag inheritance when
no marker is used (although see caveat in it...).
2018-08-22 13:32:44 -05:00
Adam Porter
b4ba9e78fd Fix: (--add-scheduled-face) Remove broken prefix code
Also unnecessary since we use --format-relative-date.  If we ever want
to exactly emulate the Agenda, this can be replaced.

See https://github.com/alphapapa/org-ql/issues/5#issuecomment-414717478.
2018-08-22 01:37:08 -05:00
Adam Porter
d3cb2bfeed Fix: (org-ql-agenda--add-scheduled-face) todo-keyword error
Mentioned in #5.  Thanks again to @natrys.
2018-08-21 09:10:26 -05:00
Adam Porter
8716c9a087 Fix: (org-ql-agenda) Argument handling
Fixes #5.  Thanks to @natrys for reporting.
2018-08-21 09:05:52 -05:00
Adam Porter
f9167ccb7a Notes: Add note 2018-08-21 02:39:51 -05:00
Adam Porter
2d0a79a9f3 Docs: Mention org-sidebar 2018-08-21 02:37:32 -05:00
Adam Porter
e905105f7e Add example script 2018-08-21 02:37:32 -05:00
Adam Porter
75886a57a6 Change: org-agenda-ng -> org-ql-agenda 2018-08-21 02:37:30 -05:00
Adam Porter
2ddc69b64d Refactor agenda-ng buffer and use org-agenda-mode
Using org-agenda-mode isn't exactly *correct*, but since we use some
compatible text properties, it does give us some functionality for
free, even if it isn't 100% compatible.

Note that this should be considered experimental.  It's not
unimaginable that using some agenda buffer commands in the agenda-ng
buffer could have unexpected consequences, including data corruption.
However, basic ones like jumping to entries and org-agenda-priority
seem to work.
2018-08-21 00:09:02 -05:00
Adam Porter
ad4aad16f1 Change: Rename fmap macro to flet 2018-08-20 08:17:10 -05:00
Adam Porter
32f2b3304a Change: Use macrolet instead of flet for priority sorter 2018-08-20 07:49:49 -05:00
Adam Porter
c9245be371 Tidy 2018-08-20 07:48:10 -05:00
Adam Porter
cdd25e8a7f Add: Support org-super-agenda
Since we aren't calling org-agenda-finalize-entries anymore, we call
org-super-agenda--group-items directly when appropriate.
2018-08-20 07:41:46 -05:00
Adam Porter
f6db1097dc Change: Refactor and tidy
Move add-markers function into org-ql, which should help avoid
cross-dependency, and should be generally useful.
2018-08-20 07:38:07 -05:00
Adam Porter
4822f1406f Change: Consolidate action 2018-08-20 07:09:48 -05:00
Adam Porter
88cf7f395e Change: Minor refactoring 2018-08-20 06:42:19 -05:00
Adam Porter
14351e617d Change: Handle sort argument in org-ql--query
Rather than in the macro.  Trying to consolidate.
2018-08-20 06:18:23 -05:00
Adam Porter
9cce826bfe Fix: Sorting
By using s-join instead of org-agenda-finalize-entries, which does its
own sorting.  We don't need anything it does, at least not now, and if
we ever do, we'll probably want to reimplement it, anyway.

HOWEVER, this breaks org-super-agenda, which uses advice to that
function to group items.  So we need to either figure out another
approach (which I have been unable to do so far, trying cl-letf,
cl-flet, and advice-add with unwind-protect), or make this depend on
org-super-agenda.
2018-08-19 14:49:37 -05:00
Adam Porter
2001c88ed5 Fix: (org-agenda-ng) Handle just query as arguments 2018-08-19 13:39:19 -05:00
Adam Porter
d73175714c Fix: (org-ql) Work when not sorting
Don't know when I broke this.  Oops.
2018-08-19 13:21:00 -05:00
Adam Porter
22bf0ae9c0 Fix: (org-agenda-ng) Add markers
Not sure when I broke this, but this fixes it.  Still probably need to
refactor a bit, as there's some cross-dependency between org-agenda-ng
and org-ql.
2018-08-19 12:10:12 -05:00
Adam Porter
95d51ef998 Comment: Remove comment
Benchmarking shows that, when org-ql is byte-compiled, calling
org-outline-level is actually slightly faster than org-current-level.
2018-08-04 23:14:44 -05:00
Adam Porter
465767e7cc Add: Outline level predicate
Fixes #3.  Thanks to @akirak.
2018-08-04 23:09:21 -05:00
Adam Porter
69083fb17b Task: Add to-do 2018-08-04 16:57:14 -05:00
Adam Porter
334b68de3d Change: (org-ql) Handle arbitrary expressions for sort arg
See https://github.com/alphapapa/org-agenda-ng/pull/1
2018-08-04 15:48:18 -05:00
Adam Porter
cc05faa977 Docs: Add missing sort type to docstring 2018-08-04 15:47:41 -05:00
Adam Porter
08243d5479 Add: (org-ql) Markers argument 2018-08-04 01:52:23 -05:00
Adam Porter
fe3d5c2bd8 Fix: (org-ql) Set "today" to org-ql--today in symbol-macrolet
Since we byte-compile the lambda, this is necessary (at least, I think
this is why).  Remember that we set org-ql--today when we actually run
queries.
2018-08-01 10:53:15 -05:00
Adam Porter
4c045f78ea Tidy: Indentation 2018-08-01 10:52:59 -05:00
Adam Porter
fe32388d50 Change/Fix: (--format-element) Use marker's buffer
When formatting an element outside the element's buffer (e.g. when
mapping --format-element across the results of org-ql), the current buffer
is not the element's source buffer, so functions like org-get-tags-at
will not return the correct results, because they don't use the
marker's buffer.  So now we set the current buffer to the marker's
buffer.

As this package matures, this might become unnecessary in the future,
but it's probably best to keep it for correctness.
2018-08-01 10:50:27 -05:00
Adam Porter
056c93bcd6 Docs: Add examples and update readme 2018-07-10 08:38:17 -05:00
Adam Porter
ed55f7f15f Notes: Add notes 2018-07-10 08:36:24 -05:00
Adam Porter
3ec6ded312 Notes: Add note 2018-07-10 08:29:09 -05:00
Adam Porter
8bfb65d715 Change: Refactor, improve docstrings, argument handling, etc.
Move some code between functions and macros to make more sense and be
more flexible.
2018-07-10 08:27:54 -05:00
Adam Porter
c605ccbaf3 Change: (org-ql--org-timestamp-element<) Use macrolet
Should be a small performance improvement, avoiding funcall overhead.
2018-07-10 08:26:55 -05:00
Adam Porter
51a472ffa8 Add: --sanity-check-form function
Currently unused, but may try to use it in the future to avoid
confusing problems.
2018-06-08 18:06:31 -05:00
Adam Porter
27fb5f0852 Comment: Add MAYBE 2018-06-08 18:06:24 -05:00
Adam Porter
86d2e38802 Add: (org-ql--fmap) Add debug declaration 2018-06-08 18:05:52 -05:00
Adam Porter
a134e34fd8 Change: Improve TODO grouping 2018-06-08 18:05:17 -05:00
Adam Porter
73925c8f1c Change: Use org-done-keywords instead of org-done-keywords-for-agenda
This should fix a bug, and it seems like the more correct thing to do.
2018-06-08 18:04:01 -05:00
Adam Porter
977e9aa0a2 Change: Enable lexical-binding
Hopefully this doesn't break anything...
2018-06-08 18:03:49 -05:00
Adam Porter
1143414f67 Change: (--date<) Use macrolet instead of flet 2018-05-24 10:04:34 -05:00
Adam Porter
f19f2a4cb4 Fix: Tag inheritance
Hardcoded on for now.
2018-05-24 10:00:20 -05:00
Adam Porter
005ad636b2 Change: Rename org-agenda-ng--date-p -> org-ql--date-p 2018-05-24 09:59:00 -05:00
Adam Porter
afad077b04 Change: Improve error message 2018-05-24 09:58:23 -05:00
Adam Porter
52a1deffa2 Change: Error if file can't be opened 2018-05-24 09:50:46 -05:00
Adam Porter
fd00eb6bb5 Change: second -> cadr 2018-05-24 09:50:07 -05:00