emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-skip-function does not find inherited tags
@ 2017-09-04 15:06 Adrian Bradd
  2017-09-06 16:27 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bradd @ 2017-09-04 15:06 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

Hello,

I have the following custom agenda command:

(setq org-agenda-custom-commands
      '(("ww" "Work 2 day view"
         ((agenda ""
           ((org-agenda-files '("~/tmp/tmp.org"))
            (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp
":@work:"))
            (org-agenda-start-on-weekday nil)
            (org-agenda-span 2)
            (org-agenda-overriding-header "\n2 day work
view\n-----------------\n")))))))

Given the sample file below:

* Top heading with tags
:@work:admin:
** Next heading (inherited tags)
   SCHEDULED: <2017-09-04 Mon>
** Next heading (explicit tags)
:@work:admin:
   SCHEDULED: <2017-09-04 Mon>

The agenda will only display headings that have the tag explicitly defined.
In this case, "Next heading (explicit tags)".

Is there a way I can convince the agenda to honour inherited tags in this
case?

Cheers,

Adrian

[-- Attachment #2: Type: text/html, Size: 1539 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-agenda-skip-function does not find inherited tags
  2017-09-04 15:06 org-agenda-skip-function does not find inherited tags Adrian Bradd
@ 2017-09-06 16:27 ` Nicolas Goaziou
  2017-09-09  5:36   ` Adam Porter
  2017-09-11 19:35   ` Kaushal Modi
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-09-06 16:27 UTC (permalink / raw)
  To: Adrian Bradd; +Cc: emacs-orgmode

Hello,

Adrian Bradd <adrian.bradd@gmail.com> writes:

> I have the following custom agenda command:
>
> (setq org-agenda-custom-commands
>       '(("ww" "Work 2 day view"
>          ((agenda ""
>            ((org-agenda-files '("~/tmp/tmp.org"))
>             (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp
> ":@work:"))
>             (org-agenda-start-on-weekday nil)
>             (org-agenda-span 2)
>             (org-agenda-overriding-header "\n2 day work
> view\n-----------------\n")))))))
>
> Given the sample file below:
>
> * Top heading with tags
> :@work:admin:
> ** Next heading (inherited tags)
>    SCHEDULED: <2017-09-04 Mon>
> ** Next heading (explicit tags)
> :@work:admin:
>    SCHEDULED: <2017-09-04 Mon>
>
> The agenda will only display headings that have the tag explicitly defined.
> In this case, "Next heading (explicit tags)".
>
> Is there a way I can convince the agenda to honour inherited tags in this
> case?

You write a more appropriate function and use it as
`org-agenda-skip-function'. It could re-use the following snippet:

  (not (member "@work" (org-split-string (org-entry-get (point) "ALLTAGS"))))


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-agenda-skip-function does not find inherited tags
  2017-09-06 16:27 ` Nicolas Goaziou
@ 2017-09-09  5:36   ` Adam Porter
  2017-09-11  0:10     ` Adrian Bradd
  2017-09-11 19:35   ` Kaushal Modi
  1 sibling, 1 reply; 5+ messages in thread
From: Adam Porter @ 2017-09-09  5:36 UTC (permalink / raw)
  To: emacs-orgmode

I think the function org-get-tags-at should also be helpful here.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-agenda-skip-function does not find inherited tags
  2017-09-09  5:36   ` Adam Porter
@ 2017-09-11  0:10     ` Adrian Bradd
  0 siblings, 0 replies; 5+ messages in thread
From: Adrian Bradd @ 2017-09-11  0:10 UTC (permalink / raw)
  To: Adam Porter, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

Thanks for the pointers. This is what I came up with:

(defun abradd-agenda-tags-inherited (tags)
  (let (beg end m)
    (org-back-to-heading t)
    (setq beg (point)
          end (progn (outline-next-heading) (1- (point))))
    (goto-char beg)
    (and
      (not (member tags (org-get-tags-at)))
      end)))

I copied mostly from org-agenda-skip-if. It isn't very versatile, but works
for now.

On 9 September 2017 at 01:36, Adam Porter <adam@alphapapa.net> wrote:

> I think the function org-get-tags-at should also be helpful here.
>
>
>

[-- Attachment #2: Type: text/html, Size: 1356 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-agenda-skip-function does not find inherited tags
  2017-09-06 16:27 ` Nicolas Goaziou
  2017-09-09  5:36   ` Adam Porter
@ 2017-09-11 19:35   ` Kaushal Modi
  1 sibling, 0 replies; 5+ messages in thread
From: Kaushal Modi @ 2017-09-11 19:35 UTC (permalink / raw)
  To: Nicolas Goaziou, Adrian Bradd; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

On Wed, Sep 6, 2017 at 12:33 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> You write a more appropriate function and use it as
> `org-agenda-skip-function'. It could re-use the following snippet:
>
>   (not (member "@work" (org-split-string (org-entry-get (point)
> "ALLTAGS"))))
>

TIL about ALLTAGS and other Special Properties.

That org-split-string though needs the separator argument though, right?

(org-split-string (org-entry-get (point) "ALLTAGS") ":")
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 964 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-11 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 15:06 org-agenda-skip-function does not find inherited tags Adrian Bradd
2017-09-06 16:27 ` Nicolas Goaziou
2017-09-09  5:36   ` Adam Porter
2017-09-11  0:10     ` Adrian Bradd
2017-09-11 19:35   ` Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).