-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example for using a custom predicate #117
base: master
Are you sure you want to change the base?
Conversation
Thanks for your patience. I'll take a look at this when I work on this package again. |
e441d88
to
4194456
Compare
f52bef0
to
ec0f8c7
Compare
Hi Kevin, Thanks for your patience on this. The specific example you gave, searching for a property value with inheritance, is one that I think needs to be covered by built-in predicates, if it isn't already. So rather than add an example which would direct users to use a custom expression for something which is, or will be, built-in, I'd rather enhance the It would be good to add an example of using an arbitrary expression, though. Could we find a different one that would seem realistic to use? What do you think? |
46c3ad8
to
b01106b
Compare
Well, I made a new way to make "custom predicates". See https://github.com/alphapapa/org-ql/blob/master/examples/defpred.org :) It would still be good to have an example like yours in the documentation though, to show how arbitrary expressions can be used as the ACTION form when searching. |
I'm starting to think you're just determined to not merge any of my PR's 😝
I agree a non built-in example would be best, however I think the difficulty is finding one that is "realistic to use" that also shouldn't be "be covered by built-in predicates". Maybe a property regexp check?
This looks awesome, excited to use it!
Would it make sense to refer to the section in my PR as "arbitrary expressions" then as opposed to "custom predicates"? |
D:
Yeah, that would probably be good for a demo.
Yes, I think that'd be great. Thanks. |
Revisiting this, I think the idea to show the use of custom or arbitrary predicate expressions in the docs is a good one, and I still think that whatever example we use should be one that's obviously not covered, or shouldn't be covered, by built-in predicates. Please let me know if you have any more thoughts on it. In the interest of pushing out a stable release sooner, I'm deferring this to 0.7 (though being a simple documentation change, it can be done anytime). |
Revisiting this, I think the idea to show the use of custom or arbitrary predicate expressions in the docs is a good one, and I still think that whatever example we use should be one that's obviously not covered, or shouldn't be covered, by built-in predicates. Please let me know if you have any more thoughts on it.
I have a use-case that might be used as an example here:
'(and (scheduled :to 0) (if (property "SHOWFROMDATE") (ts< (ts-parse-org (org-entry-get (point) "SHOWFROMDATE")) (ts-now)) t))
This predicate expression searches headings scheduled up to today.
However, if a heading has `SHOWFROMDATE` property, it only matches when
timestamp stored in the property is in the past.
|
4f5fbc4
to
d0acc8c
Compare
059b10c
to
77b4c2b
Compare
I had some trouble when first using a custom predicate and so wanted to suggest/offer a section with an example on how they can be used.