summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-02-11 14:53:21 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-02-12 00:14:46 -0200
commit511acc77a4b0be3ed997c335f270b346a4ed0d5f (patch)
treec539b21e28a2b6eae22d32ccfd71b328ce6ee418
parent0a66ca36fa052fbd7c0c751c96c22b5d81dec658 (diff)
downloademacs-511acc77a4b0be3ed997c335f270b346a4ed0d5f.tar.gz
emacs-lisp/package.el: Indicate incompatible packages.
These are packages which require a higher emacs version than the current one.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/emacs-lisp/package.el27
2 files changed, 35 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index def4620db02..6c51e2aee98 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -16,6 +16,15 @@
version of seq-reverse that works on sequences in Emacs 24.
Bump seq.el version to 1.2.
+2015-02-11 Artur Malabarba <bruce.connor.am@gmail.com>
+
+ * emacs-lisp/package.el (package--incompatible-p): New function.
+ Return non-nil if PKG has no chance of being installable.
+ (package--emacs-version-list): New variable.
+ (describe-package-1, package-desc-status)
+ (package-menu--print-info, package-menu--status-predicate):
+ Account for the "incompat" status.
+
2015-02-11 Martin Rudalics <rudalics@gmx.at>
* frame.el (toggle-frame-maximized, toggle-frame-fullscreen):
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 60cf65d2305..67e2f4050a7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1796,7 +1796,9 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
(pkg-dir
(insert (propertize (if (member status '("unsigned" "dependency"))
"Installed"
- (capitalize status)) ;FIXME: Why comment-face?
+ (if (equal status "incompat")
+ "Incompatible"
+ (capitalize status))) ;FIXME: Why comment-face?
'font-lock-face 'font-lock-comment-face))
(insert " in `")
;; Todo: Add button for uninstalling.
@@ -2054,6 +2056,25 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC."
(defvar package-list-unsigned nil
"If non-nil, mention in the list which packages were installed w/o signature.")
+(defvar package--emacs-version-list (version-to-list emacs-version)
+ "`emacs-version', as a list.")
+
+(defun package--incompatible-p (pkg)
+ "Return non-nil if PKG has no chance of being installable.
+PKG is a package-desc object.
+Return value is a string describing the reason why the package is
+incompatible.
+
+Currently, this only checks if PKG depends on a higher
+`emacs-version' than the one being used."
+ (let* ((reqs (package-desc-reqs pkg))
+ (version (cadr (assq 'emacs reqs))))
+ (if (and version (version-list-< package--emacs-version-list version))
+ (format "`%s' requires Emacs %s, but current version is %s"
+ (package-desc-full-name pkg)
+ (package-version-join version)
+ emacs-version))))
+
(defun package-desc-status (pkg-desc)
(let* ((name (package-desc-name pkg-desc))
(dir (package-desc-dir pkg-desc))
@@ -2072,6 +2093,7 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC."
((version-list-< version hv) "obsolete")
(t "disabled"))))
((package-built-in-p name version) "obsolete")
+ ((package--incompatible-p pkg-desc) "incompat")
(dir ;One of the installed packages.
(cond
((not (file-exists-p (package-desc-dir pkg-desc))) "deleted")
@@ -2222,6 +2244,7 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])."
(`"installed" 'font-lock-comment-face)
(`"dependency" 'font-lock-comment-face)
(`"unsigned" 'font-lock-warning-face)
+ (`"incompat" 'font-lock-comment-face)
(_ 'font-lock-warning-face)))) ; obsolete.
(list pkg-desc
`[,(list (symbol-name (package-desc-name pkg-desc))
@@ -2492,6 +2515,8 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm."
((string= sB "built-in") nil)
((string= sA "obsolete") t)
((string= sB "obsolete") nil)
+ ((string= sA "incompat") t)
+ ((string= sB "incompat") nil)
(t (string< sA sB)))))
(defun package-menu--description-predicate (A B)