;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Keywords: help, faces
-;; Version: 1.90
+;; Version: 1.9900
;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
;; This file is part of GNU Emacs.
Otherwise, VALUE will be evaluated and used as the default binding for
symbol."
(unless (default-boundp symbol)
- ;; Use the saved value if it exists, otherwise the factory setting.
+ ;; Use the saved value if it exists, otherwise the standard setting.
(set-default symbol (if (get symbol 'saved-value)
(eval (car (get symbol 'saved-value)))
(eval value)))))
(defun custom-initialize-set (symbol value)
- "Initialize SYMBOL with VALUE.
-Like `custom-initialize-default', but use the function specified by
-`:set' to initialize SYMBOL."
+ "Initialize SYMBOL based on VALUE.
+If the symbol doesn't have a default binding already,
+then set it using its `:set' function (or `set-default' if it has none).
+The value is either the value in the symbol's `saved-value' property,
+if any, or VALUE."
(unless (default-boundp symbol)
(funcall (or (get symbol 'custom-set) 'set-default)
symbol
(eval value)))))
(defun custom-initialize-reset (symbol value)
- "Initialize SYMBOL with VALUE.
-Like `custom-initialize-set', but use the function specified by
-`:get' to reinitialize SYMBOL if it is already bound."
+ "Initialize SYMBOL based on VALUE.
+Set the symbol, using its `:set' function (or `set-default' if it has none).
+The value is either the symbol's current value
+ \(as obtained using the `:get' function), if any,
+or the value in the symbol's `saved-value' property if any,
+or (last of all) VALUE."
(funcall (or (get symbol 'custom-set) 'set-default)
symbol
(cond ((default-boundp symbol)
(defun custom-initialize-changed (symbol value)
"Initialize SYMBOL with VALUE.
Like `custom-initialize-reset', but only use the `:set' function if the
-not using the factory setting. Otherwise, use the `set-default'."
+not using the standard setting.
+For the standard setting, use the `set-default'."
(cond ((default-boundp symbol)
(funcall (or (get symbol 'custom-set) 'set-default)
symbol
(t
(set-default symbol (eval value)))))
-(defun custom-declare-variable (symbol value doc &rest args)
- "Like `defcustom', but SYMBOL and VALUE are evaluated as normal arguments."
- ;; Remember the factory setting.
- (put symbol 'factory-value (list value))
+(defun custom-declare-variable (symbol default doc &rest args)
+ "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments.
+DEFAULT should be an expression to evaluate to compute the default value,
+not the default value itself."
+ ;; Remember the standard setting.
+ (put symbol 'standard-value (list default))
;; Maybe this option was rogue in an earlier version. It no longer is.
(when (get symbol 'force-value)
;; It no longer is.
(put symbol 'force-value nil))
(when doc
(put symbol 'variable-documentation doc))
- (let ((initialize 'custom-initialize-set)
+ (let ((initialize 'custom-initialize-reset)
(requests nil))
(while args
(let ((arg (car args)))
((eq keyword :get)
(put symbol 'custom-get value))
((eq keyword :require)
- (push value requests))
+ (setq requests (cons value requests)))
((eq keyword :type)
(put symbol 'custom-type value))
((eq keyword :options)
'custom-variable))))))
(put symbol 'custom-requests requests)
;; Do the actual initialization.
- (funcall initialize symbol value))
+ (funcall initialize symbol default))
(run-hooks 'custom-define-hook)
symbol)
Read the section about customization in the Emacs Lisp manual for more
information."
- `(eval-and-compile
- (custom-declare-variable (quote ,symbol) (quote ,value) ,doc ,@args)))
+ ;; It is better not to use backquote in this file,
+ ;; because that makes a bootstrapping problem
+ ;; if you need to recompile all the Lisp files using interpreted code.
+ (nconc (list 'custom-declare-variable
+ (list 'quote symbol)
+ (list 'quote value)
+ doc)
+ args))
;;; The `defface' Macro.
[KEYWORD VALUE]...
-The following KEYWORD's are defined:
+The following KEYWORDs are defined:
:group VALUE should be a customization group.
Add FACE to that group.
SPEC should be an alist of the form ((DISPLAY ATTS)...).
-ATTS is a list of face attributes and their values. The possible
-attributes are defined in the variable `custom-face-attributes'.
-Alternatively, ATTS can be a face in which case the attributes of that
-face is used.
+The first element of SPEC where the DISPLAY matches the frame
+is the one that takes effect in that frame. The ATTRs in this
+element take effect; the other elements are ignored, on that frame.
-The ATTS of the first entry in SPEC where the DISPLAY matches the
-frame should take effect in that frame. DISPLAY can either be the
-symbol t, which will match all frames, or an alist of the form
-\((REQ ITEM...)...)
+ATTS is a list of face attributes followed by their values:
+ (ATTR VALUE ATTR VALUE...)
+The possible attributes are `:bold', `:italic', `:underline',
+`:foreground', `:background', `:stipple' and `:inverse-video'.
-For the DISPLAY to match a FRAME, the REQ property of the frame must
-match one of the ITEM. The following REQ are defined:
+DISPLAY can either be the symbol t, which will match all frames, or an
+alist of the form \((REQ ITEM...)...). For the DISPLAY to match a
+FRAME, the REQ property of the frame must match one of the ITEM. The
+following REQ are defined:
`type' (the value of `window-system')
Should be one of `x' or `tty'.
Read the section about customization in the Emacs Lisp manual for more
information."
- `(custom-declare-face (quote ,face) ,spec ,doc ,@args))
+ ;; It is better not to use backquote in this file,
+ ;; because that makes a bootstrapping problem
+ ;; if you need to recompile all the Lisp files using interpreted code.
+ (nconc (list 'custom-declare-face (list 'quote face) spec doc) args))
;;; The `defgroup' Macro.
Third arg DOC is the group documentation.
MEMBERS should be an alist of the form ((NAME WIDGET)...) where
-NAME is a symbol and WIDGET is a widget is a widget for editing that
-symbol. Useful widgets are `custom-variable' for editing variables,
+NAME is a symbol and WIDGET is a widget for editing that symbol.
+Useful widgets are `custom-variable' for editing variables,
`custom-face' for edit faces, and `custom-group' for editing groups.
The remaining arguments should have the form
Read the section about customization in the Emacs Lisp manual for more
information."
- `(custom-declare-group (quote ,symbol) ,members ,doc ,@args))
+ ;; It is better not to use backquote in this file,
+ ;; because that makes a bootstrapping problem
+ ;; if you need to recompile all the Lisp files using interpreted code.
+ (nconc (list 'custom-declare-group (list 'quote symbol) members doc) args))
(defun custom-add-to-group (group option widget)
"To existing GROUP add a new OPTION of type WIDGET.
Fourth argument TYPE is the custom option type."
(cond ((eq keyword :group)
(custom-add-to-group value symbol type))
+ ((eq keyword :version)
+ (custom-add-version symbol value))
((eq keyword :link)
(custom-add-link symbol value))
((eq keyword :load)
(unless (member widget links)
(put symbol 'custom-links (cons widget links)))))
+(defun custom-add-version (symbol version)
+ "To the custom option SYMBOL add the version VERSION."
+ (put symbol 'custom-version version))
+
(defun custom-add-load (symbol load)
"To the custom option SYMBOL add the dependency LOAD.
LOAD should be either a library file name, or a feature name."
;;; The End.
+;; Process the defcustoms for variables loaded before this file.
+(while custom-declare-variable-list
+ (apply 'custom-declare-variable (car custom-declare-variable-list))
+ (setq custom-declare-variable-list (cdr custom-declare-variable-list)))
+
(provide 'custom)
;; custom.el ends here