Commit a54ad73f authored by Kyle Hargraves's avatar Kyle Hargraves

Add el-get-builtin method, so builtin packages can be "installed" simply

parent 3d2f4c5e
......@@ -23,6 +23,7 @@
(file-name-directory (or load-file-name buffer-file-name))))
(require 'el-get-apt-get)
(require 'el-get-builtin)
(require 'el-get-bzr)
(require 'el-get-cvs)
(require 'el-get-darcs)
......
......@@ -131,11 +131,18 @@ each directory listed in `el-get-recipe-path' in order."
(t source))))
(defun el-get-package-method (package-or-source)
"Return the :type property (called method) of PACKAGE-OR-SOURCE"
(cond ((or (symbolp package-or-source) (stringp package-or-source))
(plist-get (el-get-package-def package-or-source) :type))
(t (plist-get package-or-source :type))))
"Return the :type property (called method) of PACKAGE-OR-SOURCE.
If the package is built in to the current major version of Emacs,
return 'builtin."
(let* ((def (if (or (symbolp package-or-source) (stringp package-or-source))
(el-get-package-def package-or-source)
package-or-source))
(builtin (plist-get def :builtin)))
(if (and builtin (>= emacs-major-version builtin))
'builtin
(plist-get package-or-source :type))))
(defalias 'el-get-package-type #'el-get-package-method)
......
......@@ -494,27 +494,22 @@ PACKAGE may be either a string or the corresponding symbol."
(source (el-get-package-def package))
(method (el-get-package-method source))
(install (el-get-method method :install))
(url (plist-get source :url))
(builtin (plist-get source :builtin)))
(url (plist-get source :url)))
(if (and builtin (>= emacs-major-version builtin))
(message "el-get-do-install: skipping builtin package \"%s\"" package)
(when (string= "installed" status)
(error "Package %s is already installed." package))
;; really install package otherwise
(when (string= "installed" status)
(error "Package %s is already installed." package))
(when (string= "required" status)
(message "Package %s failed to install, removing it first." package)
(el-get-remove package))
(when (string= "required" status)
(message "Package %s failed to install, removing it first." package)
(el-get-remove package))
;; check we can install the package and save to "required" status
(el-get-check-init)
(el-get-save-package-status package "required")
;; check we can install the package and save to "required" status
(el-get-check-init)
(el-get-save-package-status package "required")
;; and install the package now, *then* message about it
(funcall install package url 'el-get-post-install)
(message "el-get install %s" package)))))
;; and install the package now, *then* message about it
(funcall install package url 'el-get-post-install)
(message "el-get install %s" package))))
(defun el-get-post-update (package)
......
(require 'el-get-core)
(defcustom el-get-builtin-install-hook nil
"Hook run after 'installing' a builtin package."
:group 'el-get
:type 'hook)
(defun el-get-builtin-install (package url post-install-fun)
(let ((pdir (el-get-package-directory package)))
(unless (file-directory-p pdir)
(make-directory pdir))
(funcall post-install-fun package)))
(el-get-register-method
:builtin #'el-get-builtin-install #'el-get-builtin-install #'el-get-rmdir
#'el-get-builtin-install-hook)
(provide 'el-get-builtin)
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