emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eliminating "changed in Emacs outside of Customize"


From: Per Abrahamsen
Subject: Re: Eliminating "changed in Emacs outside of Customize"
Date: Mon, 31 Jan 2005 11:33:45 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Richard Stallman <address@hidden> 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. 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]