alphapapa / org-super-agenda

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

Explicit OR? #219

Closed eugene-jetruby closed 2 years ago

eugene-jetruby commented 2 years ago

First of all, thank you for the great package. While improving my agendas I faced a problem probably caused by misunderstanding the internal logic of selectors. What I'm trying to achieve is pretty simple: I want a group with items with tag "daily" and scheduled for today or for past. What I've done:

           (:name "Routine" :and (:tag "daily" :scheduled (today past)))

alas, this selects only items scheduled for today. If I change it to :scheduled (past today), then it selects items scheduled for the past. So what I seem to need is an explicit OR to make something like

           (:name "Routine" :and (:tag "daily" :or (:scheduled past :scheduled today)))

At the moment it's not a valid group. Is it indeed missing from org-super-agenda or is there another approach that I should be using? Thank you.

alphapapa commented 2 years ago

Hi Eugene,

Thanks for the kind words. I'm glad it's useful to you.

I suppose this could be a shortcoming in the :scheduled selector. But have you tried this?

(:name "Routine" :and (:tag "daily" :scheduled past :scheduled today))

I'm guessing that would work, but I haven't tried it. Please let me know whether it does.

Thanks.

eugene-jetruby commented 2 years ago

No, it returns no entries. And that seems to be the correct behavior for :and, because a headline can not be scheduled for two days at the same time. That's exactly what I want to achieve: tag = 'daily' AND (scheduled = 'past' OR scheduled = 'today')

alphapapa commented 2 years ago

Of course, you're right. I haven't used my own pseudo-language here in a while. :)

How about this?

(:name "Routine" :and (:tag "daily" :scheduled past) :and (:tag "daily" :scheduled today))

I think that will do it, even though it's a bit awkward compared to having an :or selector.

eugene-jetruby commented 2 years ago

And it does work! Thank you for your help!

tuh8888 commented 2 years ago

Since today AND past = NOT future, maybe this would be simpler:

(:name "Routine" :and (:tag "daily" :not (:scheduled future)))
alphapapa commented 2 years ago

@tuh8888 An entry that is :not (:scheduled future) could also be unscheduled, so that selector would not be equivalent.

tuh8888 commented 2 years ago

That's good to know. What about this then?:

 (:name "Routine" :and (:tag "daily" :not (:scheduled future) :scheduled t))
alphapapa commented 2 years ago

Yes, I think that should work. I forgot that t is a valid argument to :scheduled. Good idea!

eugene-jetruby commented 2 years ago

Yes, it does work, and it reads simpler. Thank you @tuh8888

Btw, "past or today" sounds like a pretty common usecase for me. Doesn't it deserve its own selector? @alphapapa

alphapapa commented 2 years ago

Btw, "past or today" sounds like a pretty common usecase for me. Doesn't it deserve its own selector?

Generally I'd rather aim for composability than special combinations which would have to be documented, looked up, remembered, etc.