Commits

Anonymous committed 63da016

2004-09-07 Steve Youngs <steve@youngs.au.com>

* calc.el (calc): New custom group
(calc-settings-file): Defcustom it and default to ~/.calc.el.
(calc-mode): Only load `calc-settings-file' if it exists.

* calc-mode.el (calc-settings-file-name): Default to using
~/.calc.el.

This prevents a "stringp nil" error if ~/.emacs didn't exist, and
also stops unnecessary double loading of `user-init-file'.

Comments (0)

Files changed (3)

+2004-09-07  Steve Youngs  <steve@youngs.au.com>
+
+	* calc.el (calc): New custom group
+	(calc-settings-file): Defcustom it and default to ~/.calc.el.
+	(calc-mode): Only load `calc-settings-file' if it exists.
+
+	* calc-mode.el (calc-settings-file-name): Default to using
+	~/.calc.el. 
+
+	This prevents a "stringp nil" error if ~/.emacs didn't exist, and
+	also stops unnecessary double loading of `user-init-file'.
+
 2004-06-06  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.25 released.
 )
 
 (defun calc-settings-file-name (name &optional arg)
-  (interactive "sSettings file name (normally ~/.emacs): \nP")
+  (interactive "sSettings file name (normally ~/.calc.el): \nP")
   (calc-wrapper
    (setq arg (if arg (prefix-numeric-value arg) 0))
    (if (equal name "")
 	     (set (car (car list)) (nth 1 (car list)))
 	     (setq list (cdr list)))))
      (setq calc-settings-file name)
-     (or (and (string-match "\\.emacs" calc-settings-file)
+     (or (and (string-match "\\.calc.el" calc-settings-file)
 	      (> arg 0))
 	 (< arg 0)
 	 (load name t)
 (defvar calc-info-filename "calc.info"
   "*File name in which to look for the Calculator's Info documentation.")
 
-;;;###autoload
-(defvar calc-settings-file user-init-file
-  "*File in which to record permanent settings; default is `user-init-file'.")
+(defgroup calc nil
+  "Calculator settings."
+  :prefix "calc-"
+  :group 'emacs)
+
+(defcustom calc-settings-file (expand-file-name ".calc.el" (getenv "HOME"))
+  "*File in which to record permanent settings; default is `~/.calc.el'."
+  :type 'file
+  :group 'calc)
 
 ;;;###autoload
 (defvar calc-autoload-directory nil
 				   (setq calc-stack (list (list 'top-of-stack
 								1 nil))))))
   (setq calc-stack-top (- (length calc-stack) calc-stack-top -1))
-  (or calc-loaded-settings-file
-      (string-match "\\.emacs" calc-settings-file)
-      (progn
-	(setq calc-loaded-settings-file t)
-	(load calc-settings-file t)))   ; t = missing-ok
+  (unless calc-loaded-settings-file
+    (when (file-exists-p calc-settings-file)
+      (load-file calc-settings-file))
+    (setq calc-loaded-settings-file t))
   (if (and (eq window-system 'x) (boundp 'mouse-map))
       (substitute-key-definition 'x-paste-text 'calc-x-paste-text
 				 mouse-map))