From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Per Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Eliminating "changed in Emacs outside of Customize" Date: Mon, 31 Jan 2005 11:33:45 +0100 Organization: The Church of Emacs Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1107168774 32733 80.91.229.6 (31 Jan 2005 10:52:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 Jan 2005 10:52:54 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 31 11:52:48 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CvZAl-0003KG-00 for ; Mon, 31 Jan 2005 11:52:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CvZNN-0000YF-6f for ged-emacs-devel@m.gmane.org; Mon, 31 Jan 2005 06:05:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CvZIW-0008Pv-2M for emacs-devel@gnu.org; Mon, 31 Jan 2005 06:00:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CvZIR-0008Os-Vb for emacs-devel@gnu.org; Mon, 31 Jan 2005 06:00:45 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CvZIP-0008H0-HH for emacs-devel@gnu.org; Mon, 31 Jan 2005 06:00:42 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CvYsX-0000k7-SR for emacs-devel@gnu.org; Mon, 31 Jan 2005 05:33:58 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1CvYsL-00014H-0x for emacs-devel@gnu.org; Mon, 31 Jan 2005 11:33:45 +0100 Original-Received: from sheridan.dina.kvl.dk ([130.225.40.227]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 31 Jan 2005 11:33:45 +0100 Original-Received: from abraham by sheridan.dina.kvl.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 31 Jan 2005 11:33:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-To: emacs-devel@gnu.org Original-Lines: 127 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: sheridan.dina.kvl.dk X-Face: +kRV2]2q}lixHkE{U)mY#+6]{AH=yN~S9@IFiOa@X6?GM|8MBp/ Mail-Copies-To: nobody User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:aAaTfiM46qguQyBEMQsEAHofbgc= X-Gmane-MailScanner: Found to be clean X-Gmane-MailScanner: Found to be clean X-MailScanner-From: ged-emacs-devel@m.gmane.org 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:32663 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32663 Richard Stallman writes: > Could you tell us the reason why you designed Custom to recognize a > state of "changed in Emacs outside of Customize"? If you .emacs, or some third party code you activate from ".emacs", contains "(setq foo 42)" and you change and save "foo" from customize, you changes to the variable through customize will be overwritten next time you start Emacs. Which will likely be a big surprise to the user. In order for customize to work non-surprisingly, it has to be the only interface for changing the variable. [ This is why you should never defcustom a variable that is changed through Lisp code. Instead, split the variable in two, one for the Lisp code and one for the user alone (through customize). ] > Also, I second this request for more internal documentation of how > Custom works. Can you write some explanations of this? I don't have the time this requires. Maybe someone can take my comments here and write them up. > For instance, it would help to have a table of the correspondances (and > state changes) between the various :custom-state values (hidden, customized, > changed, modified, set, rogue, uknown, invalid, standard, nil) and the > various symbol properties `customize-value', `customized-face', > `saved-variable', `saved-value', `saved-face', `standard-value', > `customized-variable', `customized-variable-comment', `backup-value', etc. The identity of a customize option is represented by a Lisp symbol. There is the following values associated with an option. 0. The current value. This is the value of the option as seen by "the rest of Emacs". Usually extracted by 'default-value', but can be extracted with different means if the option symbol has the 'custom-get' property. Similarly, set-default (or the 'custom-set' property) can set it. 1. The widget value. This is the value shown in the widget in a customize buffer. 2. The customized value. This is the last value given to the option through customize. It is stored in the 'customized-value' property of the option, in a cons-cell whose car evaluate to the customized value. 3. The saved value. This is last value saved from customize. It is stored in the 'saved-value' property of the option, in a cons-cell whose car evaluate to the saved value. 4. The standard value. This is the value given in the 'defcustom' declaration. It is stored in the 'standard-value' property of the option, in a cons-cell whose car evaluate to the standard value. 5. The "think" value. This is what customize think the current value should be. This is the customize value, if any such value exists, otherwise the saved value, if that exists, and as a last resort the standard value. The reason for storing values unevaluated: This is so you can have values that depend on the environment. For example, you can have a valiable that has one value when Emacs is running under a window system, and another value on a tty. Since the evaluation is only done when the variable is firsty initialized, this is only relevant for the saved (and standard) values, but affect others values for compatibility. You can see (and modify and save) this unevaluated value by selecting "Show initial Lisp expression" from the Lisp interface. This will give you the unevaluated saved value, if any, otherwise the unevaluated standard value. The possible states for a customize widget are: 0. unknown The state has not been determined yet. 1. modified The widget value is different from the current value. 2. changed The current value is different from the "think" value. 3. set The "think" value is the customized value. 4. saved The "think" value is the saved value. 5. standard The "think" value is the standard value. 6. rogue There are no standard value. 7. hidden There is no widget value. 8. mismatch The widget value is not valid member of the :type specified for the option.