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?

Matthew Piziak
  • 5,958
  • 3
  • 29
  • 77

2 Answers2

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.

erikstokes
  • 12,686
  • 2
  • 34
  • 56
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.

mankoff
  • 4,108
  • 1
  • 22
  • 39