]> git.eshelyaron.com Git - emacs.git/commitdiff
When running under emacs -q, always refuse to save the customisations, even if the...
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 2 Aug 2011 15:46:07 +0000 (17:46 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 2 Aug 2011 15:46:07 +0000 (17:46 +0200)
This makes it easier to reproduce testing runs under "emacs -Q" more
reliably.

lisp/ChangeLog
lisp/cus-edit.el

index 186508c639e1f363c672daf617991ee14ff47d25..65530d5e5e24582a516ac7aba05c46587b22ee9c 100644 (file)
@@ -1,5 +1,9 @@
 2011-08-02  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * cus-edit.el (custom-file): When running under emacs -q, always
+       refuse to save the customisations, even if the .emacs file doesn't
+       exist.
+
        * info.el: Remove the `Info-beginning-of-buffer' function
        (bug#8325).
 
index d443d6c160c041589c51ae5b5b15c0325eb6e693..3e41a304f43dd1c2be68a7222656d63f3364946e 100644 (file)
@@ -4409,25 +4409,14 @@ if only the first line of the docstring is shown."))
 
 (defun custom-file (&optional no-error)
   "Return the file name for saving customizations."
-  (let ((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.
-                    (if no-error
-                        nil
-                      (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
-                  (setq user-init-file default-init-file)))
-              user-init-file))))
-    (and file
-        (file-chase-links file))))
+  (if (null user-init-file)
+      ;; Started with -q, i.e. the file containing Custom settings
+      ;; hasn't been read.  Saving settings there won't make much
+      ;; sense.
+      (if no-error
+         nil
+       (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
+    (file-chase-links (or custom-file user-init-file))))
 
 ;; If recentf-mode is non-nil, this is defined.
 (declare-function recentf-expand-file-name "recentf" (name))