Michael Soulier <msoul...@digitaltorque.ca> writes:

> On 2025-03-12 9:16 a.m., Michael P. Soulier wrote:
>> I just can't seem to get this working.
>> During the work hours I want to include in my agenda only TODO items
>> that have
>> the @work, @calls or @errands tags. I tried one tag initially and I can't get
>> that working. Looking at the docs, regexp seems to be the only option.
>> CONDITIONS is a list of symbols, boolean OR is used to combine the
>> results
>> from different tests.  Valid conditions are:
>> scheduled     Check if there is a scheduled cookie
>> notscheduled  Check if there is no scheduled cookie
>> deadline      Check if there is a deadline
>> notdeadline   Check if there is no deadline
>> timestamp     Check if there is a timestamp (also deadline or scheduled)
>> nottimestamp  Check if there is no timestamp (also deadline or scheduled)
>> regexp        Check if regexp matches
>> notregexp     Check if regexp does not match.
>> todo          Check if TODO keyword matches
>> nottodo       Check if TODO keyword does not match
>> For some reason there is no tag/notag options here. So I tried
>> regexp.
>> ("w" "Work day report"
>> ((agenda ""
>>          ((org-agenda-overriding-header "Today's schedule")
>>              (org-agenda-skip-function
>>                  '(org-agenda-skip-entry-if 'tags '(("@work"))))
>>              (org-agenda-span 'day)))
>> But it's not working. They're still there in the agenda view.
>> What am I doing wrong?
>
> I did eventually get this working.
>
> like so
>
>               ("w" "Work day report"
>                ((agenda ""
>                         ((org-agenda-overriding-header "Today's Work
>                         schedule")
>                          (org-agenda-skip-function
>                           (lambda ()
>                             (let* ((tags (org-get-tags))
>                                    (skip-tags '("@fun" "@personal"
>                                    "@home")))
>                               (when (cl-intersection tags skip-tags
>                               :test #'equal)
>                                 (org-end-of-subtree t)))))
>
> I think this could be greatly simplified by supporting filtering the
> agenda view on tags.

It has been -- search the Org Manual for "Matching tags and properties".
In your case, try something like:

("w" "Workday report" tags "@work|@calls|@errands"
 ...
 )

You can also set your context tags to be mutually exclusive (ie. only
one applies to a task) so that you don't have to skip over tags. Look at
org-tag-alist for setting that up.

-- 
David Masterson

Reply via email to