1 |
@c This is part of the Emacs manual. |
@c This is part of the Emacs manual. |
2 |
@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002 |
@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2004 |
3 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
4 |
@c See file emacs.texi for copying conditions. |
@c See file emacs.texi for copying conditions. |
5 |
@node Customization, Quitting, Amusements, Top |
@node Customization, Quitting, Amusements, Top |
487 |
The customization buffer normally saves customizations in |
The customization buffer normally saves customizations in |
488 |
@file{~/.emacs}. If you wish, you can save customizations in another |
@file{~/.emacs}. If you wish, you can save customizations in another |
489 |
file instead. To make this work, your @file{~/.emacs} should set |
file instead. To make this work, your @file{~/.emacs} should set |
490 |
@code{custom-file} to the name of that file. Emacs loads the file |
@code{custom-file} to the name of that file. If you are using Emacs |
491 |
right after your @file{.emacs} if you did not load it already. For |
version 21.4 or later, Emacs loads the file right after your |
492 |
example: |
@file{.emacs} if you did not load it already. In earlier versions, |
493 |
|
you have to load the file in your @file{~/emacs}. If you customize |
494 |
|
@code{custom-file} through the @samp{Customize} interface, you still |
495 |
|
need to load it in your @file{.emacs}, but there is no need to set |
496 |
|
it. For example: |
497 |
|
|
498 |
@example |
@example |
499 |
|
;; @r{if not set through the @samp{Customize} interface:} |
500 |
(setq custom-file "~/.emacs-custom") |
(setq custom-file "~/.emacs-custom") |
501 |
|
|
502 |
|
;; @r{in Emacs versions before 21.4 or if set through} |
503 |
|
;; @r{the @samp{Customize} interface.} |
504 |
|
(load "~/.emacs-custom") |
505 |
@end example |
@end example |
506 |
|
|
507 |
The variable @code{custom-file} is useful if you want to have |
You can also use @code{custom-file} to specify different |
508 |
different customizations for different Emacs versions: |
customization files for different Emacs versions, like this: |
509 |
|
|
510 |
@example |
@example |
511 |
(if (< emacs-major-version 21) |
(cond ((< emacs-major-version 21) |
512 |
;; @r{Emacs 20 customization.} |
;; @r{Emacs 20 customization.} |
513 |
(setq custom-file "~/.custom-20.el") |
(setq custom-file "~/.custom-20.el")) |
514 |
;; @r{Emacs 21 customization.} |
((and (= emacs-major-version 21) (< emacs-minor-version 4)) |
515 |
(setq custom-file "~/.custom-21.el")) |
;; @r{Emacs 21 customization, before version 21.4.} |
516 |
|
(setq custom-file "~/.custom-21.el")) |
517 |
|
(t |
518 |
|
;; @r{Emacs version 21.4 or later.} |
519 |
|
(setq custom-file "~/.custom-21.4.el"))) |
520 |
|
|
521 |
|
(load custom-file) |
522 |
@end example |
@end example |
523 |
|
|
524 |
If Emacs was invoked with the @option{-q} or @option{--no-init-file} |
If Emacs was invoked with the @option{-q} or @option{--no-init-file} |