 (cl-defun vendle:add-to-package-list (package)
   (add-to-list '*vendle-package-list* package))
 
-;;; utilily functions
+;;;; utilily functions
 
 (cl-defun vendle:concat-path (&rest parts)
   (cl-reduce (lambda (a b) (expand-file-name b a)) parts))
+
+(cl-defun vendle:compile (package path)
+  (if (vendle:package-compile package)
+      (byte-recompile-directory path 0)))
+
+(cl-defun vendle:message (fmt &rest text)
+  (apply 'message (cl-concatenate 'string "vendle: " fmt)
+         text))
+
+;;;; search
+(cl-defun vendle:search-registered (_key _term)
+  (cl-remove-if-not
+   (lambda (p)
+     (cl-case _term
+       (name
+        (cl-equalp _key (vendle:package-name p)))
+       (type
+        (cl-equalp _key (vendle:package-type p)))
+       (path
+        (cl-equalp _key (vendle:package-path p)))))
+   *vendle-package-list*))
 
 ;;;; initialize
 

(require 'vendle-source-git "vendle/source/git")
(require 'vendle-package "vendle/package")

;;; internal functions

(cl-defun vendle:directory-git-p (p)
  (if (file-directory-p (expand-file-name ".git" p))

;;;; clean
(cl-defun vendle:clean-packages ()
  (cl-letf ((paths (cl-remove-if
                    (lambda (dir)
                      (vendle:search-registered dir 'path))
                    (directory-files vendle-directory 'absolute (rx (not (any ".")))))))
    (if paths
        (cl-mapc
         (lambda (p)
           (message "vendle: clean %s" p)
           (delete-directory p t))
         paths))))

;;;; commands

;;;###autoload
(cl-defun vendle-check ()
  "Install packages using `vendle:install-packages'"
  (interactive)
  (vendle:check-packages))

;;;###autoload
(cl-defun vendle-update ()
  (interactive)
  (vendle:update-packages)
  (vendle:message "package update finished."))

;;;###autoload
(cl-defun vendle-clean ()
  (interactive)
  (vendle:clean-packages))

;;;; font-lock
(cl-defun vendle:turn-on-font-lock ()
  (cl-flet ((add-keywords (face-name keyword-rules)
                          (cl-letf* ((keyword-list (cl-mapcar (lambda (x)
