help-gnu-emacs
[Top][All Lists]
Advanced

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

Updating display of Customize buffer


From: Stephen Berman
Subject: Updating display of Customize buffer
Date: Thu, 23 Feb 2012 17:03:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux)

I've encountered a display problem in Customize buffers.  In a package
I'm working on I defined a user option to choose a file from a list of
files in a given directory, like this:

(defcustom srb-file (car srb-file-list)
  "The chosen file from `srb-file-list'."
  :type `(radio ,@(mapcar (lambda (x) (list 'const x)) srb-file-list))
  :group 'srb)

If the value of srb-file-list is e.g. (file1 file2 file3), then the
Customize buffer displays srb-file like this:

 srb-file:
 (*) file1
 ( ) file2
 ( ) file3
     State: STANDARD

So far, so good.  However, the value of srb-file-list could be nil
(because the directory is empty) when the file in which srb-file is
defined is loaded.  For that case there is the function srb-add-file
that adds a file to the directory from which srb-file-list gets its
value, updates srb-file-list and then makes the following function
calls:

 (custom-reevaluate-setting 'srb-file)
 (custom-set-default 'srb-file (symbol-value 'srb-file))

Now here comes the problem: if I invoke srb-add-file when srb-file-list
is nil, add "file1" and then call customize-variable on srb-file, the
display in the Customize buffer looks like this:

 srb-file: "file1"
     State: STANDARD. (mismatch)

and not, as I expected, like this:

 srb-file:
 (*) file1
     State: STANDARD

If I exit Emacs and then restart it (with srb-file-list still containing
"file1"), then the Customize buffer now does have the latter display.
But I haven't been able to get this display without restarting Emacs.
Is it possible?  Is there a problem with my above defcustom, or with the
calls to custom-reevaluate-setting and custom-set-default, or have I
overlooked some other custom-* function that correctly updates the
display?  Or is this a bug in the Customize API?  I'd be grateful for
any help.

Steve Berman




reply via email to

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