# HG changeset patch # User youngs # Date 1071833099 0 # Node ID 5d8dcaecc32b0fcec8f21e66eb5409f4664a8251 # Parent c05c2d638def21c56d4ea94d23e991c7a378566e [xemacs-hg @ 2003-12-19 11:24:58 by youngs] 2003-12-15 Steve Youngs * package-get.el (package-get-list-packages-where): New. A function that allows searching for groups of packages. For example, find all packages that require the fsf-compat package. diff -r c05c2d638def -r 5d8dcaecc32b lisp/ChangeLog --- a/lisp/ChangeLog Thu Dec 18 22:50:36 2003 +0000 +++ b/lisp/ChangeLog Fri Dec 19 11:24:59 2003 +0000 @@ -1,3 +1,9 @@ +2003-12-15 Steve Youngs + + * package-get.el (package-get-list-packages-where): New. A + function that allows searching for groups of packages. For + example, find all packages that require the fsf-compat package. + 2003-11-05 Vin Shelton * help.el (Help-prin1-face): diff -r c05c2d638def -r 5d8dcaecc32b lisp/package-get.el --- a/lisp/package-get.el Thu Dec 18 22:50:36 2003 +0000 +++ b/lisp/package-get.el Fri Dec 19 11:24:59 2003 +0000 @@ -914,6 +914,63 @@ info)))) ;;;###autoload +(defun package-get-list-packages-where (item field &optional arg) + "Return a list of packages that fulfill certain criteria. + +Argument ITEM, a symbol, is what you want to check for. ITEM must be a +symbol even when it doesn't make sense to be a symbol \(think, searching +maintainers, descriptions, etc\). The function will convert the symbol +to a string if a string is what is needed. The downside to this is that +ITEM can only ever be a single word. + +Argument FIELD, a symbol, is the field to check in. You can specify +any one of: + + Field Sane or Allowable Content + description any single word + category `standard' or `mule' + maintainer any single word + build-date yyyy-mm-dd + date yyyy-mm-dd + type `regular' or `single' + requires any package name + provides any symbol + priority `low', `medium', or `high' + +Optional Argument ARG, a prefix arg, insert output at point in the +current buffer." + (interactive "SList packages that have (item): \nSin their (field): \nP") + (package-get-require-base nil) + (let ((pkgs package-get-base) + (strings '(description category maintainer build-date date)) + (symbols '(type requires provides priority)) + results) + (cond ((memq field strings) + (setq item (symbol-name item)) + (while pkgs + (when (string-match item (package-get-info (caar pkgs) field)) + (setq results (push (caar pkgs) results))) + (setq pkgs (cdr pkgs)))) + ((memq field symbols) + (if (or (eq field 'type) + (eq field 'priority)) + (while pkgs + (when (eq item (package-get-info (caar pkgs) field)) + (setq results (push (caar pkgs) results))) + (setq pkgs (cdr pkgs))) + (while pkgs + (when (memq item (package-get-info (caar pkgs) field)) + (setq results (push (caar pkgs) results))) + (setq pkgs (cdr pkgs))))) + (t + (error 'wrong-type-argument field))) + (if (interactive-p) + (if arg + (insert (format "%s" results)) + (message "%s" results))) + results)) + +;;;###autoload (defun package-get (package &optional version conflict install-dir) "Fetch PACKAGE from remote site. Optional arguments VERSION indicates which version to retrieve, nil