Commit ad1c2aa7 authored by Noam Postavsky's avatar Noam Postavsky

Optimize el-get-read-all-recipe-names

This function is used to create completion candidates, so its slowness
is quite noticable. The main cause of slowness was the reading of all
the recipe files which can be avoided because the file name gives the
recipe name.

* el-get-recipes.el (el-get-all-recipe-file-names): new function.
* el-get.el (el-get-read-all-recipe-names): use new function
  el-get-all-recipe-file-names instead of el-get-read-all-recipes to
  avoid having to read every recipe file.
parent 1b805361
......@@ -122,6 +122,14 @@ Used to avoid errors when exploring the path for recipes"
(el-get-read-recipe-file filename)
(error "El-get can not find a recipe for package \"%s\"" package))))
(defun el-get-all-recipe-file-names ()
"Return the list of all file based recipe names.
The result may have duplicates."
(loop for dir in (el-get-recipe-dirs)
nconc (mapcar #'file-name-base
(directory-files dir nil "^[^.].*\.\\(rcp\\|el\\)$"))))
(defun el-get-read-all-recipe-files ()
"Return the list of all file based recipes, formated like `el-get-sources'.
......
......@@ -221,7 +221,8 @@
This is useful to use for providing completion candidates for
package names."
(mapcar 'el-get-source-name (el-get-read-all-recipes)))
(delete-dups (append (mapcar #'el-get-source-name el-get-sources)
(el-get-all-recipe-file-names))))
(defun el-get-error-unless-package-p (package)
"Raise an error if PACKAGE does not name a package that has a valid recipe."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment