I want to customize org-agenda-prefix-format before org agenda starts :

(add-to-list 'org-agenda-prefix-format '(todo . "  %b"))

But if I put the previous line in my .emacs.d, Emacs will show me this error:

Error (use-package): org :config: Symbol's value as variable is void: org-agenda-prefix-format

It seems that the variable is not defined before org agenda has been started once. How to solve this problem?


The problem is that org-agenda-prefix-format doesn't exist as a list so you can't add to it. You could define it:

(setq org-agenda-prefix-format '((todo . "  %b")))

But, really this variable isn't good for anything until org-agenda is loaded, so just tell Emacs to add-to-list, but not until org-agenda is loaded using with-eval-after-load

(with-eval-after-load 'org-agenda 
  (add-to-list 'org-agenda-prefix-format '(todo . "  %b"))

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.