summaryrefslogtreecommitdiff
path: root/lisp/cus-dep.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2013-05-15 19:35:10 -0400
committerGlenn Morris <rgm@gnu.org>2013-05-15 19:35:10 -0400
commit82a7c41b8606cd9d27a1eb458f14fc3d62e0b416 (patch)
tree06452ab130ba5019995959cf639bdd061b7875c8 /lisp/cus-dep.el
parentf5ba00a6cad3b8ab8bd94e3ba566f3608f1dc02e (diff)
downloademacs-82a7c41b8606cd9d27a1eb458f14fc3d62e0b416.tar.gz
* lisp/cus-dep.el (custom-make-dependencies): Add a fallback method
for getting :group.
Diffstat (limited to 'lisp/cus-dep.el')
-rw-r--r--lisp/cus-dep.el28
1 files changed, 23 insertions, 5 deletions
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el
index d31568bb523..4c8a9773c3a 100644
--- a/lisp/cus-dep.el
+++ b/lisp/cus-dep.el
@@ -89,13 +89,30 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
(while (re-search-forward
"^(def\\(custom\\|face\\|group\\)" nil t)
(beginning-of-line)
- (let ((expr (read (current-buffer))))
+ (let ((type (match-string 1))
+ (expr (read (current-buffer))))
(condition-case nil
(let ((custom-dont-initialize t))
- ;; Why do we need to eval just for the name?
- (eval expr)
- (put (nth 1 expr) 'custom-where name))
- (error nil))))
+ ;; Eval to get the 'custom-group, -tag,
+ ;; -version, group-documentation etc properties.
+ (put (nth 1 expr) 'custom-where name)
+ (eval expr))
+ ;; Eval failed for some reason. Eg maybe the
+ ;; defcustom uses something defined earlier
+ ;; in the file (we haven't loaded the file).
+ ;; In most cases, we can still get the :group.
+ (error
+ (ignore-errors
+ (let ((group (cadr (memq :group expr))))
+ (and group
+ (eq (car group) 'quote)
+ (custom-add-to-group
+ (cadr group)
+ (nth 1 expr)
+ (intern (format "custom-%s"
+ (if (equal type "custom")
+ "variable"
+ type)))))))))))
(error nil)))))))))
(message "Generating %s..." generated-custom-dependencies-file)
(set-buffer (find-file-noselect generated-custom-dependencies-file))
@@ -185,5 +202,6 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
(message "Generating %s...done" generated-custom-dependencies-file))
+(provide 'cus-dep)
;;; cus-dep.el ends here