 ;; 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; 
-;;; Commentary: 
+;;; Commentary: load pases-load + install packages if needed
 ;; 
-;; 
+;; TODO: tidy this mess up
 ;; 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; 

                                             (number-to-string emacs-major-version) d))))
  (if (file-exists-p pases-dir)
      (progn
        (add-to-list 'load-path pases-dir)
        ;; TODO: rebuild `update-autoloads-in-package-area' to create/update loaddefs and `safe-autoloads-load' to load-file it in the case of a different `base' directory.
        ;; (if pases-source-dir
        ;;    (let ((f (concat (file-name-as-directory pases-source-dir) "loaddefs.el")))
        ;;        (if (file-exists-p p)
        ;;           (safe-autoloads-load p))) 
        (mars/autoload '(("pases" pases:install-package pases:uninstall-package
                          pases:disable-package pases:enable-package)
                         ("wl" wl wl-other-frame)
                         ("wl-draft" wl-draft wl-user-agent-compose))))
    (load (expand-file-name (concat (file-name-as-directory pases-source-dir)
                                    (file-name-as-directory 
                                     (concat pases-name "-" pases-version))
                                    "pases-load"))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; pases.el ends here

;;; Code:

(unless (boundp 'mars/local-root-dir) (condition-case nil (load (concat (file-name-directory load-file-name) "vars")) (error "Unable to get custom variables")))

(when (eq system-type 'windows-nt)
  (unless (executable-find "unzip")
    (error "IMPORTANT: Windows need unzip to be installed. Please go to `http://gnuwin32.sourceforge.net/packages/unzip.htm', install the convenient setup program and add `C:\\Program Files\\GnuWin32\\bin' or your GnuWin32 binary path in your path")))

(defun mars/pases:get-package (name url local-path)
  "Download a package named `name'."
  (url-copy-file
   (concat "http://" url "/" name)
   (expand-file-name (concat (file-name-as-directory local-path)
			     name))
   t))


;;; PASES
