emacs-devel
[Top][All Lists]
Advanced

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

Re: find-file-hook as illustration of Custom problems


From: Richard Stallman
Subject: Re: find-file-hook as illustration of Custom problems
Date: Thu, 10 Feb 2005 13:40:52 -0500

It is rather unclean to have a defcustom inside a function.
Let's try to solve this1 some other way.

The conventional way to handle custom definitions for variables
that are defined too early to use defcustom is thru cus-start.el.
Could you make it work that way?

I see that, for variables set up in cus-start.el, the standard value
is merely whatever value happens to be in effect when cus-edit is
loaded.  This is a lot like a suggestion that someone made
for how to handle settings in the init file.  However, it's not right
for this case.  So I added a feature to make it possible to specify
a standard value expression for each variable.

Does this patch work right?


*** cus-start.el        10 Feb 2005 01:13:19 -0500      1.64
--- cus-start.el        10 Feb 2005 12:12:56 -0500      
***************
*** 287,294 ****
             ;; xterm.c
               (mouse-autoselect-window display boolean "21.3")
             (x-use-underline-position-properties display boolean "21.3")
!            (x-stretch-cursor display boolean "21.1")))
!       this symbol group type native-p version
        ;; This function turns a value
        ;; into an expression which produces that value.
        (quoter (lambda (sexp)
--- 287,302 ----
             ;; xterm.c
               (mouse-autoselect-window display boolean "21.3")
             (x-use-underline-position-properties display boolean "21.3")
!            (x-stretch-cursor display boolean "21.1")
!            ;; frame.el
!            (blink-cursor-mode cursor boolean 
!                               '(not (or noninteractive
!                                         emacs-quick-startup
!                                         (eq system-type 'ms-dos)
!                                         (not (memq window-system '(x w32))))))
! 
!            ))
!       this symbol group type standard version native-p
        ;; This function turns a value
        ;; into an expression which produces that value.
        (quoter (lambda (sexp)
***************
*** 297,304 ****
                        (and (listp sexp)
                             (memq (car sexp) '(lambda)))
                        (stringp sexp)
- ;;                    (and (fboundp 'characterp)
- ;;                         (characterp sexp))
                        (numberp sexp))
                    sexp
                  (list 'quote sexp)))))
--- 305,310 ----
***************
*** 309,314 ****
--- 315,325 ----
          group (nth 1 this)
          type (nth 2 this)
          version (nth 3 this)
+         ;; If we did not specify any standard value expression above,
+         ;; use the current value as the standard value.
+         standard (if (nthcdr 4 this)
+                      (nth 4 this)
+                    (funcall quoter (default-value symbol)))
          ;; Don't complain about missing variables which are
          ;; irrelevant to this platform.
          native-p (save-match-data
***************
*** 326,333 ****
             (message "Note, built-in variable `%S' not bound" symbol))
        ;; Save the standard value, unless we already did.
        (or (get symbol 'standard-value)
!         (put symbol 'standard-value
!              (list (funcall quoter (default-value symbol)))))
        ;; If this is NOT while dumping Emacs,
        ;; set up the rest of the customization info.
        (unless purify-flag
--- 337,343 ----
             (message "Note, built-in variable `%S' not bound" symbol))
        ;; Save the standard value, unless we already did.
        (or (get symbol 'standard-value)
!         (put symbol 'standard-value (list standard)))
        ;; If this is NOT while dumping Emacs,
        ;; set up the rest of the customization info.
        (unless purify-flag




reply via email to

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