comparison lisp/cus-edit.el @ 37604:bd93cba9ef3e

(custom-file): Signal an error if user-init-file is nil (running -q).
author Gerd Moellmann <gerd@gnu.org>
date Mon, 07 May 2001 14:02:56 +0000
parents d1106e82508b
children 45147f063e6b
comparison
equal deleted inserted replaced
37603:df85a76987bb 37604:bd93cba9ef3e
1991 1991
1992 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's 1992 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's
1993 ;; the global custom one 1993 ;; the global custom one
1994 (defun custom-comment-show (widget) 1994 (defun custom-comment-show (widget)
1995 (widget-put widget :comment-shown t) 1995 (widget-put widget :comment-shown t)
1996 (trace-to-stderr (format "1: %s\n" (widget-value widget)))
1996 (custom-redraw widget) 1997 (custom-redraw widget)
1998 (trace-to-stderr (format "2: %s\n" (widget-value widget)))
1997 (widget-setup)) 1999 (widget-setup))
1998 2000
1999 (defun custom-comment-invisible-p (widget) 2001 (defun custom-comment-invisible-p (widget)
2000 (let ((val (widget-value (widget-get widget :comment-widget)))) 2002 (let ((val (widget-value (widget-get widget :comment-widget))))
2001 (and (equal "" val) 2003 (and (equal "" val)
3445 :type '(choice (const :tag "Your Emacs init file" nil) file) 3447 :type '(choice (const :tag "Your Emacs init file" nil) file)
3446 :group 'customize) 3448 :group 'customize)
3447 3449
3448 (defun custom-file () 3450 (defun custom-file ()
3449 "Return the file name for saving customizations." 3451 "Return the file name for saving customizations."
3450 (setq custom-file 3452 (if (null user-init-file)
3451 (or custom-file 3453 ;; Started with -q, i.e. the file containing Custom settings
3452 user-init-file 3454 ;; hasn't been read. Saving settings there would overwrite
3453 (read-file-name "File for customizations: " 3455 ;; other settings.
3454 "~/" nil nil ".emacs")))) 3456 (error "Saving settings when running -q would overwrite existing settings")
3457 (setq custom-file (or custom-file user-init-file))))
3455 3458
3456 (defun custom-save-delete (symbol) 3459 (defun custom-save-delete (symbol)
3457 "Visit `custom-file' and delete all calls to SYMBOL from it. 3460 "Visit `custom-file' and delete all calls to SYMBOL from it.
3458 Leave point at the old location of the first such call, 3461 Leave point at the old location of the first such call,
3459 or (if there were none) at the end of the buffer." 3462 or (if there were none) at the end of the buffer."