emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Accessing CATEGORY for custom agenda command
@ 2011-02-11 19:00 Markus Heller
  2011-02-11 19:39 ` Bastien
  2011-03-18 23:10 ` Matt Lundin
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Heller @ 2011-02-11 19:00 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I'm trying to get the following to work:

(org-add-agenda-custom-command
 '("X" tags "Task"
   ((org-agenda-skip-function '(org-agenda-skip-entry-if 
				'notregexp "Admin"))
    (org-agenda-overriding-header "  Test"))))


I want all entries that have the tag "TASK" and that have the category
"Admin" shown in the agenda.

I set the category in my org files like this:

#+CATEGORY: Admin
#+FILETAGS: ADMIN
* Tasks [5/6]							       :TASK:
** TODO Drop off Stuff
** DONE F'up on other stuff

I also tried using 'notregexp "ADMIN" to go after the FILETAG, but
either way, the search yields no hits.

I have the feeling that I'm misunderstanding something pretty badly and
would appreciate any help :-)

Thanks and Cheers
Markus

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

* Re: Accessing CATEGORY for custom agenda command
  2011-02-11 19:00 Accessing CATEGORY for custom agenda command Markus Heller
@ 2011-02-11 19:39 ` Bastien
  2011-02-11 23:28   ` Markus Heller
  2011-03-18 23:10 ` Matt Lundin
  1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2011-02-11 19:39 UTC (permalink / raw)
  To: Markus Heller; +Cc: emacs-orgmode

Hi Markus,

Markus Heller <hellerm2@gmail.com> writes:

> I'm trying to get the following to work:
>
> (org-add-agenda-custom-command
>  '("X" tags "Task"
>    ((org-agenda-skip-function '(org-agenda-skip-entry-if 
> 				'notregexp "Admin"))
>     (org-agenda-overriding-header "  Test"))))
>
>
> I want all entries that have the tag "TASK" and that have the category
> "Admin" shown in the agenda.
>
> I set the category in my org files like this:
>
> #+CATEGORY: Admin
> #+FILETAGS: ADMIN
> * Tasks [5/6]							       :TASK:
> ** TODO Drop off Stuff
> ** DONE F'up on other stuff

Two problems:

- the tag is "TASK" and your custom agenda command looks for "Task":
  beware of the case

- '(org-agenda-skip-entry-if 'notregexp "Admin") is looking for an
  actual occurrence of the string "Admin" in the subtree -- and there 
  is no such occurrence in your .org example.

I suggest you use the CATEGORY property like this:

,----
| #+FILETAGS: ADMIN
| 
| * Tasks [5/6] 							    :Task:
|   :PROPERTIES:
|   :CATEGORY: Admin
|   :END:
|   
| ** TODO Drop off Stuff
| ** DONE F'up on other stuff
`----

With this file, your agenda custom command works.

> I also tried using 'notregexp "ADMIN" to go after the FILETAG, but
> either way, the search yields no hits.

No, 'notregexp will go after actual text in the subtree, not inherited
properties.  If you look for properties, try org-entry-get instead in a 
org-agenda-skip-function instead.

> I have the feeling that I'm misunderstanding something pretty badly and
> would appreciate any help :-)

Hope you feel better :)

-- 
 Bastien

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

* Re: Accessing CATEGORY for custom agenda command
  2011-02-11 19:39 ` Bastien
@ 2011-02-11 23:28   ` Markus Heller
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Heller @ 2011-02-11 23:28 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastien.guerry@wikimedia.fr> writes:

> Hi Markus,
>
> Markus Heller <hellerm2@gmail.com> writes:
>
>> I'm trying to get the following to work:
>>
>> (org-add-agenda-custom-command
>>  '("X" tags "Task"
>>    ((org-agenda-skip-function '(org-agenda-skip-entry-if 
>> 				'notregexp "Admin"))
>>     (org-agenda-overriding-header "  Test"))))
>>
>>
>> I want all entries that have the tag "TASK" and that have the category
>> "Admin" shown in the agenda.
>>
>> I set the category in my org files like this:
>>
>> #+CATEGORY: Admin
>> #+FILETAGS: ADMIN
>> * Tasks [5/6]							       :TASK:
>> ** TODO Drop off Stuff
>> ** DONE F'up on other stuff
>
> Two problems:
>
> - the tag is "TASK" and your custom agenda command looks for "Task":
>   beware of the case
>
> - '(org-agenda-skip-entry-if 'notregexp "Admin") is looking for an
>   actual occurrence of the string "Admin" in the subtree -- and there 
>   is no such occurrence in your .org example.
>
> I suggest you use the CATEGORY property like this:
>
> ,----
> | #+FILETAGS: ADMIN
> | 
> | * Tasks [5/6] 							    :Task:
> |   :PROPERTIES:
> |   :CATEGORY: Admin
> |   :END:
> |   
> | ** TODO Drop off Stuff
> | ** DONE F'up on other stuff
> `----
>
> With this file, your agenda custom command works.
>
>> I also tried using 'notregexp "ADMIN" to go after the FILETAG, but
>> either way, the search yields no hits.
>
> No, 'notregexp will go after actual text in the subtree, not inherited
> properties.  If you look for properties, try org-entry-get instead in a 
> org-agenda-skip-function instead.
>
>> I have the feeling that I'm misunderstanding something pretty badly and
>> would appreciate any help :-)
>
> Hope you feel better :)

Hi Bastien,

thanks for you reply.  Yup, makes me feel better, because I think I'm
beginning to understand how to use properties more effectively.

Cheers
Markus

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

* Re: Accessing CATEGORY for custom agenda command
  2011-02-11 19:00 Accessing CATEGORY for custom agenda command Markus Heller
  2011-02-11 19:39 ` Bastien
@ 2011-03-18 23:10 ` Matt Lundin
  2011-03-21 20:32   ` Markus Heller
  1 sibling, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2011-03-18 23:10 UTC (permalink / raw)
  To: Markus Heller; +Cc: emacs-orgmode

Markus Heller <hellerm2@gmail.com> writes:

> I'm trying to get the following to work:
>
> (org-add-agenda-custom-command
>  '("X" tags "Task"
>    ((org-agenda-skip-function '(org-agenda-skip-entry-if 
> 				'notregexp "Admin"))
>     (org-agenda-overriding-header "  Test"))))
>
>
> I want all entries that have the tag "TASK" and that have the category
> "Admin" shown in the agenda.

Sorry for the late reply, but a simple way to do this is to change the
query. This will pick up categories regardless of whether they are
defined in the subtree or at the top of the file:

--8<---------------cut here---------------start------------->8---
(org-add-agenda-custom-command
 '("X" tags "TASK+CATEGORY=\"Admin\""
   ((org-agenda-overriding-header "  Test"))))
--8<---------------cut here---------------end--------------->8---

Best,
Matt

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

* Re: Accessing CATEGORY for custom agenda command
  2011-03-18 23:10 ` Matt Lundin
@ 2011-03-21 20:32   ` Markus Heller
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Heller @ 2011-03-21 20:32 UTC (permalink / raw)
  To: emacs-orgmode

Matt Lundin <mdl@imapmail.org> writes:

> Markus Heller <hellerm2@gmail.com> writes:
>
>> I'm trying to get the following to work:
>>
>> (org-add-agenda-custom-command
>>  '("X" tags "Task"
>>    ((org-agenda-skip-function '(org-agenda-skip-entry-if 
>> 				'notregexp "Admin"))
>>     (org-agenda-overriding-header "  Test"))))
>>
>>
>> I want all entries that have the tag "TASK" and that have the category
>> "Admin" shown in the agenda.
>
> Sorry for the late reply, but a simple way to do this is to change the
> query. This will pick up categories regardless of whether they are
> defined in the subtree or at the top of the file:
>
> (org-add-agenda-custom-command
>  '("X" tags "TASK+CATEGORY=\"Admin\""
>    ((org-agenda-overriding-header "  Test"))))

Hi Matt,

thanks for the reply.  Looks good to me, will play around with it.  Now
if I could only figure out how to use CATEGORY in my clock report ...

Cheers
Markus

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

end of thread, other threads:[~2011-03-21 20:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-11 19:00 Accessing CATEGORY for custom agenda command Markus Heller
2011-02-11 19:39 ` Bastien
2011-02-11 23:28   ` Markus Heller
2011-03-18 23:10 ` Matt Lundin
2011-03-21 20:32   ` Markus Heller

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).