Browse files

Fix reading all recipes to only read the first recipe file.

It appears that Emacs Lisp loop will generate its own symbols/bindings for
the collect keyword even when you try to reference an already existing
binding in an outer block, and that I didn't test that properly before.

Seeing duplicates in the el-get-xxx commands completion did annoy me and
seeing them in M-x el-get-list-packages looked too much as a bug for me to
continue ignore it.
  • Loading branch information...
1 parent 4f9abc4 commit 55b6085b1fa3190c0e6e5a55bf3adca7ae82dbbf @dimitri committed Dec 18, 2012
Showing with 12 additions and 8 deletions.
  1. +12 −8 el-get-recipes.el
@@ -122,14 +122,18 @@ Used to avoid errors when exploring the path for recipes"
Only consider any given recipe only once even if present in
multiple dirs from `el-get-recipe-path'. The first recipe found
is the one considered."
- (loop for dir in (el-get-recipe-dirs)
- with packages
- nconc (loop for recipe in (directory-files dir nil "^[^.].*\.\\(rcp\\|el\\)$")
- for filename = (concat (file-name-as-directory dir) recipe)
- for package = (file-name-sans-extension (file-name-nondirectory recipe))
- unless (member package packages)
- collect package into packages
- and collect (ignore-errors (el-get-read-recipe-file filename)))))
+ (let (packages)
+ (loop
+ for dir in (el-get-recipe-dirs)
+ nconc (loop
+ for recipe in (directory-files dir nil "^[^.].*\.\\(rcp\\|el\\)$")
+ for filename = (concat (file-name-as-directory dir) recipe)
+ for pname = (file-name-sans-extension
+ (file-name-nondirectory recipe))
+ for package = (el-get-as-symbol pname)
+ unless (member package packages)
+ do (push package packages)
+ and collect (ignore-errors (el-get-read-recipe-file filename))))))
(defun el-get-read-all-recipes ()
"Return the list of all the recipes, formatted like `el-get-sources'.

1 comment on commit 55b6085

segv commented on 55b6085 Dec 18, 2012

untested remove-duplicates based version:

 for filename in (remove-duplicates (mapcan (lambda (dir)
                                              (directory-files dir t "^[^.].*\.\\(rcp\\|el\\)$"))
                                    :key 'file-name-nondirectory
                                    :test 'string=
                                    :from-end t)
 for pname = (file-name-sans-extension (file-name-nondirectory filename))
 for package = (el-get-as-symbol pname)
 collect (ignore-errors (el-get-read-recipe-file filename)))
Please sign in to comment.