summaryrefslogtreecommitdiff
path: root/lisp/cus-edit.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-05-28 07:13:32 +0000
committerEli Zaretskii <eliz@gnu.org>2001-05-28 07:13:32 +0000
commit558771ba0d6e2b5112df43c78458173913c18fec (patch)
tree05bc7f2983bd46a2bbebae9731ab98465d57f12e /lisp/cus-edit.el
parentd686d354c1a0ca892183a017a467b8ae6280b33b (diff)
downloademacs-558771ba0d6e2b5112df43c78458173913c18fec.tar.gz
(custom-file): Fix last change.
Diffstat (limited to 'lisp/cus-edit.el')
-rw-r--r--lisp/cus-edit.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index b36414d3ac6..862cbf7d5d5 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -3447,15 +3447,21 @@ to the new custom file. This will preserve your existing customizations."
(defun custom-file ()
"Return the file name for saving customizations."
- (if (and (null user-init-file)
- (or (file-exists-p "~/.emacs")
- (and (memq system-type '(ms-dos windows-nt))
- (file-exists-p "~/_emacs"))))
- ;; Started with -q, i.e. the file containing Custom settings
- ;; hasn't been read. Saving settings there would overwrite
- ;; other settings.
- (error "Saving settings when running -q would overwrite existing settings")
- (setq custom-file (or custom-file user-init-file))))
+ (setq custom-file
+ (or custom-file
+ (let ((user-init-file user-init-file)
+ (default-init-file
+ (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
+ (when (null user-init-file)
+ (if (or (file-exists-p default-init-file)
+ (and (eq system-type 'windows-nt)
+ (file-exists-p "~/_emacs")))
+ ;; Started with -q, i.e. the file containing
+ ;; Custom settings hasn't been read. Saving
+ ;; settings there would overwrite other settings.
+ (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
+ (setq user-init-file default-init-file))
+ user-init-file))))
(defun custom-save-delete (symbol)
"Visit `custom-file' and delete all calls to SYMBOL from it.