comparison lisp/cus-edit.el @ 59335:45239c528a49

(custom-file): Doc fix for defcustom. (custom-file): The function no longer sets the variable `custom-file' to its return value.
author Luc Teirlinck <teirllm@auburn.edu>
date Mon, 03 Jan 2005 23:52:47 +0000
parents a7271df99c36
children 6c0affadd4d4
comparison
equal deleted inserted replaced
59334:5068fdb7f223 59335:45239c528a49
3697 "File used for storing customization information. 3697 "File used for storing customization information.
3698 The default is nil, which means to use your init file 3698 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.
3734 Leave point at the old location of the first such call, 3756 Leave point at the old location of the first such call,
3735 or (if there were none) at the end of the buffer." 3757 or (if there were none) at the end of the buffer."