From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Documentation for custom-file - is not (load custom-file) needed? Date: Wed, 08 Dec 2004 06:42:53 +0200 Organization: JURTA Message-ID: <87is7dienm.fsf@jurta.org> References: <075b01c4d9a4$52799460$0200a8c0@sedrcw11488> <00bb01c4daee$5eb81350$0200a8c0@sedrcw11488> <200412051733.iB5HXIX13206@raven.dms.auburn.edu> <000001c4db1a$8d3770f0$0200a8c0@sedrcw11488> <200412060046.iB60kZj15003@raven.dms.auburn.edu> <003e01c4db31$e45a2550$0200a8c0@sedrcw11488> <200412060402.iB6421q15173@raven.dms.auburn.edu> <200412070539.iB75dV924747@raven.dms.auburn.edu> <03be01c4dcbf$139bfa30$0200a8c0@sedrcw11488> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1102481268 3979 80.91.229.6 (8 Dec 2004 04:47:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2004 04:47:48 +0000 (UTC) Cc: teirllm@dms.auburn.edu, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 08 05:47:42 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Cbtjp-0006Ib-00 for ; Wed, 08 Dec 2004 05:47:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cbttf-0002Xr-5S for ged-emacs-devel@m.gmane.org; Tue, 07 Dec 2004 23:57:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CbttJ-0002Xm-5h for emacs-devel@gnu.org; Tue, 07 Dec 2004 23:57:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CbttI-0002Xa-OV for emacs-devel@gnu.org; Tue, 07 Dec 2004 23:57:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CbttI-0002XX-LA for emacs-devel@gnu.org; Tue, 07 Dec 2004 23:57:28 -0500 Original-Received: from [194.126.101.111] (helo=MXR-4.estpak.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CbtjH-0004Vo-2j for emacs-devel@gnu.org; Tue, 07 Dec 2004 23:47:07 -0500 Original-Received: from jurta.org.jurta.org (80-235-32-197-dsl.mus.estpak.ee [80.235.32.197]) by MXR-4.estpak.ee (Postfix) with ESMTP id E232FC4554; Wed, 8 Dec 2004 06:46:58 +0200 (EET) Original-To: "Lennart Borgman" In-Reply-To: <03be01c4dcbf$139bfa30$0200a8c0@sedrcw11488> (Lennart Borgman's message of "Wed, 8 Dec 2004 01:44:21 +0100") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30845 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30845 "Lennart Borgman" writes: > a) custom-file is a special variable and can not be treated only as > a normal "defcustom variable". > > b) It is currently treated as a normal "defcustom variable". > This should be changed. Trying to sync custom-file with the location of its own list where it is defined is like trying to lift yourself off the ground by pulling on your hair. The maximum you can achieve is to remove your hair ;-) > There are various ways to cure this: > > 1) Just do not make custom-file a "defcustom variable". This is the > easiest and does not fool the user. But it is perhaps not very nice. It's too late to make any changes in custom-file (changing its type, etc.) since users might already rely on its current state. > 2) Keep custom-file a "defcustom variable" and cure the problems. The only problem with custom-file is its existence. It is completely redundant. The location of the list of customized variables is just the file name from which it is loaded. There is no need to duplicate this information in a special variable. What users need is just to put in .emacs something like (load "custom-21.4.el") and nothing more. The location of the custom file is defined. Moving the customization list between different files can be done with normal Emacs editing commands. There is no need to do this automatically. To get this done `custom-set-variables' should save the name of the file from which it was loaded, and use it later in the `custom-file' function to return the file name. In this function `custom-file-loaded' should be placed after the `custom-file' to make it backward compatible since users might have already `custom-file' variable defined in .emacs. Index: lisp/custom.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/custom.el,v retrieving revision 1.76 diff -u -r1.76 custom.el --- lisp/custom.el 29 Jul 2004 01:47:01 -0000 1.76 +++ lisp/custom.el 8 Dec 2004 04:03:19 -0000 @@ -722,6 +722,7 @@ REQUEST is a list of features we must 'require for SYMBOL. COMMENT is a comment string about SYMBOL." + (if load-in-progress (setq custom-file-loaded load-file-name)) (apply 'custom-theme-set-variables 'user args)) (defun custom-theme-set-variables (theme &rest args) Index: lisp/cus-edit.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/cus-edit.el,v retrieving revision 1.201 diff -u -r1.201 cus-edit.el --- lisp/cus-edit.el 6 Dec 2004 14:01:19 -0000 1.201 +++ lisp/cus-edit.el 8 Dec 2004 03:57:07 -0000 @@ -3673,7 +3673,12 @@ (widget-put widget :custom-state found))) (custom-magic-reset widget)) ;;; The `custom-save-all' Function. + +(defvar custom-file-loaded nil + "Full name of last file from which `custom-set-variables' was loaded.") + ;;;###autoload (defcustom custom-file nil "File used for storing customization information. @@ -3697,6 +3702,7 @@ "Return the file name for saving customizations." (setq custom-file (or custom-file + custom-file-loaded (let ((user-init-file user-init-file) (default-init-file (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) -- Juri Linkov http://www.jurta.org/emacs/