My org-mode TODO keywords are set as follows:

(setq org-todo-keywords
      '((sequence "NITPICKING(!)" "NITS_SENT(!)" "NITS_DONE(!)" "PROOFS_SENT(!)"
          "PROOFS_RECEIVED(!)" "ACS_RECEIVED(!)" "ACS_ASSIGNED(!)"
          "ACS_DONE(!)" "|" "READY(!)")))

I have a headline that starts in the NITPICKING state. Here is what happens:

  • I press C-c C-t to call org-todo. State changes from NITPICKING to NITS_SENT, as it should, but syntax highlighting gets lost for that headline.
  • I press C-c C-t again, it puts me back in the NITPICKING state, with correct highlighting.
  • I press C-c C-t again, it puts me in the NITS_SENT state, now with correct highlighting.
  • Further calls to org-todo work correctly.

So it's just the first transition that's getting screwed up. Here is what the timestamps look like:

  - State "NITS_SENT"  from "NITPICKING" [2016-05-23 Mon 13:27]
  - State "NITPICKING" from ""           [2016-05-23 Mon 13:26]
  - State "NITS_SENT"  from "NITPICKING" [2016-05-23 Mon 13:25]

It works properly if I use buffer-local keywords instead of defining org-todo-keywords in my init file. But this is the global setup that I need, and I'd prefer to do it the way I've done it.

Is there something wrong with my code? Why would only get messed up for a single state?


Edit (in response to @nispio):

This behavior occurs even when I start emacs with emacs -q and then manually evaluate the setq command above.

After some further experimentation, it also seems that the same behavior occurs regardless of the starting state. So, for instance, if I open a .org file with a headline in the ACS_RECEIVED state and execute org-todo, it puts me in the next (ACS_ASSIGNED) state, but without syntax highlighting; the next execution of org-todo puts me in the initial (NITPICKING) state, with proper syntax highlighting, and it works correctly from there.


Further edit: the problem is that the headlines were empty apart from the TODO state. I wanted the headline to be empty to make my agenda view cleaner, since the name of the org file together with the TODO state is all the info I need at a glance. But it seems that having an empty headline means that the TODO state is interpreted as the title, which is why the first call to org-todo sets me in the initial state.

So, I would like to refine my question to the following: is there any way to have headlines that are empty apart from the TODO state?

  • Can you re-produce it with emacs -q? It works as expected for me. – nispio May 23 '16 at 21:52
  • @nispio Yes, the same thing happens with emacs -q; I've edited the post to reflect this, and added further information. – MTS May 24 '16 at 17:12

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.