1

Objective

I decided to add custom agenda keywords (I'm still setting up the environment, don't have any agenda files yet) and I used this example code from some tutorial:

(setq org-todo-keywords
      (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
              (sequence "WAITING(w)" "HOLD(h)" "|" "CANCELLED(c)" "PHONE" "MEETING"))))

I added this code at the end of my init file.

Expected behavior

The expected behavior is after adding this code to my init file I can M-x org-agenda, then t and see all my custom keywords available for selection:

Global list of TODO items of type: ALL
Press ‘N r’ (e.g. ‘0 r’) to search again: (0)[ALL] (1)TODO (2)NEXT (3)DONE (4)WAITING
                      (5)HOLD (6)CANCELLED (7)PHONE (8)MEETING

But I don't, at least not without some ugly hack I don't understand (see below).

The problem

When I start Emacs and run M-x org-agenda and select the 't' option I don't have those added keywords available for selection, I get an empty sequence of keywords:

Global list of TODO items of type: ALL
Press ‘N r’ (e.g. ‘0 r’) to search again: (0)[ALL]

However, if I instead did M-x org-agenda with the a option (for no apparent reason) and then did M-x org-agenda with the t option, I would properly see all the keywords. So in other words, I have to select a "agenda for current week or day" first and only if I do that I get to see my keywords if I do t "list of all TODO entries". Obviously this is very inconvenient to do.

Edit: (temporary workaround)

Now I've arrived at a simpler workaround by accident - even though I've seen an empty sequence of keywords, what I did was try to filter by ALL (0 r), which doesn't make a lot of sense since it's the default filtering mode, but it brought up my keywords on the screen for some reason. This isn't too convenient but works. So the keywords are there, just don't show up immediately. To verify this I restarted Emacs and before running M-x org-agenda I checked the contents of org-todo-keywords with C-h v, it shows the correct contents but they are only displayed when I do this dummy 0 r filtering, which I believe is a bug. So I consider the problem temporarily resolved (though with a slightly inconvenient workaround) but I will keep the question open for some time in case it's not a bug and I'm doing something wrong and someone can point it out.

Two other problems I had with org-todo-keywords

Now for completeness I include two similar weird behaviors with org-todo-keywords both of which magically resolved themselves so I'm not looking for help about them, I just write them here in case it is of any value.

  1. It used to be the case that even though my (setq org-todo-keywords ... ) code was in my init file (at the end), it wouldn't work unless I manually selected it and run eval-region on it.

  2. If I updated my sequence of org-todo-keywords, I wouldn't get the updated keywords list to work no matter what - it would still show the old list, as if it was cached. Nothing would help - running 'eval-region' on the new code, restarting Emacs, etc.

  • What exactly is your question? Could you please summarize what you mean by "work properly"? Just what behavior are you looking for? – Drew Feb 20 at 18:24
  • I thought it was clear from description but I clarified this in the question. The expected behavior is have my custom keyword displayed and being able to filter by them when I run M-x org-agenda and select the t view. – Patrick Feb 20 at 18:34
  • I've heavily edited the question. I've found an easier workaround though I will keep the question for some time in case somebody can eliminate the need for this workaround. – Patrick Feb 20 at 19:14
  • It seems to be a bug. It doesn't print filter options only in the first time you run org-todo-list but if you type 2 r it works, right? You can redo using r, that is not a solution but it's better then 0 r. – adl Feb 20 at 21:43
  • That's correct. org-todo-list is the view of the agenda I meant. Yes, I can do 2 r straight away just knowing a keyword with this number is there, even though I don't see it yet at that point. I can also do r immediately after invoking org-todo-list, that works too and is more convenient than 0 r. – Patrick Feb 20 at 22:06

Your Answer

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

Browse other questions tagged or ask your own question.