unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Per Abrahamsen <abraham@dina.kvl.dk>
Subject: Re: Eliminating "changed in Emacs outside of Customize"
Date: Mon, 31 Jan 2005 11:33:45 +0100	[thread overview]
Message-ID: <rjekg1lwfq.fsf@sheridan.dina.kvl.dk> (raw)
In-Reply-To: E1Ctaef-0002jK-Ss@fencepost.gnu.org

Richard Stallman <rms@gnu.org> 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	other threads:[~2005-01-31 10:33 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26  0:03 Eliminating "changed in Emacs outside of Customize" Richard Stallman
2005-01-31 10:33 ` Per Abrahamsen [this message]
2005-02-01 13:30   ` Richard Stallman
2005-02-01 14:32     ` Per Abrahamsen
2005-02-01 18:58       ` Drew Adams
2005-02-01 20:04         ` Stefan Monnier
2005-02-01 20:38           ` Drew Adams
2005-02-01 20:44           ` David Kastrup
2005-02-01 21:05             ` Drew Adams
2005-02-01 23:52               ` Robert J. Chassell
2005-02-01 21:19             ` Lennart Borgman
2005-02-01 21:35               ` David Kastrup
2005-02-01 22:11                 ` Luc Teirlinck
2005-02-01 22:26                   ` Lennart Borgman
2005-02-02  1:03                     ` Luc Teirlinck
2005-02-02  1:34                       ` Drew Adams
2005-02-02  2:11                         ` Luc Teirlinck
2005-02-02  2:51                         ` Luc Teirlinck
2005-02-03  6:40                       ` Richard Stallman
2005-02-01 22:28                   ` David Kastrup
2005-02-01 22:40                   ` Drew Adams
2005-02-03  6:39                     ` Richard Stallman
2005-02-03  7:29                       ` Lennart Borgman
2005-02-05  5:27                         ` Richard Stallman
2005-02-03 16:54                       ` Drew Adams
2005-02-01 22:40                 ` Drew Adams
2005-02-01 21:25           ` Lennart Borgman
2005-02-03  6:39             ` Richard Stallman
2005-02-02  7:57           ` Per Abrahamsen
2005-02-02 18:33             ` Drew Adams
2005-02-02 21:04               ` Lennart Borgman
2005-02-02 22:11                 ` Drew Adams
2005-02-02 22:55                   ` Stefan Monnier
2005-02-02 22:45                 ` Luc Teirlinck
2005-02-03 15:49                   ` Lennart Borgman
2005-02-03 16:12                     ` Luc Teirlinck
2005-02-03 15:51                   ` Lennart Borgman
2005-02-03 16:01                     ` Lennart Borgman
2005-02-03 19:14                 ` Richard Stallman
2005-02-04  7:27                   ` Lennart Borgman
2005-02-03 19:12             ` Richard Stallman
2005-02-03 19:45               ` Stefan Monnier
2005-02-03 19:59                 ` Lennart Borgman
2005-02-03 20:34                   ` Stefan Monnier
2005-02-05  5:31                 ` Richard Stallman
2005-02-03 20:53               ` Drew Adams
2005-02-03 22:08                 ` Luc Teirlinck
2005-02-03 22:13                 ` Luc Teirlinck
2005-02-04  1:04                 ` Luc Teirlinck
2005-02-04  1:31                 ` Luc Teirlinck
2005-02-04  3:16                   ` Luc Teirlinck
2005-02-03 21:10               ` Robert J. Chassell
2005-02-03  6:39           ` Richard Stallman
2005-02-03  6:41       ` Richard Stallman
2005-02-03 14:42         ` Stefan Monnier
2005-02-03 15:23           ` Luc Teirlinck
2005-02-03 15:48           ` Luc Teirlinck
2005-02-01 15:41   ` Lennart Borgman
2005-02-02  7:40     ` Per Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=rjekg1lwfq.fsf@sheridan.dina.kvl.dk \
    --to=abraham@dina.kvl.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).