7

I have the following line in my .emacs:

(setq org-agenda-files (directory-files "~/org-files" 'absolute "[^#]*.org$" 'no-sort))

I would like for org-agenda-files to be defined in this way on startup. However, a (custom-set-variables '(org-agenda-files ...)) keeps getting populated, which means that whenever I remove .org files on another computer, I get hit with Non-existent agenda file messages. How can I remove this persistent behavior?

2
  • Do you use custom settings for anything else? Would not loading any custom variables be a solution?
    – erikstokes
    Commented Mar 13, 2015 at 1:36
  • It would be for me! I don't use custom settings for anything. I prefer to control my settings explicitly through elisp. Commented Mar 13, 2015 at 20:42

2 Answers 2

2

You might be typing C-c [ which invokes (org-agenda-file-to-front). See http://orgmode.org/manual/Agenda-files.html

Redefine that key so that it does not mess with the agenda list (saving the changes in emacs-custom.el), and your issue should go away.

2

One solution to stop Emacs from modifying your custom settings is to not use custom settings at. Setting the variable custom-file to some filename will cause custom settings to be stored in that file. The default is nil, which means to use your init file.

You can then load the custom settings with (load custom-file). Or not load them and then whatever goes in there is basically going into black hole. On Linux, you can send them to a more literal black hole by setting custom-file to /dev/null. It's a little passive-aggressive, but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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