17334
|
1 ;;; custom.el -- Tools for declaring and initializing options.
|
|
2 ;;
|
25683
|
3 ;; Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
|
17334
|
4 ;;
|
|
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
|
26582
|
6 ;; Maintainer: FSF
|
17334
|
7 ;; Keywords: help, faces
|
|
8
|
17520
|
9 ;; This file is part of GNU Emacs.
|
|
10
|
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
12 ;; it under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 ;; GNU General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
|
25
|
17334
|
26 ;;; Commentary:
|
|
27 ;;
|
|
28 ;; This file only contain the code needed to declare and initialize
|
|
29 ;; user options. The code to customize options is autoloaded from
|
25683
|
30 ;; `cus-edit.el' and is documented in the Emacs Lisp Reference manual.
|
17334
|
31
|
|
32 ;; The code implementing face declarations is in `cus-face.el'
|
|
33
|
|
34 ;;; Code:
|
|
35
|
|
36 (require 'widget)
|
|
37
|
17415
|
38 (defvar custom-define-hook nil
|
|
39 ;; Customize information for this option is in `cus-edit.el'.
|
|
40 "Hook called after defining each customize option.")
|
|
41
|
17334
|
42 ;;; The `defcustom' Macro.
|
|
43
|
17550
|
44 (defun custom-initialize-default (symbol value)
|
|
45 "Initialize SYMBOL with VALUE.
|
|
46 This will do nothing if symbol already has a default binding.
|
|
47 Otherwise, if symbol has a `saved-value' property, it will evaluate
|
|
48 the car of that and used as the default binding for symbol.
|
|
49 Otherwise, VALUE will be evaluated and used as the default binding for
|
|
50 symbol."
|
17415
|
51 (unless (default-boundp symbol)
|
18033
|
52 ;; Use the saved value if it exists, otherwise the standard setting.
|
17334
|
53 (set-default symbol (if (get symbol 'saved-value)
|
|
54 (eval (car (get symbol 'saved-value)))
|
17550
|
55 (eval value)))))
|
|
56
|
|
57 (defun custom-initialize-set (symbol value)
|
19535
|
58 "Initialize SYMBOL based on VALUE.
|
|
59 If the symbol doesn't have a default binding already,
|
|
60 then set it using its `:set' function (or `set-default' if it has none).
|
|
61 The value is either the value in the symbol's `saved-value' property,
|
|
62 if any, or VALUE."
|
17550
|
63 (unless (default-boundp symbol)
|
|
64 (funcall (or (get symbol 'custom-set) 'set-default)
|
25683
|
65 symbol
|
17550
|
66 (if (get symbol 'saved-value)
|
|
67 (eval (car (get symbol 'saved-value)))
|
|
68 (eval value)))))
|
|
69
|
|
70 (defun custom-initialize-reset (symbol value)
|
19535
|
71 "Initialize SYMBOL based on VALUE.
|
|
72 Set the symbol, using its `:set' function (or `set-default' if it has none).
|
|
73 The value is either the symbol's current value
|
|
74 \(as obtained using the `:get' function), if any,
|
|
75 or the value in the symbol's `saved-value' property if any,
|
|
76 or (last of all) VALUE."
|
17550
|
77 (funcall (or (get symbol 'custom-set) 'set-default)
|
25683
|
78 symbol
|
17550
|
79 (cond ((default-boundp symbol)
|
|
80 (funcall (or (get symbol 'custom-get) 'default-value)
|
|
81 symbol))
|
|
82 ((get symbol 'saved-value)
|
|
83 (eval (car (get symbol 'saved-value))))
|
|
84 (t
|
|
85 (eval value)))))
|
|
86
|
|
87 (defun custom-initialize-changed (symbol value)
|
|
88 "Initialize SYMBOL with VALUE.
|
36269
|
89 Like `custom-initialize-reset', but only use the `:set' function if
|
19535
|
90 not using the standard setting.
|
36269
|
91 For the standard setting, use `set-default'."
|
17550
|
92 (cond ((default-boundp symbol)
|
|
93 (funcall (or (get symbol 'custom-set) 'set-default)
|
|
94 symbol
|
|
95 (funcall (or (get symbol 'custom-get) 'default-value)
|
|
96 symbol)))
|
|
97 ((get symbol 'saved-value)
|
|
98 (funcall (or (get symbol 'custom-set) 'set-default)
|
|
99 symbol
|
|
100 (eval (car (get symbol 'saved-value)))))
|
|
101 (t
|
|
102 (set-default symbol (eval value)))))
|
|
103
|
19516
|
104 (defun custom-declare-variable (symbol default doc &rest args)
|
|
105 "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments.
|
|
106 DEFAULT should be an expression to evaluate to compute the default value,
|
|
107 not the default value itself."
|
18033
|
108 ;; Remember the standard setting.
|
19516
|
109 (put symbol 'standard-value (list default))
|
17415
|
110 ;; Maybe this option was rogue in an earlier version. It no longer is.
|
|
111 (when (get symbol 'force-value)
|
|
112 (put symbol 'force-value nil))
|
17334
|
113 (when doc
|
|
114 (put symbol 'variable-documentation doc))
|
19535
|
115 (let ((initialize 'custom-initialize-reset)
|
17550
|
116 (requests nil))
|
25683
|
117 (while args
|
17550
|
118 (let ((arg (car args)))
|
17334
|
119 (setq args (cdr args))
|
17550
|
120 (unless (symbolp arg)
|
|
121 (error "Junk in args %S" args))
|
|
122 (let ((keyword arg)
|
|
123 (value (car args)))
|
|
124 (unless args
|
|
125 (error "Keyword %s is missing an argument" keyword))
|
|
126 (setq args (cdr args))
|
|
127 (cond ((eq keyword :initialize)
|
|
128 (setq initialize value))
|
|
129 ((eq keyword :set)
|
|
130 (put symbol 'custom-set value))
|
|
131 ((eq keyword :get)
|
|
132 (put symbol 'custom-get value))
|
|
133 ((eq keyword :require)
|
17576
|
134 (setq requests (cons value requests)))
|
17550
|
135 ((eq keyword :type)
|
26928
|
136 (put symbol 'custom-type (purecopy value)))
|
17550
|
137 ((eq keyword :options)
|
|
138 (if (get symbol 'custom-options)
|
|
139 ;; Slow safe code to avoid duplicates.
|
32225
|
140 (mapc (lambda (option)
|
|
141 (custom-add-option symbol option))
|
17550
|
142 value)
|
|
143 ;; Fast code for the common case.
|
|
144 (put symbol 'custom-options (copy-sequence value))))
|
|
145 (t
|
|
146 (custom-handle-keyword symbol keyword value
|
|
147 'custom-variable))))))
|
|
148 (put symbol 'custom-requests requests)
|
|
149 ;; Do the actual initialization.
|
19516
|
150 (funcall initialize symbol default))
|
22499
|
151 (setq current-load-list (cons symbol current-load-list))
|
17334
|
152 (run-hooks 'custom-define-hook)
|
|
153 symbol)
|
|
154
|
|
155 (defmacro defcustom (symbol value doc &rest args)
|
|
156 "Declare SYMBOL as a customizable variable that defaults to VALUE.
|
|
157 DOC is the variable documentation.
|
|
158
|
|
159 Neither SYMBOL nor VALUE needs to be quoted.
|
|
160 If SYMBOL is not already bound, initialize it to VALUE.
|
|
161 The remaining arguments should have the form
|
|
162
|
25683
|
163 [KEYWORD VALUE]...
|
17334
|
164
|
22141
|
165 The following keywords are meaningful:
|
17334
|
166
|
17550
|
167 :type VALUE should be a widget type for editing the symbols value.
|
17334
|
168 :options VALUE should be a list of valid members of the widget type.
|
25683
|
169 :group VALUE should be a customization group.
|
17334
|
170 Add SYMBOL to that group.
|
22141
|
171 :initialize
|
|
172 VALUE should be a function used to initialize the
|
17550
|
173 variable. It takes two arguments, the symbol and value
|
|
174 given in the `defcustom' call. The default is
|
25683
|
175 `custom-initialize-default'
|
|
176 :set VALUE should be a function to set the value of the symbol.
|
17550
|
177 It takes two arguments, the symbol to set and the value to
|
22606
|
178 give it. The default choice of function is `custom-set-default'.
|
17550
|
179 :get VALUE should be a function to extract the value of symbol.
|
|
180 The function takes one argument, a symbol, and should return
|
22141
|
181 the current value for that symbol. The default choice of function
|
25683
|
182 is `custom-default-value'.
|
22141
|
183 :require
|
|
184 VALUE should be a feature symbol. If you save a value
|
|
185 for this option, then when your `.emacs' file loads the value,
|
|
186 it does (require VALUE) first.
|
29761
|
187 :version
|
|
188 VALUE should be a string specifying that the variable was
|
|
189 first introduced, or its default value was changed, in Emacs
|
|
190 version VERSION.
|
17334
|
191
|
17442
|
192 Read the section about customization in the Emacs Lisp manual for more
|
17334
|
193 information."
|
21703
|
194 ;; It is better not to use backquote in this file,
|
|
195 ;; because that makes a bootstrapping problem
|
|
196 ;; if you need to recompile all the Lisp files using interpreted code.
|
|
197 (nconc (list 'custom-declare-variable
|
|
198 (list 'quote symbol)
|
|
199 (list 'quote value)
|
|
200 doc)
|
|
201 args))
|
17334
|
202
|
|
203 ;;; The `defface' Macro.
|
|
204
|
|
205 (defmacro defface (face spec doc &rest args)
|
|
206 "Declare FACE as a customizable face that defaults to SPEC.
|
|
207 FACE does not need to be quoted.
|
|
208
|
|
209 Third argument DOC is the face documentation.
|
|
210
|
|
211 If FACE has been set with `custom-set-face', set the face attributes
|
|
212 as specified by that function, otherwise set the face attributes
|
|
213 according to SPEC.
|
|
214
|
|
215 The remaining arguments should have the form
|
|
216
|
|
217 [KEYWORD VALUE]...
|
|
218
|
17949
|
219 The following KEYWORDs are defined:
|
17334
|
220
|
|
221 :group VALUE should be a customization group.
|
|
222 Add FACE to that group.
|
|
223
|
|
224 SPEC should be an alist of the form ((DISPLAY ATTS)...).
|
|
225
|
17949
|
226 The first element of SPEC where the DISPLAY matches the frame
|
|
227 is the one that takes effect in that frame. The ATTRs in this
|
|
228 element take effect; the other elements are ignored, on that frame.
|
17334
|
229
|
17949
|
230 ATTS is a list of face attributes followed by their values:
|
|
231 (ATTR VALUE ATTR VALUE...)
|
24986
|
232
|
|
233 The possible attributes are `:family', `:width', `:height', `:weight',
|
|
234 `:slant', `:underline', `:overline', `:strike-through', `:box',
|
|
235 `:foreground', `:background', `:stipple', and `:inverse-video'.
|
17334
|
236
|
17949
|
237 DISPLAY can either be the symbol t, which will match all frames, or an
|
|
238 alist of the form \((REQ ITEM...)...). For the DISPLAY to match a
|
|
239 FRAME, the REQ property of the frame must match one of the ITEM. The
|
|
240 following REQ are defined:
|
17334
|
241
|
|
242 `type' (the value of `window-system')
|
25888
|
243 Under X, in addition to the values `window-system' can take,
|
|
244 `motif', `lucid' and `x-toolkit' are allowed, and match when
|
|
245 the Motif toolkit, Lucid toolkit, or any X toolkit is in use.
|
17334
|
246
|
|
247 `class' (the frame's color support)
|
|
248 Should be one of `color', `grayscale', or `mono'.
|
|
249
|
|
250 `background' (what color is used for the background text)
|
|
251 Should be one of `light' or `dark'.
|
|
252
|
17442
|
253 Read the section about customization in the Emacs Lisp manual for more
|
17334
|
254 information."
|
21703
|
255 ;; It is better not to use backquote in this file,
|
|
256 ;; because that makes a bootstrapping problem
|
|
257 ;; if you need to recompile all the Lisp files using interpreted code.
|
|
258 (nconc (list 'custom-declare-face (list 'quote face) spec doc) args))
|
17334
|
259
|
|
260 ;;; The `defgroup' Macro.
|
|
261
|
|
262 (defun custom-declare-group (symbol members doc &rest args)
|
|
263 "Like `defgroup', but SYMBOL is evaluated as a normal argument."
|
25683
|
264 (while members
|
17550
|
265 (apply 'custom-add-to-group symbol (car members))
|
|
266 (setq members (cdr members)))
|
17334
|
267 (put symbol 'custom-group (nconc members (get symbol 'custom-group)))
|
|
268 (when doc
|
26582
|
269 ;; This text doesn't get into DOC.
|
|
270 (put symbol 'group-documentation (purecopy doc)))
|
25683
|
271 (while args
|
17334
|
272 (let ((arg (car args)))
|
|
273 (setq args (cdr args))
|
|
274 (unless (symbolp arg)
|
|
275 (error "Junk in args %S" args))
|
|
276 (let ((keyword arg)
|
|
277 (value (car args)))
|
|
278 (unless args
|
|
279 (error "Keyword %s is missing an argument" keyword))
|
|
280 (setq args (cdr args))
|
|
281 (cond ((eq keyword :prefix)
|
|
282 (put symbol 'custom-prefix value))
|
|
283 (t
|
|
284 (custom-handle-keyword symbol keyword value
|
|
285 'custom-group))))))
|
|
286 (run-hooks 'custom-define-hook)
|
|
287 symbol)
|
|
288
|
|
289 (defmacro defgroup (symbol members doc &rest args)
|
|
290 "Declare SYMBOL as a customization group containing MEMBERS.
|
|
291 SYMBOL does not need to be quoted.
|
|
292
|
|
293 Third arg DOC is the group documentation.
|
|
294
|
|
295 MEMBERS should be an alist of the form ((NAME WIDGET)...) where
|
20599
|
296 NAME is a symbol and WIDGET is a widget for editing that symbol.
|
|
297 Useful widgets are `custom-variable' for editing variables,
|
17334
|
298 `custom-face' for edit faces, and `custom-group' for editing groups.
|
|
299
|
|
300 The remaining arguments should have the form
|
|
301
|
25683
|
302 [KEYWORD VALUE]...
|
17334
|
303
|
29761
|
304 The following KEYWORDs are defined:
|
17334
|
305
|
29761
|
306 :group VALUE should be a customization group.
|
|
307 Add SYMBOL to that group.
|
|
308
|
|
309 :version VALUE should be a string specifying that the group was introduced
|
|
310 in Emacs version VERSION.
|
17334
|
311
|
17442
|
312 Read the section about customization in the Emacs Lisp manual for more
|
17334
|
313 information."
|
21703
|
314 ;; It is better not to use backquote in this file,
|
|
315 ;; because that makes a bootstrapping problem
|
|
316 ;; if you need to recompile all the Lisp files using interpreted code.
|
|
317 (nconc (list 'custom-declare-group (list 'quote symbol) members doc) args))
|
17334
|
318
|
|
319 (defun custom-add-to-group (group option widget)
|
|
320 "To existing GROUP add a new OPTION of type WIDGET.
|
33025
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
diff
changeset
|
321 If there already is an entry for OPTION and WIDGET, nothing is done."
|
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
diff
changeset
|
322 (let ((members (get group 'custom-group))
|
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
diff
changeset
|
323 (entry (list option widget)))
|
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
diff
changeset
|
324 (unless (member entry members)
|
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
diff
changeset
|
325 (put group 'custom-group (nconc members (list entry))))))
|
17334
|
326
|
|
327 ;;; Properties.
|
|
328
|
|
329 (defun custom-handle-all-keywords (symbol args type)
|
|
330 "For customization option SYMBOL, handle keyword arguments ARGS.
|
|
331 Third argument TYPE is the custom option type."
|
25683
|
332 (while args
|
17334
|
333 (let ((arg (car args)))
|
|
334 (setq args (cdr args))
|
|
335 (unless (symbolp arg)
|
|
336 (error "Junk in args %S" args))
|
|
337 (let ((keyword arg)
|
|
338 (value (car args)))
|
|
339 (unless args
|
|
340 (error "Keyword %s is missing an argument" keyword))
|
|
341 (setq args (cdr args))
|
25683
|
342 (custom-handle-keyword symbol keyword value type)))))
|
17334
|
343
|
|
344 (defun custom-handle-keyword (symbol keyword value type)
|
|
345 "For customization option SYMBOL, handle KEYWORD with VALUE.
|
|
346 Fourth argument TYPE is the custom option type."
|
26582
|
347 (if purify-flag
|
|
348 (setq value (purecopy value)))
|
17334
|
349 (cond ((eq keyword :group)
|
|
350 (custom-add-to-group value symbol type))
|
20445
|
351 ((eq keyword :version)
|
|
352 (custom-add-version symbol value))
|
17334
|
353 ((eq keyword :link)
|
|
354 (custom-add-link symbol value))
|
|
355 ((eq keyword :load)
|
|
356 (custom-add-load symbol value))
|
|
357 ((eq keyword :tag)
|
|
358 (put symbol 'custom-tag value))
|
26831
|
359 ((eq keyword :set-after)
|
|
360 (custom-add-dependencies symbol value))
|
17334
|
361 (t
|
24872
|
362 (error "Unknown keyword %s" keyword))))
|
17334
|
363
|
26831
|
364 (defun custom-add-dependencies (symbol value)
|
|
365 "To the custom option SYMBOL, add dependencies specified by VALUE.
|
|
366 VALUE should be a list of symbols. For each symbol in that list,
|
|
367 this specifies that SYMBOL should be set after the specified symbol, if
|
|
368 both appear in constructs like `custom-set-variables'."
|
|
369 (unless (listp value)
|
|
370 (error "Invalid custom dependency `%s'" value))
|
|
371 (let* ((deps (get symbol 'custom-dependencies))
|
|
372 (new-deps deps))
|
|
373 (while value
|
|
374 (let ((dep (car value)))
|
|
375 (unless (symbolp dep)
|
|
376 (error "Invalid custom dependency `%s'" dep))
|
|
377 (unless (memq dep new-deps)
|
|
378 (setq new-deps (cons dep new-deps)))
|
|
379 (setq value (cdr value))))
|
|
380 (unless (eq deps new-deps)
|
|
381 (put symbol 'custom-dependencies new-deps))))
|
|
382
|
17334
|
383 (defun custom-add-option (symbol option)
|
|
384 "To the variable SYMBOL add OPTION.
|
|
385
|
|
386 If SYMBOL is a hook variable, OPTION should be a hook member.
|
|
387 For other types variables, the effect is undefined."
|
|
388 (let ((options (get symbol 'custom-options)))
|
|
389 (unless (member option options)
|
|
390 (put symbol 'custom-options (cons option options)))))
|
|
391
|
|
392 (defun custom-add-link (symbol widget)
|
|
393 "To the custom option SYMBOL add the link WIDGET."
|
|
394 (let ((links (get symbol 'custom-links)))
|
|
395 (unless (member widget links)
|
26582
|
396 (put symbol 'custom-links (cons (purecopy widget) links)))))
|
17334
|
397
|
20445
|
398 (defun custom-add-version (symbol version)
|
|
399 "To the custom option SYMBOL add the version VERSION."
|
26582
|
400 (put symbol 'custom-version (purecopy version)))
|
20445
|
401
|
17334
|
402 (defun custom-add-load (symbol load)
|
|
403 "To the custom option SYMBOL add the dependency LOAD.
|
|
404 LOAD should be either a library file name, or a feature name."
|
|
405 (let ((loads (get symbol 'custom-loads)))
|
|
406 (unless (member load loads)
|
26582
|
407 (put symbol 'custom-loads (cons (purecopy load) loads)))))
|
17334
|
408
|
|
409 ;;; Initializing.
|
|
410
|
22606
|
411 (defvar custom-local-buffer nil
|
|
412 "Non-nil, in a Customization buffer, means customize a specific buffer.
|
|
413 If this variable is non-nil, it should be a buffer,
|
|
414 and it means customize the local bindings of that buffer.
|
|
415 This variable is a permanent local, and it normally has a local binding
|
|
416 in every Customization buffer.")
|
|
417 (put 'custom-local-buffer 'permanent-local t)
|
|
418
|
17334
|
419 (defun custom-set-variables (&rest args)
|
25683
|
420 "Initialize variables according to user preferences.
|
17334
|
421
|
|
422 The arguments should be a list where each entry has the form:
|
|
423
|
25683
|
424 (SYMBOL VALUE [NOW [REQUEST [COMMENT]]])
|
17334
|
425
|
|
426 The unevaluated VALUE is stored as the saved value for SYMBOL.
|
|
427 If NOW is present and non-nil, VALUE is also evaluated and bound as
|
25683
|
428 the default value for the SYMBOL.
|
|
429 REQUEST is a list of features we must require for SYMBOL.
|
|
430 COMMENT is a comment string about SYMBOL."
|
26831
|
431 (setq args
|
|
432 (sort args
|
|
433 (lambda (a1 a2)
|
|
434 (let* ((sym1 (car a1))
|
|
435 (sym2 (car a2))
|
|
436 (1-then-2 (memq sym1 (get sym2 'custom-dependencies)))
|
|
437 (2-then-1 (memq sym2 (get sym1 'custom-dependencies))))
|
|
438 (cond ((and 1-then-2 2-then-1)
|
|
439 (error "Circular custom dependency between `%s' and `%s'"
|
|
440 sym1 sym2))
|
|
441 (2-then-1 nil)
|
|
442 (t t))))))
|
25683
|
443 (while args
|
17334
|
444 (let ((entry (car args)))
|
|
445 (if (listp entry)
|
17550
|
446 (let* ((symbol (nth 0 entry))
|
|
447 (value (nth 1 entry))
|
|
448 (now (nth 2 entry))
|
|
449 (requests (nth 3 entry))
|
25683
|
450 (comment (nth 4 entry))
|
23354
|
451 set)
|
|
452 (when requests
|
|
453 (put symbol 'custom-requests requests)
|
32225
|
454 (mapc 'require requests))
|
23354
|
455 (setq set (or (get symbol 'custom-set) 'custom-set-default))
|
17334
|
456 (put symbol 'saved-value (list value))
|
25683
|
457 (put symbol 'saved-variable-comment comment)
|
24438
|
458 ;; Allow for errors in the case where the setter has
|
31362
|
459 ;; changed between versions, say, but let the user know.
|
|
460 (condition-case data
|
24438
|
461 (cond (now
|
|
462 ;; Rogue variable, set it now.
|
|
463 (put symbol 'force-value t)
|
|
464 (funcall set symbol (eval value)))
|
|
465 ((default-boundp symbol)
|
|
466 ;; Something already set this, overwrite it.
|
|
467 (funcall set symbol (eval value))))
|
31362
|
468 (error
|
|
469 (message "Error setting %s: %s" symbol data)))
|
25683
|
470 (setq args (cdr args))
|
|
471 (and (or now (default-boundp symbol))
|
|
472 (put symbol 'variable-comment comment)))
|
17334
|
473 ;; Old format, a plist of SYMBOL VALUE pairs.
|
17415
|
474 (message "Warning: old format `custom-set-variables'")
|
|
475 (ding)
|
|
476 (sit-for 2)
|
17334
|
477 (let ((symbol (nth 0 args))
|
|
478 (value (nth 1 args)))
|
|
479 (put symbol 'saved-value (list value)))
|
|
480 (setq args (cdr (cdr args)))))))
|
|
481
|
22606
|
482 (defun custom-set-default (variable value)
|
|
483 "Default :set function for a customizable variable.
|
|
484 Normally, this sets the default value of VARIABLE to VALUE,
|
|
485 but if `custom-local-buffer' is non-nil,
|
|
486 this sets the local binding in that buffer instead."
|
|
487 (if custom-local-buffer
|
|
488 (with-current-buffer custom-local-buffer
|
|
489 (set variable value))
|
|
490 (set-default variable value)))
|
|
491
|
17334
|
492 ;;; The End.
|
|
493
|
18882
|
494 ;; Process the defcustoms for variables loaded before this file.
|
|
495 (while custom-declare-variable-list
|
|
496 (apply 'custom-declare-variable (car custom-declare-variable-list))
|
|
497 (setq custom-declare-variable-list (cdr custom-declare-variable-list)))
|
|
498
|
17334
|
499 (provide 'custom)
|
|
500
|
25683
|
501 ;;; custom.el ends here
|