Take care of fallout from updating/fixing #'eval-after-load
[sxemacs] / lisp / cus-file.el
1 ;;; cus-file.el --- Manage location of the customize init file
2
3 ;; Copyright (C) 2000 by Free Software Foundation, Inc.
4 ;; Copyright (C) 2007 Steve Youngs.
5
6 ;; Author: Mike Sperber <mike@xemacs.org>
7 ;; Keywords: internal
8
9 ;; This file is part of SXEmacs.
10
11 ;; SXEmacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15
16 ;; SXEmacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Synched up with: Not in FSF
25
26 ;;; Commentary:
27
28 ;; This file manages the location of the custom init file without
29 ;; loading all of the custom code itself.
30
31 \f
32 ;;; Code:
33 (provide 'cus-file)
34
35 ;;;###autoload
36 (defconst custom-file-base (concat "custom-" (user-login-name) ".el")
37   "Base of file name for storing customization information.")
38
39 ;;;###autoload
40 (defvar custom-file nil
41   "File used for storing customization information.
42 If you change this from the default you need to
43 explicitly load that file for the settings to take effect.")
44
45 ;;;###autoload
46 (defun make-custom-file-name (init-file &optional force-new)
47   "Construct the default custom file name from the init file name.
48 If FORCE-NEW is non-nil, force post-migration location."
49   (let ((init-file (or init-file user-init-file)))
50     (if (or force-new
51             (not init-file)
52             (string= (file-name-directory init-file)
53                      (expand-file-name
54                       (file-name-as-directory user-init-directory))))
55         ;; back compat with ~/.sxemacs/custom.el
56         (if (file-readable-p (expand-file-name "custom.el" user-init-directory))
57             (expand-file-name "custom.el" user-init-directory)
58           (expand-file-name custom-file-base user-init-directory))
59       init-file)))
60
61 ;;; cus-file.el ends here