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

Allow (:priority nil) to match entries without explicit priorities #220

Open
max6166 opened this issue Mar 5, 2022 · 2 comments
Open

Allow (:priority nil) to match entries without explicit priorities #220

max6166 opened this issue Mar 5, 2022 · 2 comments

Comments

@max6166
Copy link

max6166 commented Mar 5, 2022

I would like to group items without an assigned priority, but :priority nil doesn't seem to work select those items.

Would you please confirm whether :priority nil is a valid selector option?

I haven't tried yet, but I think the nil grouping can still be achieved using something like: :not (:priority>= "F") (#F is my lowest priority).

I'm just asking in case it is an error on my part.

Thanks!

@alphapapa
Copy link
Owner

AFAIU, internally in Org, every entry has a priority, because the default priority is equivalent to priority B. (I don't like that, myself, so some of my code in org-super-agenda and org-ql treats entries without explicit priorities as not having one.)

Anyway, you can see the implementation here:

;;;;; Priority
Specifically, nil doesn't work as the argument because a string is expected here:
:let* ((priority-number (string-to-char (car args))))
But it would be easy enough to add support for using nil to match entries without explicit priorities.

I probably won't work on this soon, so patches welcome. :) Thanks.

@alphapapa alphapapa changed the title Is ":priority nil" a valid selector option? Allow (:priority nil) to match entries without explicit priorities Mar 26, 2022
@natejlong
Copy link
Contributor

I ran into this recently, here's a quick solution with :pred:

(:name "Tasks Lacking Priority"
 :and (:todo "TODO"
       :not (:pred (lambda (s)
                     (string-match org-priority-regexp s)))))

I tried using regexp directly with (:regexp org-priority-regexp) but kept running into errors of the type Wrong type argument: sequencep, ... despite trying a few different ways to pass the variable in. I'm sure it's possible somehow but the :pred option got the job done and I moved on.

@alphapapa alphapapa added this to the 1.3 milestone Sep 9, 2022
@alphapapa alphapapa modified the milestones: 1.3, 1.4 Sep 23, 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