emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112596: * lisp/cus-dep.el (custom-ma


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112596: * lisp/cus-dep.el (custom-make-dependencies): Add a fallback method
Date: Wed, 15 May 2013 19:35:10 -0400
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112596
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2013-05-15 19:35:10 -0400
message:
  * lisp/cus-dep.el (custom-make-dependencies): Add a fallback method
  for getting :group.
modified:
  lisp/ChangeLog
  lisp/cus-dep.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-15 23:31:16 +0000
+++ b/lisp/ChangeLog    2013-05-15 23:35:10 +0000
@@ -1,8 +1,10 @@
 2013-05-15  Glenn Morris  <address@hidden>
 
-       * cus-dep.el (custom-make-dependencies): Ignore dotfiles (dir-locals).
+       * cus-dep.el: Provide a feature.
+       (custom-make-dependencies): Ignore dotfiles (dir-locals).
        Don't mistakenly ignore files whose basenames match a basename
        from preloaded-file-list (eg cedet/ede/simple.el).
+       Add a fallback method for getting :group.
 
 2013-05-15  Juri Linkov  <address@hidden>
 

=== modified file 'lisp/cus-dep.el'
--- a/lisp/cus-dep.el   2013-05-15 23:31:16 +0000
+++ b/lisp/cus-dep.el   2013-05-15 23:35:10 +0000
@@ -89,13 +89,30 @@
                     (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 @@
   (message "Generating %s...done" generated-custom-dependencies-file))
 
 
+(provide 'cus-dep)
 
 ;;; cus-dep.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]