;;; custom.el --- tools for declaring and initializing options
;;
-;; Copyright (C) 1996-1997, 1999, 2001-2015 Free Software Foundation,
+;; Copyright (C) 1996-1997, 1999, 2001-2016 Free Software Foundation,
;; Inc.
;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
(while args
(let ((keyword (pop args)))
(unless (symbolp keyword)
- (error "Junk in args %S" (cons keyword args)))
+ (error "Junk in args %S" args))
(unless args
(error "Keyword %s is missing an argument" keyword))
(let ((value (pop args)))
- (pcase keyword
- (`:initialize (setq initialize value))
- (`:set (put symbol 'custom-set value))
- (`:get (put symbol 'custom-get value))
- (`:require (push value requests))
- (`:risky (put symbol 'risky-local-variable value))
- (`:safe (put symbol 'safe-local-variable value))
- (`:type (put symbol 'custom-type (purecopy value)))
- (`:options (if (get symbol 'custom-options)
- ;; Slow safe code to avoid duplicates.
- (mapc (lambda (option)
- (custom-add-option symbol option))
- value)
- ;; Fast code for the common case.
- (put symbol 'custom-options (copy-sequence value))))
- (_ (custom-handle-keyword symbol keyword value
- 'custom-variable))))))
+ ;; Can't use `pcase' because it is loaded after `custom.el'
+ ;; during bootstrap. See `loadup.el'.
+ (cond ((eq keyword :initialize)
+ (setq initialize value))
+ ((eq keyword :set)
+ (put symbol 'custom-set value))
+ ((eq keyword :get)
+ (put symbol 'custom-get value))
+ ((eq keyword :require)
+ (push value requests))
+ ((eq keyword :risky)
+ (put symbol 'risky-local-variable value))
+ ((eq keyword :safe)
+ (put symbol 'safe-local-variable value))
+ ((eq keyword :type)
+ (put symbol 'custom-type (purecopy value)))
+ ((eq keyword :options)
+ (if (get symbol 'custom-options)
+ ;; Slow safe code to avoid duplicates.
+ (mapc (lambda (option)
+ (custom-add-option symbol option))
+ value)
+ ;; Fast code for the common case.
+ (put symbol 'custom-options (copy-sequence value))))
+ (t
+ (custom-handle-keyword symbol keyword value
+ 'custom-variable))))))
(put symbol 'custom-requests requests)
;; Do the actual initialization.
(unless custom-dont-initialize
The following keywords are meaningful:
:type VALUE should be a widget type for editing the symbol's value.
+ Every `defcustom' should specify a value for this keyword.
:options VALUE should be a list of valid members of the widget type.
:initialize
VALUE should be a function used to initialize the
See Info node `(elisp) Faces' in the Emacs Lisp manual for more
information."
- (declare (doc-string 3)
- (indent 1))
+ (declare (doc-string 3))
;; 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.
MEMBERS should be an alist of the form ((NAME WIDGET)...) where
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.
+`custom-face' for editing faces, and `custom-group' for editing groups.
The remaining arguments should have the form