Commit 2985c0c6 authored by Ryan C. Thompson's avatar Ryan C. Thompson

Add functions for getting and asserting a package's required emacs version

parent 4b86f11a
......@@ -181,4 +181,22 @@ which defaults to installed, required and removed. Example:
when (or (null types) (memq 'all types) (memq type types))
collect (cons name type)))
(defun el-get-package-required-emacs-version (package-or-source)
(let* ((def (if (or (symbolp package-or-source) (stringp package-or-source))
(el-get-package-def package-or-source)
def :from-emacs-version
(defun el-get-error-unless-required-emacs-version (package-or-source)
"Raise an error if `emacs-major-version' is less than package's requirement.
Second argument PACKAGE is optional and only used to construct the error message."
(let ((pname (el-get-source-name package-or-source))
(required-version (el-get-package-required-emacs-version package-or-source)))
(when (< emacs-major-version required-version)
(error "Package %s requires Emacs version %s, but current emacs is only version %s"
pname required-version emacs-major-version))))
(provide 'el-get-recipes)
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