1

a quote from my init.el:

;; custom-set-variables was added by Custom.
...
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.

What exactly will happen? I've found no hint in custom-set-variables' documentation...

Background: I have multiple custom-set-variables in order to share common configuration and separate special settings among a few hosts. The whole emacs setup is in a git repository and in init.el I do this:

(load (concat my-emacs-dir "config/" (system-name)  ".el" ) )
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)

It works more or less ok. I can use the customize interface (which I like) and settings go to ~/.emacs.d/custom.el. Special settings go manually to <hostname>.el

Only when merging stuff between hosts, I see that some settings to go where I would like to have them and I have a bit of additional work. To improve that, I would like to understand the details of custom-set-variables.

Drew
  • 75,699
  • 9
  • 109
  • 225

1 Answers1

0

What happens is: the variables that are set in .el (the second call to custom-set-variables) end up in ~/.emacs.d/custom.el when emacs is closed. So now I have duplicate places where they are defined, which indeed is bad.

Now I set the per host variables with (setq ...). Works fine for me...