unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10907: 24.0.94; Updating display of Customize buffer
@ 2012-02-28 13:07 Stephen Berman
  2012-02-28 13:46 ` Andreas Schwab
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2012-02-28 13:07 UTC (permalink / raw)
  To: 10907

[-- Attachment #1: Type: text/plain, Size: 2468 bytes --]

[I posted about this problem to gnu-emacs-help last week but there
hasn't been any response, so I'm adding it to the bugtracker with a more
explicit and self-contained recipe in the hope that, if it's a real bug,
it will be fixed, or if I have made a mistake, it will be pointed out.]

1. mkdir ~/srb; cd ~/srb; touch file1 file2 file3

2. emacs -Q -l path/to/srb.el # Load the attached file.

3. M-x customize-option RET srb-selected-file RET
The Customize buffer shows this, as expected:

 Srb Selected File:
 (*) file1
 ( ) file2
 ( ) file3
     State: STANDARD.
     A selected file name from `srb-file-list'.

4. rm -rf ~/srb

5. Repeat steps 2 and 3; now the Customize buffer shows this:

 Srb Selected File: nil
     State: STANDARD. (mismatch)
     A selected file name from `srb-file-list'.

This is also expected, since srb-selected-file doesn't handle nil.

6. M-x srb-add-file RET file1 RET

7. In the Customize buffer hide and then re-show the value of
srb-selected-file; now the Customize buffer shows this:

 Srb Selected File: "file1"
     State: STANDARD. (mismatch)
     A selected file name from `srb-file-list'.

If I kill the Customize buffer and repeat step 3, it still has the
same display.  What I expected to see is this: 

 Srb Selected File:
 (*) file1
     State: STANDARD.
     A selected file name from `srb-file-list'.

But only if I exit Emacs and then restart it does the Customize buffer
look like this (after loading srb.el).  I haven't been able to get this
display after carrying out steps 4-7 without restarting Emacs.  Is it
possible?  Is there a problem with my defcustom srb-selected-file, or
with the calls to custom-reevaluate-setting and custom-set-default in
srb-add-file, 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.


In GNU Emacs 24.0.94.1 (i686-suse-linux-gnu, GTK+ Version 2.24.7)
 of 2012-02-28 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.11004000
Configured using:
 `configure '--without-toolkit-scroll-bars' 'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test file --]
[-- Type: text/x-emacs-lisp, Size: 1144 bytes --]

(defgroup srb nil
  "srb group.")

(defcustom srb-dir "~/srb/"
  "Directory of files whose names are members of `srb-file-list'."
  :type 'directory
  :group 'srb)

(defvar srb-file-list (if (file-exists-p srb-dir)
			  (directory-files srb-dir nil
					   "^[^.]+")) ; Don't include "." or ".."
  "List of names of files in `srb-dir'.")

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

(defun srb-add-file ()
  "Add a file name to `srb-file-list' and update `srb-selected-file'."
  (interactive)
  (unless (file-exists-p srb-dir)
    (make-directory srb-dir))
  (let ((file (read-from-minibuffer "Enter a file name: ")))
    (with-current-buffer (get-buffer-create file)
      (erase-buffer)
      (write-region (point-min) (point-max)
		    (concat srb-dir file) nil 'nomessage nil t)
      (kill-buffer file)))
  (setq srb-file-list (directory-files srb-dir nil "^[^.]+"))
  (custom-reevaluate-setting 'srb-selected-file)
  (custom-set-default 'srb-file (symbol-value 'srb-selected-file)))

(provide 'srb)

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-04-21 13:49 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-28 13:07 bug#10907: 24.0.94; Updating display of Customize buffer Stephen Berman
2012-02-28 13:46 ` Andreas Schwab
2012-02-28 15:19   ` Stephen Berman
2012-02-28 17:23     ` Andreas Schwab
2012-02-28 17:50       ` Stephen Berman
2012-02-28 18:00         ` Andreas Schwab
2012-02-28 18:33           ` Stephen Berman
2012-02-29  2:06             ` Stefan Monnier
2012-02-29  9:05               ` Andreas Schwab
2012-02-29 12:26                 ` Stephen Berman
2012-02-29 19:45               ` Glenn Morris
2012-03-01  2:42                 ` Stefan Monnier
2012-03-03 17:03               ` Stephen Berman
2022-04-21 13:49                 ` Lars Ingebrigtsen
2012-02-29  4:00             ` Eli Zaretskii
2012-02-29 12:20               ` Stephen Berman
2012-02-28 22:11           ` Drew Adams
2012-02-28 23:11             ` Andreas Schwab
2012-02-29  1:01               ` Drew Adams

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).