4

At the bottom of the standard .spacemacs file, there is a section for custom configuration generated variables. The sections looks like:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
'(org-agenda-files ...)
...
)

Spacemacs had automatically populated this custom variable with the locations of my org-agenda files when I initially set it up. However, I had to move my org-agenda files to a new directory, so the file paths in that variable are now invalid.

After moving the files, Spacemacs kept asking if I wanted to remove the old file paths from the org-agenda-files, but then it just left me with the setting '(org-agenda-files nil)

Is there a command or key shortcut that will force Spacemacs to update the paths in this custom-set-variables section. I see that Spacemacs periodically does change some of these setting, however I have not found a consistent activity that forces this regeneration. I tried to add and remove packages from the config, but that did not seem to work.

Any ideas?

1 Answer 1

4

custom-set-variables is set when you use the Custom interface of Emacs to change its behaviour. It most useful for doing quick changes to variables in packages you are not familiar with. In the long run, it is better to manually set them in your config. Configuring packages manually will give you a better overall control and understanding of their behaviour.

In this case, you have had a functional system that broke when you moved your org files manually to a new location. Do not let the packaging convenience of spacemacs keep you from doing the right thing: namely setting the variable in your config file. Remove the variable from custom-set-variables and use the 'setq' command to set it. E.g.:

(setq org-agenda-files '("~/Dropbox/org"))

See the docstring (C-h v) of org-agenda-files for more information.

I do not use spacemacs and I am not familiar with its innards.

3
  • Thanks for the input. I set the org-agenda-files directly using the following code in dot file: (load-library "find-lisp") (setq org-agenda-files (find-lisp-find-files "~/Dropbox/org" "\.org$")). The problem is that when the custom variable is set then everything works correctly. When the above function is used--and it works just fine--then there is odd behavior in the presentation of org-agenda files. The biggest issue is that I get garbage characters for org-habit TODO tasks. So I was hoping I could find a way to directly just regenerate the org-agenda-file variable in the dotfile.
    – krishnab
    Jan 12, 2018 at 18:10
  • Okay, this worked. I went into the Custom Interface for the org-agenda files and then saved the current list of files into a custom variable. Now those strange characters are no longer showing up. Thanks for the tip.
    – krishnab
    Jan 12, 2018 at 19:45
  • If the answer helped solve your problem, please consider marking it as accepted. Thanks
    – YoungFrog
    Jan 16, 2018 at 21:05

Your Answer

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

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