Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
4288:9eb558ffe8ff | 4289:20accccbebd6 |
---|---|
114 ((get symbol 'saved-value) | 114 ((get symbol 'saved-value) |
115 (eval (car (get symbol 'saved-value)))) | 115 (eval (car (get symbol 'saved-value)))) |
116 (t | 116 (t |
117 (eval value))))) | 117 (eval value))))) |
118 | 118 |
119 (defun custom-initialize-changed (symbol value) | 119 ;; XEmacs change; move to defsubst, since this is only called in one place |
120 ;; and usage of it clusters. | |
121 (defsubst custom-initialize-changed (symbol value) | |
120 "Initialize SYMBOL with VALUE. | 122 "Initialize SYMBOL with VALUE. |
121 Like `custom-initialize-reset', but only use the `:set' function if the | 123 Like `custom-initialize-reset', but only use the `:set' function if |
122 not using the standard setting. | 124 not using the standard setting. |
123 For the standard setting, use `set-default'." | 125 For the standard setting, use `set-default'." |
124 (cond ((default-boundp symbol) | 126 (cond ((default-boundp symbol) |
125 (funcall (or (get symbol 'custom-set) 'set-default) | 127 (funcall (or (get symbol 'custom-set) 'set-default) |
126 symbol | 128 symbol |
140 | 142 |
141 DEFAULT is stored as SYMBOL's value in the standard theme. See | 143 DEFAULT is stored as SYMBOL's value in the standard theme. See |
142 `custom-known-themes' for a list of known themes. For backwards | 144 `custom-known-themes' for a list of known themes. For backwards |
143 compatibility, DEFAULT is also stored in SYMBOL's property | 145 compatibility, DEFAULT is also stored in SYMBOL's property |
144 `standard-value'. At the same time, SYMBOL's property `force-value' is | 146 `standard-value'. At the same time, SYMBOL's property `force-value' is |
145 set to nil, as the value is no longer rogue." | 147 set to nil, as the value is no longer rogue. |
148 | |
149 The byte compiler adds an XEmacs-specific :default keyword and value to | |
150 `custom-declare-variable' calls when it byte-compiles the DEFAULT argument. | |
151 These describe what the custom UI shows when editing a customizable | |
152 variable's associated Lisp expression. We don't encourage use of this | |
153 keyword in your own programs. " | |
146 ;; Remember the standard setting. The value should be in the standard | 154 ;; Remember the standard setting. The value should be in the standard |
147 ;; theme, not in this property. However, his would require changeing | 155 ;; theme, not in this property. However, this would require changing |
148 ;; the C source of defvar and others as well... | 156 ;; the C source of defvar and others as well... |
149 (put symbol 'standard-value (list default)) | 157 (put symbol 'standard-value (list default)) |
150 ;; Maybe this option was rogue in an earlier version. It no longer is. | 158 ;; Maybe this option was rogue in an earlier version. It no longer is. |
151 (when (eq (get symbol 'force-value) 'rogue) | 159 (when (eq (get symbol 'force-value) 'rogue) |
152 ;; It no longer is. | 160 ;; It no longer is. |
182 (mapc (lambda (option) | 190 (mapc (lambda (option) |
183 (custom-add-option symbol option)) | 191 (custom-add-option symbol option)) |
184 value) | 192 value) |
185 ;; Fast code for the common case. | 193 ;; Fast code for the common case. |
186 (put symbol 'custom-options (copy-sequence value)))) | 194 (put symbol 'custom-options (copy-sequence value)))) |
195 ;; In the event that the byte compile has compiled the init | |
196 ;; value, we want the value the UI sees to be uncompiled. | |
197 ((eq keyword :default) | |
198 (put symbol 'standard-value (list value))) | |
187 (t | 199 (t |
188 (custom-handle-keyword symbol keyword value | 200 (custom-handle-keyword symbol keyword value |
189 'custom-variable)))))) | 201 'custom-variable)))))) |
190 (put symbol 'custom-requests requests) | 202 (put symbol 'custom-requests requests) |
191 ;; Do the actual initialization. | 203 ;; Do the actual initialization. |