Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs org mode: how can I filter on tags and todo status simultaneously?

Tags:

emacs

org-mode

I am using org mode's agenda function (keyboard short cut: C-c a ) in order to make different sorted views of all my tasks. I do this by defining the variable org-agenda-custom-commands. If I have the following code in my init file:

(setq org-agenda-custom-commands'( ("p" "Projects" tags "PROJECT") ))

I can filter out tasks with the tag "PROJECT" by using the shortcut C-c a p. Likewise I can use the code:

(setq org-agenda-custom-commands'( ("t" "tasks to be done" tags-todo "TODO=\"TODO\" ") ))

to filter out task with todo status equal to TODO by using the shortcut C-c a t. My question is, how can I define org-aganda-custom-commands to filter out tasks with todo status equal to TODO AND with a tag equal to PROJECT ?

Thanks in advance : )

like image 636
myotis Avatar asked Jul 26 '15 16:07

myotis


People also ask

How do you use tags in Org mode?

Org mode has extensive support for tags. Every headline can contain a list of tags; they occur at the end of the headline. Tags are normal words containing letters, numbers, ' _ ', and ' @ '. Tags must be preceded and followed by a single colon, e.g., ' :work: '.

Is org mode built in Emacs?

Emacs has included Org Mode as a major mode by default since 2006. Bastien Guerry is the current maintainer, in cooperation with an active development community. Since its success in Emacs, some other systems now provide functions to work with org files.

How do I activate Org Mode in Emacs?

Emacs does not actually understand you are editing an Org document, yet. To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document.


1 Answers

The tag search view is poorly named. It actually searches tags and properties. tag-todo adds an extra condition that only matches todo headlines. Use "+" to indicated that a condition is required (and "-" that it's forbidden). So +PROJECT+TODO=\"TODO\" will match headlines with the tag :PROJECT: and a todo keyword of TODO. Putting into a custom command looks like

(setq org-agenda-custom-commands
      '(("p" "List Non-done projects"
          tags "+PROJECT+TODO=\"TODO\"")))
like image 110
erikstokes Avatar answered Sep 28 '22 08:09

erikstokes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!