diff options
| author | Luc Teirlinck | 2005-01-03 23:52:47 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2005-01-03 23:52:47 +0000 |
| commit | 5aa971e3564cf8d6e695976d5a93b53caaedf118 (patch) | |
| tree | e0f61423ae8cc31aaed7159cc10a4bc87c6de28f | |
| parent | a181a27fbe0ba6dab884d31d9b8db7b31967ed62 (diff) | |
| download | emacs-5aa971e3564cf8d6e695976d5a93b53caaedf118.tar.gz emacs-5aa971e3564cf8d6e695976d5a93b53caaedf118.zip | |
(custom-file): Doc fix for defcustom.
(custom-file): The function no longer sets the variable
`custom-file' to its return value.
| -rw-r--r-- | lisp/cus-edit.el | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 5f3ffc6f8bf..7b427357981 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -3699,35 +3699,57 @@ The default is nil, which means to use your init file | |||
| 3699 | as specified by `user-init-file'. If the value is not nil, | 3699 | as specified by `user-init-file'. If the value is not nil, |
| 3700 | it should be an absolute file name. | 3700 | it should be an absolute file name. |
| 3701 | 3701 | ||
| 3702 | To make this feature work, you'll need to put something in your | 3702 | You can set this option through Custom, if you carefully read the |
| 3703 | init file to specify the value of `custom-file'. Just | 3703 | last paragraph below. However, usually it is simpler to write |
| 3704 | customizing the variable won't suffice, because Emacs won't know | 3704 | something like the following in your init file: |
| 3705 | which file to load unless the init file sets `custom-file'. | 3705 | |
| 3706 | 3706 | \(setq custom-file \"~/.emacs-custom.el\") | |
| 3707 | When you change this variable, look in the previous custom file | 3707 | \(load custom-file) |
| 3708 | \(usually your init file) for the forms `(custom-set-variables ...)' | 3708 | |
| 3709 | and `(custom-set-faces ...)', and copy them (whichever ones you find) | 3709 | Note that both lines are necessary: the first line tells Custom to |
| 3710 | to the new custom file. This will preserve your existing customizations." | 3710 | save all customizations in this file, but does not load it. |
| 3711 | :type '(choice (const :tag "Your Emacs init file" nil) file) | 3711 | |
| 3712 | When you change this variable outside Custom, look in the | ||
| 3713 | previous custom file \(usually your init file) for the | ||
| 3714 | forms `(custom-set-variables ...)' and `(custom-set-faces ...)', | ||
| 3715 | and copy them (whichever ones you find) to the new custom file. | ||
| 3716 | This will preserve your existing customizations. | ||
| 3717 | |||
| 3718 | If you save this option using Custom, Custom will write all | ||
| 3719 | currently saved customizations, including the new one for this | ||
| 3720 | option itself, into the file you specify, overwriting any | ||
| 3721 | `custom-set-variables' and `custom-set-faces' forms already | ||
| 3722 | present in that file. It will not delete any customizations from | ||
| 3723 | the old custom file. You should do that manually if that is what you | ||
| 3724 | want. You also have to put something like `\(load \"CUSTOM-FILE\") | ||
| 3725 | in your init file, where CUSTOM-FILE is the actual name of the | ||
| 3726 | file. Otherwise, Emacs will not load the file when it starts up, | ||
| 3727 | and hence will not set `custom-file' to that file either." | ||
| 3728 | :type '(choice (const :tag "Your Emacs init file" nil) | ||
| 3729 | (file :format "%t:%v%d" | ||
| 3730 | :doc | ||
| 3731 | "Please read entire docstring below before setting \ | ||
| 3732 | this through Custom. | ||
| 3733 | Click om \"More\" \(or position point there and press RETURN) | ||
| 3734 | if only the first line of the docstring is shown.")) | ||
| 3712 | :group 'customize) | 3735 | :group 'customize) |
| 3713 | 3736 | ||
| 3714 | (defun custom-file () | 3737 | (defun custom-file () |
| 3715 | "Return the file name for saving customizations." | 3738 | "Return the file name for saving customizations." |
| 3716 | (setq custom-file | 3739 | (or custom-file |
| 3717 | (or custom-file | 3740 | (let ((user-init-file user-init-file) |
| 3718 | (let ((user-init-file user-init-file) | 3741 | (default-init-file |
| 3719 | (default-init-file | 3742 | (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) |
| 3720 | (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) | 3743 | (when (null user-init-file) |
| 3721 | (when (null user-init-file) | 3744 | (if (or (file-exists-p default-init-file) |
| 3722 | (if (or (file-exists-p default-init-file) | 3745 | (and (eq system-type 'windows-nt) |
| 3723 | (and (eq system-type 'windows-nt) | 3746 | (file-exists-p "~/_emacs"))) |
| 3724 | (file-exists-p "~/_emacs"))) | 3747 | ;; Started with -q, i.e. the file containing |
| 3725 | ;; Started with -q, i.e. the file containing | 3748 | ;; Custom settings hasn't been read. Saving |
| 3726 | ;; Custom settings hasn't been read. Saving | 3749 | ;; settings there would overwrite other settings. |
| 3727 | ;; settings there would overwrite other settings. | 3750 | (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) |
| 3728 | (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) | 3751 | (setq user-init-file default-init-file)) |
| 3729 | (setq user-init-file default-init-file)) | 3752 | user-init-file))) |
| 3730 | user-init-file)))) | ||
| 3731 | 3753 | ||
| 3732 | (defun custom-save-delete (symbol) | 3754 | (defun custom-save-delete (symbol) |
| 3733 | "Visit `custom-file' and delete all calls to SYMBOL from it. | 3755 | "Visit `custom-file' and delete all calls to SYMBOL from it. |