alphapapa / org-super-agenda

Supercharge your Org daily/weekly agenda by grouping items
GNU General Public License v3.0
1.33k stars 107 forks source link

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

Open max6166 opened 2 years ago

max6166 commented 2 years ago

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 commented 2 years ago

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: https://github.com/alphapapa/org-super-agenda/blob/3108bc3f725818f0e868520d2c243abe9acbef4e/org-super-agenda.el#L777 Specifically, nil doesn't work as the argument because a string is expected here: https://github.com/alphapapa/org-super-agenda/blob/3108bc3f725818f0e868520d2c243abe9acbef4e/org-super-agenda.el#L794 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.

natejlong commented 1 year ago

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.