12

I have defined the following TODO states in a org-mode file:

#+SEQ_TODO: TODO(t) WAIT(w) | DONE(d)

And I have customized the colors for the TODO states:

Hide Org Todo Keyword Faces:
INS DEL Cons-cell:
            Keyword: TODO
            Face   : Value Menu Color: red
INS DEL Cons-cell:
            Keyword: WAIT
            Face   : Value Menu Color: orange
INS DEL Cons-cell:
            Keyword: DONE
            Face   : Value Menu Color: green
INS

But I would like to customize the colors of the TODO states at the same place, where I have defined them: in the file.

How can this be done?

  • 1
    file local variables? – mbork Dec 4 '14 at 8:54
14

You can add the following to the top of your .org file:

# -*- org-todo-keyword-faces: (("TODO" . "red") ("WAIT" . "orange") ("DONE" . "green")); -*-

The -*- ... -*- syntax is used to specify File-Local Variables.

  • Yes of course. I did not thought about buffer variables. I was looking for something like this: #+SEQ_TODO: TODO(t red) WAIT(w orange) | DONE(d green) – ceving Dec 4 '14 at 9:10
  • 1
    @ceving Based on the documentation for org-todo-keywords, this doesn't seem to be possible. (To see for yourself, type C-h v org-todo-keywords RET). – itsjeyd Dec 4 '14 at 9:16
  • Rather than using a cons-cell, it may be helpful to use the face properties; e.g., instead of the dot/period, use :foreground". And, perhaps consider adding a more complex example that sets both the background and foreground for a particular keyword. This same concept of using a traditional list instead of a cons-cell also applies to org-todo-priority-faces. – lawlist Apr 29 '18 at 0:31
7

I can't make the "# -*-..." syntax work in my .org file (I can accept that I probably did something wrong. :-).

I got the following to work. Place this at the bottom of your .org file:

# Local Variables:
# mode: org
# org-todo-keyword-faces: (("ANSWER" . "orange") ("ARCHIVED" . "blue") ("DATE" . "red") ("DOING" . "yellow") ("DONE" . "green") ("HPSM" . "red") ("JIRA" . "red") ("TODO" . org-warning) ("WAITING" . "orange"))
# End:
  • 1
    I successfully tested the -*- syntax using the interactive command add-file-local-variable-prop-line. I specified org-todo-keyword-faces for the variable and (("TODO" . "purple")) for the value. After calling revert-buffer things work as expected. The resulting line is # -*- org-todo-keyword-faces: (("TODO" . "purple")); -*- – glucas Dec 5 '14 at 20:02
  • Okay. This works now. I SWEAR I did this before and couldn't make it work. Regardless, the -*- syntax works fine. – Bill Benedetto Dec 5 '14 at 20:38
  • This is driving me nuts... The line by @glucas containing purple works, but this one with red # -*- org-todo-keyword-faces: (("TODO" . "purple") ("IN-PROGRESS" . "red")); -*- does NOT... Any hints? – nephewtom Oct 9 '15 at 16:12
  • @nephewtom Seems OK here. I copied your line to an org file, then re-opened the file and checked the value of org-todo-keyword-faces. Note that you would need to add IN-PROGRESS to org-todo-keywords as well. – glucas Oct 9 '15 at 18:35
  • Don't know what was happening... I may have confused myself. But it seems it happened to Bill too. Anyway, I finally got it working with this post too: stackoverflow.com/questions/12707492/… – nephewtom Oct 10 '15 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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