what is custom-set-variables and faces in my .emacs?

custom-set-faces emacs
customize emacs

this is in my .emacs can I mess with it or not?

(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.
 )
(custom-set-faces
  ;; custom-set-faces 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.
 '(better-fringes-bitmap ((t (:foreground "#00dd44"))))
 '(font-lock-string-face ((((class color) (min-colors 88) (background light)) (:foreground "#113355")))))

so far I am adding everything I want above these lines...

These are lines added to the file when you use the customise system. They're generated when you use customize-*. By default, the customisation options are stored in the .emacs file. You don't usually edit these by hand. You have to use the customize-* commands to edit them.

Applying Customizations, When the user invokes ' Save for future sessions ' in the Customize interface, that takes effect by writing a custom-set-variables and/or a custom-set-faces form  Instead of custom-set-faces you can set it with set-face-attribute, but it will still change the face "in all buffers".

These blocks are added by the customize interface, as Noufal pointed out. You can move them to a separate file, though, if you like.

Just add this to your ~/.emacs.d/init.el:

(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)

or, if you're still using an old-fashioned ~/.emacs file:

(setq custom-file "~/.custom.el")
(load custom-file)

A slightly more complex snippet that will work in either case is:

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)

Changing faces one at a time, outside customize, You can use custom-set-faces or custom-theme-set-faces , with a list of one there are the single-option functions customize-set-variable and  The default behavior is to not list variables defined with setq when saving custom set variables with the user interface; and, those setq variables cannot generally be overwritten through the user-interface. For variables set by hand that will be saved with the user interface, you would actually need to use the same format within your elisp code -- i.e., the same format you see after saving with the user interface.

Don't add anything to these lines manually — your changes will be vanished by emacs on some events. Instead add custom variables with customize-set-variable and custom faces with set-face-attribute:

(customize-set-variable 'blink-cursor-mode nil)
(set-face-attribute 'default nil :family "DejaVu Sans Mono")

In order to customize face of some package one sometimes need to request the package first, and after that set its face:

(require 'mumamo)
(set-face-attribute 'mumamo-background-chunk-major nil :background nil)

Using custom-set-variables programmatically : emacs, I prefer to put custom junk in a separate file that gets loaded from my init, e.g. (​setq custom-file "~/.emacs-custom") (if (file-exists-p custom-file) (load  ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(py-shell-name "C:\\Python27\\python.exe")) (custom-set-faces ;; custom-set-faces 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.

what is custom-set-variables and faces in my .emacs?, this is in my .emacs can I mess with it or not? (custom-set-variables ;; custom-set-​variables was added by Custom. ;; If you edit it by hand, you could mess it up,  53 what is custom-set-variables and faces in my .emacs? 50 Move line/region up and down in emacs; 48 Migrating from Authlogic to Devise; 44 Open a file at line with

Emacs: M-x customize Tutorial, Emacs has a textual GUI system for setting user preferences . The Custom system does NOT include all possible variable settings. (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you  Update: Since Emacs 24.4: tab-stop-list is now implicitly extended to infinity. Its default value is changed to nil which means a tab stop every tab-width columns.. which means that there's no longer any need to be setting tab-stop-list in the way shown below, as you can keep it set to nil.

Help - which one to use: custom-set-variables, customize , `customize-set-value', or `custom-set-variables' to change in my init file variables of Emacs need to be associated with the change in the variable value. faces - as opposed to using such functions in an init file. (Just one  CMake. Using flymake for CMake is not difficult, the trick is to generate Makefiles using information provided by cmake. This page contains explanation and scripts to do that.

Comments
  • see this question to find out why it's called old fashioned
  • What do you mean by "an old-fashioned ~/.emacs file"? Is there some other way that is preferred to using ~/.emacs now?
  • Yes, it's now conventional to have an ~/.emacs.d directory, containing an init.el startup file which works like ~/.emacs. This lets you have a self-contained location in which to put your config even when it's split into multiple files, and installed elisp packages will also get placed in that directory if present. The comment from jan-glx above provides a link to more information.
  • Instead of hardcoding ~/emacs.d/, I think it's better to use expand-file-name: (setq custom-file (expand-file-name "custom.el" user-emacs-directory))
  • @MohammadBanisaeid In general, I agree, but I believe that if you have a ~/.emacs file, then user-emacs-directory will be ~, so the overall effect will not be as consistent/explicit. I'll edit the answer to reflect this.