emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 511acc7 2/2: emacs-lisp/package.el: Indicate incomp


From: Artur Malabarba
Subject: [Emacs-diffs] master 511acc7 2/2: emacs-lisp/package.el: Indicate incompatible packages.
Date: Thu, 12 Feb 2015 00:19:04 +0000

branch: master
commit 511acc77a4b0be3ed997c335f270b346a4ed0d5f
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    emacs-lisp/package.el: Indicate incompatible packages.
    
    These are packages which require a higher emacs version than the
    current one.
---
 lisp/ChangeLog             |    9 +++++++++
 lisp/emacs-lisp/package.el |   27 ++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index def4620..6c51e2a 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  <address@hidden>
+
+       * 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  <address@hidden>
 
        * frame.el (toggle-frame-maximized, toggle-frame-fullscreen):
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 60cf65d..67e2f40 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]