aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-11-18 01:35:12 +0000
committerStefan Monnier2001-11-18 01:35:12 +0000
commitd3b80e9b70eaa0edb4cfc0d91543c41929fa70c0 (patch)
treeb84c77e168b70e27a5eda02d04880535b4a7a484
parentddf6b836f52ae7f42dd1fbc8157dc0c219e6a3db (diff)
downloademacs-d3b80e9b70eaa0edb4cfc0d91543c41929fa70c0.tar.gz
emacs-d3b80e9b70eaa0edb4cfc0d91543c41929fa70c0.zip
(custom-current-group-alist): New var.
(custom-declare-group): Set it. (custom-current-group): New fun. (custom-declare-variable, custom-handle-all-keywords): Use it as a default if no :group argument is specified.
-rw-r--r--lisp/custom.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index f8dd28fc386..14fa62d1854 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -39,6 +39,9 @@
39 ;; Customize information for this option is in `cus-edit.el'. 39 ;; Customize information for this option is in `cus-edit.el'.
40 "Hook called after defining each customize option.") 40 "Hook called after defining each customize option.")
41 41
42(defvar custom-current-group-alist nil
43 "Alist of (FILE . GROUP) indicating the current group to use for FILE.")
44
42;;; The `defcustom' Macro. 45;;; The `defcustom' Macro.
43 46
44(defun custom-initialize-default (symbol value) 47(defun custom-initialize-default (symbol value)
@@ -114,6 +117,8 @@ not the default value itself."
114 (put symbol 'variable-documentation doc)) 117 (put symbol 'variable-documentation doc))
115 (let ((initialize 'custom-initialize-reset) 118 (let ((initialize 'custom-initialize-reset)
116 (requests nil)) 119 (requests nil))
120 (unless (memq :group args)
121 (custom-add-to-group (custom-current-group) symbol 'custom-variable))
117 (while args 122 (while args
118 (let ((arg (car args))) 123 (let ((arg (car args)))
119 (setq args (cdr args)) 124 (setq args (cdr args))
@@ -262,6 +267,9 @@ information."
262 267
263;;; The `defgroup' Macro. 268;;; The `defgroup' Macro.
264 269
270(defun custom-current-group ()
271 (cdr (assoc load-file-name custom-current-group-alist)))
272
265(defun custom-declare-group (symbol members doc &rest args) 273(defun custom-declare-group (symbol members doc &rest args)
266 "Like `defgroup', but SYMBOL is evaluated as a normal argument." 274 "Like `defgroup', but SYMBOL is evaluated as a normal argument."
267 (while members 275 (while members
@@ -286,6 +294,10 @@ information."
286 (t 294 (t
287 (custom-handle-keyword symbol keyword value 295 (custom-handle-keyword symbol keyword value
288 'custom-group)))))) 296 'custom-group))))))
297 ;; Record the group on the `current' list.
298 (let ((elt (assoc load-file-name custom-current-group-alist)))
299 (if elt (setcdr elt symbol)
300 (push (cons load-file-name symbol) custom-current-group-alist)))
289 (run-hooks 'custom-define-hook) 301 (run-hooks 'custom-define-hook)
290 symbol) 302 symbol)
291 303
@@ -332,6 +344,8 @@ If there already is an entry for OPTION and WIDGET, nothing is done."
332(defun custom-handle-all-keywords (symbol args type) 344(defun custom-handle-all-keywords (symbol args type)
333 "For customization option SYMBOL, handle keyword arguments ARGS. 345 "For customization option SYMBOL, handle keyword arguments ARGS.
334Third argument TYPE is the custom option type." 346Third argument TYPE is the custom option type."
347 (unless (memq :group args)
348 (custom-add-to-group (custom-current-group) symbol 'custom-face))
335 (while args 349 (while args
336 (let ((arg (car args))) 350 (let ((arg (car args)))
337 (setq args (cdr args)) 351 (setq args (cdr args))