Skip to content
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

Priorities other than A,B,C #312

Open
ComedyTomedy opened this issue Nov 23, 2022 · 5 comments
Open

Priorities other than A,B,C #312

ComedyTomedy opened this issue Nov 23, 2022 · 5 comments
Assignees
Milestone

Comments

@ComedyTomedy
Copy link

I use priorities below C constantly and for everything, and have just spent way too long being confused about whether I'm using org-ql wrongly, before finally finding a temporary workaround. It'd be really nice to update, or if nothing else change the docs to state that it ignores most values.

Quote from the source:

(;; NOTE: This only accepts A, B, or C.  I haven't seen
 ;; other priorities in the wild, so this will do for now.
@ComedyTomedy
Copy link
Author

Fixed - #313

@hpfr
Copy link

hpfr commented Oct 14, 2023

To expand on #313 (comment) a bit, ideally a general solution to this issue would use org-get-priority, which takes a string (typically a heading, I think) and returns an integer, and the sorting would use the resulting integers. org-get-priority will use org-priority-get-priority-function if the user has customized it, so it is guaranteed to work with whatever wacky priority systems are out there in Emacs configs :)

@alphapapa
Copy link
Owner

alphapapa commented Oct 14, 2023

To expand on #313 (comment) a bit, ideally a general solution to this issue would use org-get-priority, which takes a string (typically a heading, I think) and returns an integer, and the sorting would use the resulting integers. org-get-priority will use org-priority-get-priority-function if the user has customized it, so it is guaranteed to work with whatever wacky priority systems are out there in Emacs configs :)

That would work for the predicate body, but it might preclude regexp-based optimizations. It would need to be studied carefully to avoid performance regressions.

That parent-priority function in that SE answer wouldn't be necessary in org-ql, because we have the ancestor/parent selectors, so, e.g. (parent (priority)).

@hpfr
Copy link

hpfr commented Oct 14, 2023

That would work for the predicate body, but it might preclude regexp-based optimizations. It would need to be studied carefully to avoid performance regressions.

Makes sense!

That parent-priority function in that SE answer wouldn't be necessary in org-ql, because we have the ancestor/parent selectors, so, e.g. (parent (priority)).

To be clear, I only included that link as one example of a custom priority function, which can be arbitrary. So even if Org QL has optimizations that improve upon that particular function, ultimately it can’t account for arbitrary priority functions without simply calling the function, I think?

@alphapapa
Copy link
Owner

To be clear, I only included that link as one example of a custom priority function, which can be arbitrary. So even if Org QL has optimizations that improve upon that particular function, ultimately it can’t account for arbitrary priority functions without simply calling the function, I think?

That's right. In the case of custom priority functions, hopefully the regexp-based optimizations can be used to find potential matches and then call the function to get the computed value, like several other predicates do anyway.

@alphapapa alphapapa self-assigned this Oct 14, 2023
@alphapapa alphapapa added this to the Future milestone Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants