[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

57.2.4 Saving Customizations

Saving customizations from the customization buffer works by writing code that future sessions will read, code to set up those customizations again.

Normally this saves customizations in your init file, ‘~/.emacs’. If you wish, you can save customizations in another file instead. To make this work, your ‘~/.emacs’ should set custom-file to the name of that file. Then you should load the file by calling load. For example:

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

You can use custom-file to specify different customization files for different Emacs versions, like this:

 
(cond ((< emacs-major-version 21)
       ;; Emacs 20 customization.
       (setq custom-file "~/.custom-20.el"))
      ((and (= emacs-major-version 21) (< emacs-minor-version 4))
       ;; Emacs 21 customization, before version 21.4.
       (setq custom-file "~/.custom-21.el"))
      ((< emacs-major-version 22)
       ;; Emacs version 21.4 or later.
       (setq custom-file "~/.custom-21.4.el"))
      (t
       ;; Emacs version 22.1 or later.
       (setq custom-file "~/.custom-22.el")))

(load custom-file)

If Emacs was invoked with the ‘-q’ or ‘--no-init-file’ options (voir la section Initial Options), it will not let you save your customizations in your ‘~/.emacs’ init file. This is because saving customizations from such a session would wipe out all the other customizations you might have on your init file.


Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.