Support pkg sub-groups in pkgusr-cmd-pkg/pkgusr-file-pkg
[pkgusr] / lisp / pkgusr.el
index 43ff0de..d6a9ac1 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author:     Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;; Created:    <2007-07-13>
-;; Time-stamp: <Sunday Mar 16, 2014 01:10:12 steve>
+;; Time-stamp: <Monday Mar 17, 2014 22:33:38 steve>
 ;; Homepage:   N/A
 ;; Keywords:   utils package-management
 
@@ -216,7 +216,6 @@ With a prefix arg, force update of the packages list."
     (narrow-to-region start end)
     (goto-char (point-min))))
 
-;;; FIXME: doesn't work for sub-groups.
 (defun pkgusr-cmd-pkg (cmd)
   "Display the package name \(user:group\) which contains CMD.
 
@@ -228,8 +227,10 @@ If non-interactive, return a list whose car is user and cdr is group."
                  (error 'pkgusr-unknown-cmd cmd)))
         (user (user-login-name
                (nth 2 (file-attributes cmd))))
-        (group (user-login-name
-                (nth 3 (file-attributes cmd)))))
+        (group (or (declare-fboundp (user-group-name
+                                     (nth 3 (file-attributes cmd))))
+                   (user-login-name
+                    (nth 3 (file-attributes cmd))))))
     (unless (or (member user pkgusr-all-pkgs)
                (member group pkgusr-all-pkgs))
       (error 'pkgusr-unknown-pkg user))
@@ -249,8 +250,10 @@ If non-interactive, return a list whose car is user and cdr is group."
   (interactive "fFile: ")
   (let ((user (user-login-name
               (nth 2 (file-attributes file))))
-       (group (user-login-name
-               (nth 3 (file-attributes file)))))
+       (group (or (declare-fboundp (user-group-name
+                                    (nth 3 (file-attributes file))))
+                  (user-login-name
+                   (nth 3 (file-attributes file))))))
     (unless (or (member user pkgusr-all-pkgs)
                (member group pkgusr-all-pkgs))
       (error 'pkgusr-unknown-pkg user))