2
votes

I have read this: Multiple custom-set-faces and custom-set-variables in emacs

An answer is:

If you are manually adding custom faces, keep it in custom-set-faces.

As for having multiple (custom-set-faces ... ) or (custom-set-variables ... ) lists, I have just tested this (in Emacs 23.1). They do work - Emacs will process all lists - however, if you then use M-x customize-face to add a new custom face (similarly for a variable) and save it for future sessions, Emacs will combine all the lists into one. So, you should probably only keep the one.

I would like to know if there is any way to split a custom-set-variables call into smaller calls. Example: I would line to split this

(custom-set-variables
 '(custom-enabled-themes (quote (solarized-dark)))
 '(custom-safe-themes
   (quote
    ("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "https://stable.melpa.org/packages/"))))
 '(package-selected-packages (quote (solarized-theme)))
)

into

(custom-set-variables
 '(custom-enabled-themes (quote (solarized-dark)))
 '(custom-safe-themes
   (quote
    ("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default))))

(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "https://stable.melpa.org/packages/"))))
 '(package-selected-packages (quote (solarized-theme)))
)
1

1 Answers

3
votes

Not sure what you are really asking.

You can use custom-set-variables anywhere and as many times as you want.

However, if you also expect/want Customize to write to your custom-file (or your init file, if you do not have a custom-file) then what the other SO post told you holds true. When Customize writes to your file it coalesces the calls to custom-set-variables.

It is a bad idea to mix your own calls to custom-set-variables with Customize's writing of such code.

Keep your code separate from what Customize writes. That's the whole point of using a separate custom-file: to give Customize a separate place to play, so it doesn't mess with your code.