diff lisp/custom.el @ 4289:20accccbebd6

[xemacs-hg @ 2007-11-27 22:15:32 by aidan] Byte compile defcustom init values; save the Lisp values for correct editing, correct some comments and indentation, and expose some lambda expressions to the byte compile; make custom-initialize-changed a defubst, since it's only called from one place and calls to that place cluster.
author aidan
date Tue, 27 Nov 2007 22:15:34 +0000
parents cef5f57bb9e2
children 1d7faae1080c
line wrap: on
line diff
--- a/lisp/custom.el	Tue Nov 27 15:38:40 2007 +0000
+++ b/lisp/custom.el	Tue Nov 27 22:15:34 2007 +0000
@@ -116,9 +116,11 @@
                    (t
                     (eval value)))))
 
-(defun custom-initialize-changed (symbol value)
+;; XEmacs change; move to defsubst, since this is only called in one place
+;; and usage of it clusters.
+(defsubst custom-initialize-changed (symbol value)
   "Initialize SYMBOL with VALUE.
-Like `custom-initialize-reset', but only use the `:set' function if the
+Like `custom-initialize-reset', but only use the `:set' function if
 not using the standard setting.
 For the standard setting, use `set-default'."
   (cond ((default-boundp symbol)
@@ -142,9 +144,15 @@
 `custom-known-themes' for a list of known themes.  For backwards
 compatibility, DEFAULT is also stored in SYMBOL's property
 `standard-value'.  At the same time, SYMBOL's property `force-value' is
-set to nil, as the value is no longer rogue."
+set to nil, as the value is no longer rogue.
+
+The byte compiler adds an XEmacs-specific :default keyword and value to
+`custom-declare-variable' calls when it byte-compiles the DEFAULT argument.
+These describe what the custom UI shows when editing a customizable
+variable's associated Lisp expression.  We don't encourage use of this
+keyword in your own programs.  "
   ;; Remember the standard setting.  The value should be in the standard
-  ;; theme, not in this property.  However, his would require changeing
+  ;; theme, not in this property.  However, this would require changing
   ;; the C source of defvar and others as well...
   (put symbol 'standard-value (list default))
   ;; Maybe this option was rogue in an earlier version.  It no longer is.
@@ -184,6 +192,10 @@
 			   value)
 		   ;; Fast code for the common case.
 		   (put symbol 'custom-options (copy-sequence value))))
+                ;; In the event that the byte compile has compiled the init
+                ;; value, we want the value the UI sees to be uncompiled.
+                ((eq keyword :default)
+                 (put symbol 'standard-value (list value)))
 		(t
 		 (custom-handle-keyword symbol keyword value
 					'custom-variable))))))