18
|
1 ;;; custom.el -- Tools for declaring and initializing options.
|
|
2 ;;
|
|
3 ;; Copyright (C) 1996 Free Software Foundation, Inc.
|
|
4 ;;
|
|
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
|
|
6 ;; Keywords: help, faces
|
20
|
7 ;; Version: 1.30
|
18
|
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
|
|
9
|
|
10 ;;; Commentary:
|
|
11 ;;
|
|
12 ;; If you want to use this code, please visit the URL above.
|
|
13 ;;
|
|
14 ;; This file only contain the code needed to declare and initialize
|
|
15 ;; user options. The code to customize options is autoloaded from
|
|
16 ;; `custom-edit.el'.
|
|
17
|
|
18 ;;; Code:
|
|
19
|
|
20 (require 'widget)
|
|
21
|
|
22 (define-widget-keywords :prefix :tag :load :link :options :type :group)
|
|
23
|
|
24 ;; These autoloads should be deleted when the file is added to Emacs
|
20
|
25 (unless (fboundp 'load-gc)
|
|
26 (autoload 'customize "custom-edit" nil t)
|
|
27 (autoload 'customize-variable "custom-edit" nil t)
|
|
28 (autoload 'customize-face "custom-edit" nil t)
|
|
29 (autoload 'customize-apropos "custom-edit" nil t)
|
|
30 (autoload 'customize-customized "custom-edit" nil t)
|
|
31 (autoload 'custom-buffer-create "custom-edit")
|
|
32 (autoload 'custom-menu-update "custom-edit")
|
|
33 (autoload 'custom-make-dependencies "custom-edit"))
|
18
|
34
|
|
35 ;;; Compatibility.
|
|
36
|
|
37 (unless (fboundp 'x-color-values)
|
|
38 ;; Emacs function missing in XEmacs 19.14.
|
|
39 (defun x-color-values (color)
|
|
40 "Return a description of the color named COLOR on frame FRAME.
|
|
41 The value is a list of integer RGB values--(RED GREEN BLUE).
|
|
42 These values appear to range from 0 to 65280 or 65535, depending
|
|
43 on the system; white is (65280 65280 65280) or (65535 65535 65535).
|
|
44 If FRAME is omitted or nil, use the selected frame."
|
|
45 (color-instance-rgb-components (make-color-instance color))))
|
|
46
|
|
47 (unless (fboundp 'frame-property)
|
|
48 ;; XEmacs function missing in Emacs 19.34.
|
|
49 (defun frame-property (frame property &optional default)
|
|
50 "Return FRAME's value for property PROPERTY."
|
|
51 (or (cdr (assq property (frame-parameters frame)))
|
|
52 default)))
|
|
53
|
|
54 (defun custom-background-mode ()
|
|
55 "Kludge to detext background mode."
|
|
56 (let* ((bg-resource
|
|
57 (condition-case ()
|
|
58 (x-get-resource ".backgroundMode" "BackgroundMode" 'string)
|
|
59 (error nil)))
|
|
60 color
|
|
61 (mode (cond (bg-resource
|
|
62 (intern (downcase bg-resource)))
|
|
63 ((and (setq color (condition-case ()
|
|
64 (or (frame-property
|
|
65 (selected-frame)
|
|
66 'background-color)
|
|
67 (color-instance-name
|
|
68 (specifier-instance
|
|
69 (face-background 'default))))
|
|
70 (error nil)))
|
|
71 (< (apply '+ (x-color-values color))
|
|
72 (/ (apply '+ (x-color-values "white"))
|
|
73 3)))
|
|
74 'dark)
|
|
75 (t 'light))))
|
|
76 (modify-frame-parameters (selected-frame)
|
|
77 (list (cons 'background-mode mode)))
|
|
78 mode))
|
|
79
|
|
80 ;; XEmacs and Emacs have different definitions of `facep'.
|
|
81 ;; The Emacs definition is the useful one, so emulate that.
|
|
82 (cond ((not (fboundp 'facep))
|
|
83 (defun custom-facep (face)
|
|
84 "No faces"
|
|
85 nil))
|
|
86 ((string-match "XEmacs" emacs-version)
|
|
87 (defun custom-facep (face)
|
|
88 "Face symbol or object."
|
|
89 (or (facep face)
|
|
90 (find-face face))))
|
|
91 (t
|
|
92 (defalias 'custom-facep 'facep)))
|
|
93
|
|
94 ;;; The `defcustom' Macro.
|
|
95
|
20
|
96 ;;; Don't ;;;###autoload
|
18
|
97 (defun custom-declare-variable (symbol value doc &rest args)
|
|
98 "Like `defcustom', but SYMBOL and VALUE are evaluated as notmal arguments."
|
|
99 (unless (and (default-boundp symbol)
|
|
100 (not (get symbol 'saved-value)))
|
|
101 (set-default symbol (if (get symbol 'saved-value)
|
|
102 (eval (car (get symbol 'saved-value)))
|
|
103 (eval value))))
|
|
104 (put symbol 'factory-value (list value))
|
|
105 (when doc
|
|
106 (put symbol 'variable-documentation doc))
|
|
107 (while args
|
|
108 (let ((arg (car args)))
|
|
109 (setq args (cdr args))
|
|
110 (unless (symbolp arg)
|
|
111 (error "Junk in args %S" args))
|
|
112 (let ((keyword arg)
|
|
113 (value (car args)))
|
|
114 (unless args
|
|
115 (error "Keyword %s is missing an argument" keyword))
|
|
116 (setq args (cdr args))
|
|
117 (cond ((eq keyword :type)
|
|
118 (put symbol 'custom-type value))
|
|
119 ((eq keyword :options)
|
|
120 (if (get symbol 'custom-options)
|
|
121 ;; Slow safe code to avoid duplicates.
|
|
122 (mapcar (lambda (option)
|
|
123 (custom-add-option symbol option))
|
|
124 value)
|
|
125 ;; Fast code for the common case.
|
|
126 (put symbol 'custom-options (copy-list value))))
|
|
127 (t
|
|
128 (custom-handle-keyword symbol keyword value
|
|
129 'custom-variable))))))
|
|
130 (run-hooks 'custom-define-hook)
|
|
131 symbol)
|
|
132
|
20
|
133 ;;; Don't ;;;###autoload
|
18
|
134 (defmacro defcustom (symbol value doc &rest args)
|
|
135 "Declare SYMBOL as a customizable variable that defaults to VALUE.
|
|
136 DOC is the variable documentation.
|
|
137
|
|
138 Neither SYMBOL nor VALUE needs to be quoted.
|
|
139 If SYMBOL is not already bound, initialize it to VALUE.
|
|
140 The remaining arguments should have the form
|
|
141
|
|
142 [KEYWORD VALUE]...
|
|
143
|
|
144 The following KEYWORD's are defined:
|
|
145
|
|
146 :type VALUE should be a widget type.
|
|
147 :options VALUE should be a list of valid members of the widget type.
|
|
148 :group VALUE should be a customization group.
|
|
149 Add SYMBOL to that group.
|
|
150
|
|
151 Read the section about customization in the emacs lisp manual for more
|
|
152 information."
|
|
153 `(eval-and-compile
|
|
154 (custom-declare-variable (quote ,symbol) (quote ,value) ,doc ,@args)))
|
|
155
|
|
156 ;;; The `defface' Macro.
|
|
157
|
20
|
158 ;;; Don't ;;;###autoload
|
18
|
159 (defun custom-declare-face (face spec doc &rest args)
|
|
160 "Like `defface', but FACE is evaluated as a normal argument."
|
|
161 (put face 'factory-face spec)
|
|
162 (when (fboundp 'facep)
|
|
163 (unless (and (custom-facep face)
|
|
164 (not (get face 'saved-face)))
|
|
165 ;; If the user has already created the face, respect that.
|
|
166 (let ((value (or (get face 'saved-face) spec)))
|
|
167 (custom-face-display-set face value))))
|
|
168 (when doc
|
|
169 (put face 'face-documentation doc))
|
|
170 (custom-handle-all-keywords face args 'custom-face)
|
|
171 (run-hooks 'custom-define-hook)
|
|
172 face)
|
|
173
|
20
|
174 ;;; Don't ;;;###autoload
|
18
|
175 (defmacro defface (face spec doc &rest args)
|
|
176 "Declare FACE as a customizable face that defaults to SPEC.
|
|
177 FACE does not need to be quoted.
|
|
178
|
|
179 Third argument DOC is the face documentation.
|
|
180
|
|
181 If FACE has been set with `custom-set-face', set the face attributes
|
|
182 as specified by that function, otherwise set the face attributes
|
|
183 according to SPEC.
|
|
184
|
|
185 The remaining arguments should have the form
|
|
186
|
|
187 [KEYWORD VALUE]...
|
|
188
|
|
189 The following KEYWORD's are defined:
|
|
190
|
|
191 :group VALUE should be a customization group.
|
|
192 Add FACE to that group.
|
|
193
|
|
194 SPEC should be an alist of the form ((DISPLAY ATTS)...).
|
|
195
|
|
196 ATTS is a list of face attributes and their values. The possible
|
|
197 attributes are defined in the variable `custom-face-attributes'.
|
|
198 Alternatively, ATTS can be a face in which case the attributes of that
|
|
199 face is used.
|
|
200
|
|
201 The ATTS of the first entry in SPEC where the DISPLAY matches the
|
|
202 frame should take effect in that frame. DISPLAY can either be the
|
|
203 symbol `t', which will match all frames, or an alist of the form
|
|
204 \((REQ ITEM...)...)
|
|
205
|
|
206 For the DISPLAY to match a FRAME, the REQ property of the frame must
|
|
207 match one of the ITEM. The following REQ are defined:
|
|
208
|
|
209 `type' (the value of (window-system))
|
|
210 Should be one of `x' or `tty'.
|
|
211
|
|
212 `class' (the frame's color support)
|
|
213 Should be one of `color', `grayscale', or `mono'.
|
|
214
|
|
215 `background' (what color is used for the background text)
|
|
216 Should be one of `light' or `dark'.
|
|
217
|
|
218 Read the section about customization in the emacs lisp manual for more
|
|
219 information."
|
|
220 `(custom-declare-face (quote ,face) ,spec ,doc ,@args))
|
|
221
|
|
222 ;;; The `defgroup' Macro.
|
|
223
|
20
|
224 ;;; Don't ;;;###autoload
|
18
|
225 (defun custom-declare-group (symbol members doc &rest args)
|
|
226 "Like `defgroup', but SYMBOL is evaluated as a normal argument."
|
|
227 (put symbol 'custom-group (nconc members (get symbol 'custom-group)))
|
|
228 (when doc
|
|
229 (put symbol 'group-documentation doc))
|
|
230 (while args
|
|
231 (let ((arg (car args)))
|
|
232 (setq args (cdr args))
|
|
233 (unless (symbolp arg)
|
|
234 (error "Junk in args %S" args))
|
|
235 (let ((keyword arg)
|
|
236 (value (car args)))
|
|
237 (unless args
|
|
238 (error "Keyword %s is missing an argument" keyword))
|
|
239 (setq args (cdr args))
|
|
240 (cond ((eq keyword :prefix)
|
|
241 (put symbol 'custom-prefix value))
|
|
242 (t
|
|
243 (custom-handle-keyword symbol keyword value
|
|
244 'custom-group))))))
|
|
245 (run-hooks 'custom-define-hook)
|
|
246 symbol)
|
|
247
|
20
|
248 ;;; Don't ;;;###autoload
|
18
|
249 (defmacro defgroup (symbol members doc &rest args)
|
|
250 "Declare SYMBOL as a customization group containing MEMBERS.
|
|
251 SYMBOL does not need to be quoted.
|
|
252
|
|
253 Third arg DOC is the group documentation.
|
|
254
|
|
255 MEMBERS should be an alist of the form ((NAME WIDGET)...) where
|
|
256 NAME is a symbol and WIDGET is a widget is a widget for editing that
|
|
257 symbol. Useful widgets are `custom-variable' for editing variables,
|
|
258 `custom-face' for edit faces, and `custom-group' for editing groups.
|
|
259
|
|
260 The remaining arguments should have the form
|
|
261
|
|
262 [KEYWORD VALUE]...
|
|
263
|
|
264 The following KEYWORD's are defined:
|
|
265
|
|
266 :group VALUE should be a customization group.
|
|
267 Add SYMBOL to that group.
|
|
268
|
|
269 Read the section about customization in the emacs lisp manual for more
|
|
270 information."
|
|
271 `(custom-declare-group (quote ,symbol) ,members ,doc ,@args))
|
|
272
|
20
|
273 ;;; Don't ;;;###autoload
|
18
|
274 (defun custom-add-to-group (group option widget)
|
|
275 "To existing GROUP add a new OPTION of type WIDGET,
|
|
276 If there already is an entry for that option, overwrite it."
|
|
277 (let* ((members (get group 'custom-group))
|
|
278 (old (assq option members)))
|
|
279 (if old
|
|
280 (setcar (cdr old) widget)
|
|
281 (put group 'custom-group (nconc members (list (list option widget)))))))
|
|
282
|
|
283 ;;; Properties.
|
|
284
|
|
285 (defun custom-handle-all-keywords (symbol args type)
|
|
286 "For customization option SYMBOL, handle keyword arguments ARGS.
|
|
287 Third argument TYPE is the custom option type."
|
|
288 (while args
|
|
289 (let ((arg (car args)))
|
|
290 (setq args (cdr args))
|
|
291 (unless (symbolp arg)
|
|
292 (error "Junk in args %S" args))
|
|
293 (let ((keyword arg)
|
|
294 (value (car args)))
|
|
295 (unless args
|
|
296 (error "Keyword %s is missing an argument" keyword))
|
|
297 (setq args (cdr args))
|
|
298 (custom-handle-keyword symbol keyword value type)))))
|
|
299
|
|
300 (defun custom-handle-keyword (symbol keyword value type)
|
|
301 "For customization option SYMBOL, handle KEYWORD with VALUE.
|
|
302 Fourth argument TYPE is the custom option type."
|
|
303 (cond ((eq keyword :group)
|
|
304 (custom-add-to-group value symbol type))
|
|
305 ((eq keyword :link)
|
|
306 (custom-add-link symbol value))
|
|
307 ((eq keyword :load)
|
|
308 (custom-add-load symbol value))
|
|
309 ((eq keyword :tag)
|
|
310 (put symbol 'custom-tag value))
|
|
311 (t
|
|
312 (error "Unknown keyword %s" symbol))))
|
|
313
|
|
314 (defun custom-add-option (symbol option)
|
|
315 "To the variable SYMBOL add OPTION.
|
|
316
|
|
317 If SYMBOL is a hook variable, OPTION should be a hook member.
|
|
318 For other types variables, the effect is undefined."
|
|
319 (let ((options (get symbol 'custom-options)))
|
|
320 (unless (member option options)
|
|
321 (put symbol 'custom-options (cons option options)))))
|
|
322
|
|
323 (defun custom-add-link (symbol widget)
|
|
324 "To the custom option SYMBOL add the link WIDGET."
|
|
325 (let ((links (get symbol 'custom-links)))
|
|
326 (unless (member widget links)
|
|
327 (put symbol 'custom-links (cons widget links)))))
|
|
328
|
|
329 (defun custom-add-load (symbol load)
|
|
330 "To the custom option SYMBOL add the dependency LOAD.
|
|
331 LOAD should be either a library file name, or a feature name."
|
|
332 (let ((loads (get symbol 'custom-loads)))
|
|
333 (unless (member load loads)
|
|
334 (put symbol 'custom-loads (cons load loads)))))
|
|
335
|
|
336 ;;; Face Utilities.
|
|
337
|
|
338 (and (fboundp 'make-face)
|
|
339 (make-face 'custom-face-empty))
|
|
340
|
|
341 (defun custom-face-display-set (face spec &optional frame)
|
|
342 "Set FACE to the attributes to the first matching entry in SPEC.
|
|
343 Iff optional FRAME is non-nil, set it for that frame only.
|
|
344 See `defface' for information about SPEC."
|
|
345 (when (fboundp 'copy-face)
|
|
346 (copy-face 'custom-face-empty face)
|
|
347 (while spec
|
|
348 (let* ((entry (car spec))
|
|
349 (display (nth 0 entry))
|
|
350 (atts (nth 1 entry)))
|
|
351 (setq spec (cdr spec))
|
|
352 (when (custom-display-match-frame display frame)
|
|
353 (apply 'custom-face-attribites-set face frame atts)
|
|
354 (setq spec nil))))))
|
|
355
|
|
356 (defcustom custom-background-mode nil
|
|
357 "The brightness of the background.
|
|
358 Set this to the symbol dark if your background color is dark, light if
|
|
359 your background is light, or nil (default) if you want Emacs to
|
|
360 examine the brightness for you."
|
|
361 :group 'customize
|
|
362 :type '(choice (choice-item dark)
|
|
363 (choice-item light)
|
|
364 (choice-item :tag "default" nil)))
|
|
365
|
|
366 (defun custom-display-match-frame (display frame)
|
|
367 "Non-nil iff DISPLAY matches FRAME.
|
|
368 If FRAME is nil, the current FRAME is used."
|
|
369 ;; This is a kludge to get started, we really should use specifiers!
|
|
370 (unless frame
|
|
371 (setq frame (selected-frame)))
|
|
372 (if (eq display t)
|
|
373 t
|
|
374 (let ((match t))
|
|
375 (while (and display match)
|
|
376 (let* ((entry (car display))
|
|
377 (req (car entry))
|
|
378 (options (cdr entry)))
|
|
379 (setq display (cdr display))
|
|
380 (cond ((eq req 'type)
|
|
381 (let ((type (if (fboundp 'device-type)
|
|
382 (device-type (frame-device frame))
|
|
383 window-system)))
|
|
384 (setq match (memq type options))))
|
|
385 ((eq req 'class)
|
|
386 (let ((class (if (fboundp 'device-class)
|
|
387 (device-class (frame-device frame))
|
|
388 (frame-property frame 'display-type))))
|
|
389 (setq match (memq class options))))
|
|
390 ((eq req 'background)
|
|
391 (let ((background (or custom-background-mode
|
|
392 (frame-property frame 'background-mode)
|
|
393 (custom-background-mode))))
|
|
394 (setq match (memq background options))))
|
|
395 (t
|
|
396 (error "Unknown req `%S' with options `%S'" req options)))))
|
|
397 match)))
|
|
398
|
|
399 (defconst custom-face-attributes
|
20
|
400 '((:bold (toggle :format "Bold: %[%v%]\n") custom-set-face-bold)
|
|
401 (:italic (toggle :format "Italic: %[%v%]\n") custom-set-face-italic)
|
18
|
402 (:underline
|
20
|
403 (toggle :format "Underline: %[%v%]\n") set-face-underline-p)
|
18
|
404 (:foreground (color :tag "Foreground") set-face-foreground)
|
|
405 (:background (color :tag "Background") set-face-background)
|
|
406 (:stipple (editable-field :format "Stipple: %v") set-face-stipple))
|
|
407 "Alist of face attributes.
|
|
408
|
|
409 The elements are of the form (KEY TYPE SET) where KEY is a symbol
|
|
410 identifying the attribute, TYPE is a widget type for editing the
|
|
411 attibute, SET is a function for setting the attribute value.
|
|
412
|
|
413 The SET function should take three arguments, the face to modify, the
|
|
414 value of the attribute, and optionally the frame where the face should
|
|
415 be changed.")
|
|
416
|
|
417 (when (string-match "XEmacs" emacs-version)
|
|
418 ;; Support for special XEmacs font attributes.
|
|
419 (require 'font)
|
|
420
|
|
421 (unless (fboundp 'face-font-name)
|
|
422 (defun face-font-name (face &rest args)
|
|
423 (apply 'face-font face args)))
|
|
424
|
|
425 (defun set-face-font-size (face size &rest args)
|
|
426 "Set the font of FACE to SIZE"
|
|
427 (let* ((font (apply 'face-font-name face args))
|
|
428 (fontobj (font-create-object font)))
|
|
429 (set-font-size fontobj size)
|
|
430 (apply 'set-face-font face fontobj args)))
|
|
431
|
|
432 (defun set-face-font-family (face family &rest args)
|
|
433 "Set the font of FACE to FAMILY"
|
|
434 (let* ((font (apply 'face-font-name face args))
|
|
435 (fontobj (font-create-object font)))
|
|
436 (set-font-family fontobj family)
|
|
437 (apply 'set-face-font face fontobj args)))
|
|
438
|
|
439 (nconc custom-face-attributes
|
|
440 '((:family (editable-field :format "Family: %v")
|
|
441 set-face-font-family)
|
|
442 (:size (editable-field :format "Size: %v")
|
|
443 set-face-font-size))))
|
|
444
|
|
445 (defun custom-face-attribites-set (face frame &rest atts)
|
|
446 "For FACE on FRAME set the attributes [KEYWORD VALUE]....
|
|
447 Each keyword should be listed in `custom-face-attributes'.
|
|
448
|
|
449 If FRAME is nil, set the default face."
|
|
450 (while atts
|
|
451 (let* ((name (nth 0 atts))
|
|
452 (value (nth 1 atts))
|
|
453 (fun (nth 2 (assq name custom-face-attributes))))
|
|
454 (setq atts (cdr (cdr atts)))
|
|
455 (condition-case nil
|
|
456 (funcall fun face value)
|
|
457 (error nil)))))
|
|
458
|
|
459 (defun custom-set-face-bold (face value &optional frame)
|
|
460 "Set the bold property of FACE to VALUE."
|
|
461 (if value
|
|
462 (make-face-bold face frame)
|
|
463 (make-face-unbold face frame)))
|
|
464
|
|
465 (defun custom-set-face-italic (face value &optional frame)
|
|
466 "Set the italic property of FACE to VALUE."
|
|
467 (if value
|
|
468 (make-face-italic face frame)
|
|
469 (make-face-unitalic face frame)))
|
|
470
|
20
|
471 ;;; Don't ;;;###autoload
|
18
|
472 (defun custom-initialize-faces (&optional frame)
|
|
473 "Initialize all custom faces for FRAME.
|
|
474 If FRAME is nil or omitted, initialize them for all frames."
|
|
475 (mapatoms (lambda (symbol)
|
|
476 (let ((spec (or (get symbol 'saved-face)
|
|
477 (get symbol 'factory-face))))
|
|
478 (when spec
|
|
479 (custom-face-display-set symbol spec frame))))))
|
|
480
|
|
481 ;;; Initializing.
|
|
482
|
20
|
483 ;;; Don't ;;;###autoload
|
18
|
484 (defun custom-set-variables (&rest args)
|
|
485 "Initialize variables according to user preferences.
|
|
486
|
|
487 The arguments should be a list where each entry has the form:
|
|
488
|
|
489 (SYMBOL VALUE [NOW])
|
|
490
|
|
491 The unevaluated VALUE is stored as the saved value for SYMBOL.
|
|
492 If NOW is present and non-nil, VALUE is also evaluated and bound as
|
|
493 the default value for the SYMBOL."
|
|
494 (while args
|
|
495 (let ((entry (car args)))
|
|
496 (if (listp entry)
|
|
497 (let ((symbol (nth 0 entry))
|
|
498 (value (nth 1 entry))
|
|
499 (now (nth 2 entry)))
|
|
500 (put symbol 'saved-value (list value))
|
|
501 (when now
|
|
502 (put symbol 'force-value t)
|
|
503 (set-default symbol (eval value)))
|
|
504 (setq args (cdr args)))
|
|
505 ;; Old format, a plist of SYMBOL VALUE pairs.
|
|
506 (let ((symbol (nth 0 args))
|
|
507 (value (nth 1 args)))
|
|
508 (put symbol 'saved-value (list value)))
|
|
509 (setq args (cdr (cdr args)))))))
|
|
510
|
20
|
511 ;;; Don't ;;;###autoload
|
18
|
512 (defun custom-set-faces (&rest args)
|
|
513 "Initialize faces according to user preferences.
|
|
514 The arguments should be a list where each entry has the form:
|
|
515
|
|
516 (FACE SPEC [NOW])
|
|
517
|
|
518 SPEC will be stored as the saved value for FACE. If NOW is present
|
|
519 and non-nil, FACE will also be created according to SPEC.
|
|
520
|
|
521 See `defface' for the format of SPEC."
|
|
522 (while args
|
|
523 (let ((entry (car args)))
|
|
524 (if (listp entry)
|
|
525 (let ((face (nth 0 entry))
|
|
526 (spec (nth 1 entry))
|
|
527 (now (nth 2 entry)))
|
|
528 (put face 'saved-face spec)
|
|
529 (when now
|
|
530 (put face 'force-face t)
|
|
531 (custom-face-display-set face spec))
|
|
532 (setq args (cdr args)))
|
|
533 ;; Old format, a plist of FACE SPEC pairs.
|
|
534 (let ((face (nth 0 args))
|
|
535 (spec (nth 1 args)))
|
|
536 (put face 'saved-face spec))
|
|
537 (setq args (cdr (cdr args)))))))
|
|
538
|
|
539 ;;; Meta Customization
|
|
540
|
|
541 (defgroup emacs nil
|
|
542 "Customization of the One True Editor."
|
|
543 :link '(custom-manual "(emacs)Top"))
|
|
544
|
|
545 (defgroup customize '((widgets custom-group))
|
|
546 "Customization of the Customization support."
|
|
547 :link '(custom-manual "(custom)Top")
|
|
548 :link '(url-link :tag "Development Page"
|
|
549 "http://www.dina.kvl.dk/~abraham/custom/")
|
|
550 :prefix "custom-"
|
|
551 :group 'emacs)
|
|
552
|
|
553 (defcustom custom-define-hook nil
|
|
554 "Hook called after defining each customize option."
|
|
555 :group 'customize
|
|
556 :type 'hook)
|
|
557
|
|
558 ;;; Menu support
|
|
559
|
|
560 (defconst custom-help-menu '("Customize"
|
|
561 ["Update menu..." custom-menu-update t]
|
|
562 ["Group..." customize t]
|
|
563 ["Variable..." customize-variable t]
|
|
564 ["Face..." customize-face t]
|
|
565 ["Saved..." customize-customized t]
|
|
566 ["Apropos..." customize-apropos t])
|
|
567 "Customize menu")
|
|
568
|
|
569 (defun custom-menu-reset ()
|
|
570 "Reset customize menu."
|
|
571 (remove-hook 'custom-define-hook 'custom-menu-reset)
|
|
572 (cond ((fboundp 'add-submenu)
|
|
573 ;; XEmacs with menus.
|
|
574 (add-submenu '("Help") custom-help-menu))
|
|
575 ((string-match "XEmacs" emacs-version)
|
|
576 ;; XEmacs without menus.
|
|
577 )
|
|
578 (t
|
|
579 ;; Emacs.
|
|
580 (define-key global-map [menu-bar help-menu customize-menu]
|
|
581 (cons (car custom-help-menu)
|
|
582 (easy-menu-create-keymaps (car custom-help-menu)
|
|
583 (cdr custom-help-menu)))))))
|
|
584
|
20
|
585 (unless (fboundp 'load-gc)
|
|
586 (custom-menu-reset))
|
18
|
587
|
|
588 ;;; The End.
|
|
589
|
|
590 (provide 'custom)
|
|
591
|
|
592 ;; custom.el ends here
|