[Not an answer: just an attempt at elucidating what is going on.]
AFAICT, there is no reason for using backquote/comma here: that's useful when you want to quote some expression so that it does not get evaluated, except that you do want to evaluate a subexpression. Otherwise, use a single quote '
and quote everything.
If I put the above (well, the modified version with a single quote, but other than readability, it does not make any difference in this particular case) in a file /tmp/foo.el
(and add (require 'org-agenda)
to make sure that org-agenda-custom-commands
is defined before it is used), like this:
(require 'org-agenda)
(setq todos
'("xt"
"Todos"
tags-todo
"TODO=\"TODO\" "
(
(org-agenda-files '("~/agenda"))
)
))
(add-to-list 'org-agenda-custom-commands todos)
I can start a new emacs with emacs -q -l /tmp/foo.el
and then go to the *scratch*
buffer and evaluate org-agenda-custom-commands
:
;; make sure you are in the *scratch* buffer and press C-j after typing in
;; the next line
org-agenda-custom-commands
(("xt" "Todos" tags-todo "TODO=\"TODO\" " ((org-agenda-files '("~/agenda")))) ("n" "Agenda and all TODOs" ((agenda "") (alltodo ""))))
As you can see, the entry was added. Try to reproduce the above and make sure that you get the same result. BTW, the "n" entry is the default value of org-agenda-custom-commands
: the add-to-list
added your entry to the front, so you now have two entries.