7

I'm trying to customize my todos a bit. Currently, I use different categories for my todos as such:

* TODO customize colors of categories
  :CATEGORY: emacs
* TODO get groceries
  :CATEGORY: errands

Then when I view my todos via C-c a t, I get a listing of my todos. I have them sorted via category, using

;; Global agenda: sort todos by category
(setq org-agenda-sorting-strategy
      '((agenda category-up)
        (todo priority-down category-up)
        (tags priority-down category-keep)
        (search category-keep)))

Now I would like each category todo to appear in a different color. Alternatively, an easier solution for me might be to put a line break between each section of categories. I don't know how to do either these.

While I'm at it, is there a better way to organize my todos, or is :CATEGORY: the way to go?

4
  • I generally use tags (C-c C-q), which can also be sorted / filtered in an agenda view. But specifically on color: org-mode allows you to set the color of your todo keywords, but I don't think there is a built-in mechanism for setting color based on other attributes (tags, categories, etc).
    – glucas
    Commented Mar 14, 2017 at 18:03
  • Actually - just checked the org manual and there is support for coloring tags via org-tag-faces.
    – glucas
    Commented Mar 14, 2017 at 18:07
  • I have considered using tags also. But the problem is then that I have todos in multiple files, and the file name is the first column that shows up when I bring up todos. This gets in the way and distracts me. Is there a way to remove that column?
    – theQman
    Commented Mar 14, 2017 at 18:31
  • You might experiment with org-agenda-prefix-format. I think the default format uses category, which falls back to file name.
    – glucas
    Commented Mar 14, 2017 at 18:34

2 Answers 2

10

I prefer to use sub todos inside of a larger parent todo, instead of using categories. E.g:

* TODO Write Tutorial [0/2]
** TODO Create Outline
** TODO Collect Data

Then as I complete them I can see how close the larger parent todo is to being completed. Simply adding [/] to the end of the parent and C-c C-c to initialize it.

Below is how I color my sequence of todos:

(setq org-todo-keywords
  '(
(sequence "TODO" "DOING" "|" "DELEGATED" "POSTPONED" "DONE" "CANCELED")
(sequence "SENT" "APPROVED" "|" "PAID")
))

(setq org-todo-keyword-faces
  '(("TODO" . (:foreground "#ff39a3" :weight bold))
("STARTED" . "#E35DBF")
("CANCELED" . (:foreground "white" :background "#4d4d4d" :weight bold))
("DELEGATED" . "pink")
("POSTPONED" . "#008080")))
2
  • Is there a way to then sort by todo-keyword when I view all todos with C-c a t?
    – theQman
    Commented Mar 14, 2017 at 19:50
  • Yes, I believe what you're looking to do is here: orgmode.org/manual/Sorting-agenda-items.html You can C-h v Then access the 'org-agenda-sorting-strategy' variable, where you can define how your agenda is sorted.
    – cstls
    Commented Mar 14, 2017 at 19:55
3

Org does not have built-in support for assigning faces (colors, etc) to specific categories. You can assign colors to specific TODO keywords (org-todo-keyword-faces) or to specific tags (org-tag-faces).

You might want to look at org-agenda-category-icon-alist, which lets you associate an icon with a category. (I've never used this, but found it in the customization options. Try M-x customize-group org-agenda-line-format to find more options.)

You might be able to use a general mechanism such as highlight-lines-matching-regexp and set things up to enable hi-lock-mode and set your patterns / faces in your agenda buffers. That's not related to org, just matching text patterns and applying a specific face.

Sticking with org features: tags might be an alternative, depending on your workflow. Tags can still be used to sort or filter an agenda view, have configurable faces, and you can put multiple tags on a single todo item. You can easily filter an agenda view by tags (default binding /). You can customize org-agenda-prefix-format if you want e.g. to replace the category with tag info in the agenda line prefix.

As suggested in another answer you can also define headings for your different categories, and put todo items under them. The org features around capture and refile are useful here: you can have an inbox file where you collect todos and then refile them in to suitable sub-headings later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.