* Re: package.el and emacs-version dependencies
2015-02-10 9:13 package.el and emacs-version dependencies Artur Malabarba
@ 2015-02-10 9:45 ` Artur Malabarba
2015-02-10 18:33 ` Kelly Dean
1 sibling, 0 replies; 4+ messages in thread
From: Artur Malabarba @ 2015-02-10 9:45 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
If we agree this is a desirable feature, the following patch should do it.
2015-02-10 9:13 GMT+00:00 Artur Malabarba <bruce.connor.am@gmail.com>:
> Is there any code in package.el to prevent the listing of completely
> incompatible packages?
>
> If not, would this be a desirable feature, or do we prefer to always
> display everything?
>
> Context:
> I noticed that, on Emacs 24.3, package.el will list packages that
> depend on emacs-24.4, even though they are completely uninstallable.
>
> I realise package.el has changed a lot since 24.3, but I didn't find a
> straightforward way to check if this has changed, given that there are
> no packages that depend on version > 24.4 (thus my question).
[-- Attachment #2: 0001-emacs-lisp-package.el-Don-t-list-incompatible-packag.patch --]
[-- Type: application/octet-stream, Size: 2336 bytes --]
From ac2b20bd793df4b3a2b34bb0d86780a7705748b2 Mon Sep 17 00:00:00 2001
From: Artur Malabarba <bruce.connor.am@gmail.com>
Date: Tue, 10 Feb 2015 09:41:58 +0000
Subject: [PATCH] emacs-lisp/package.el: Don't list incompatible packages.
---
lisp/ChangeLog | 8 ++++++++
lisp/emacs-lisp/package.el | 12 ++++++++++++
2 files changed, 20 insertions(+)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eee6744..daf00dd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2015-02-10 Artur Malabarba <bruce.connor.am@gmail.com>
+
+ * emacs-lisp/package.el (package-menu--refresh): Don't list
+ incompatible packages.
+ (package--compatible-p): New function. Return nil if PKG has no
+ chance of being installable.
+ (package--emacs-version-list): New variable.
+
2015-02-10 Lars Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-use-fonts): New variable.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index c3a2061..fbde171 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2093,6 +2093,17 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC."
(if (package--user-selected-p name)
"installed" "dependency")))))))))
+(defvar package--emacs-version-list (version-to-list emacs-version)
+ "`emacs-version', as a list.")
+
+(defun package--compatible-p (pkg)
+ "Return nil if PKG has no chance of being installable.
+PKG is a package-desc object.
+Currently, only checks if PKG depends on a higher `emacs-version'
+than the one being used."
+ (when-let ((version (cdr-safe (assq 'emacs (package-desc-reqs pkg)))))
+ (version-list-<= version package--emacs-version-list)))
+
(defun package-menu--refresh (&optional packages keywords)
"Re-populate the `tabulated-list-entries'.
PACKAGES should be nil or t, which means to display all known packages.
@@ -2126,6 +2137,7 @@ KEYWORDS should be nil or a list of keywords."
;; Hide obsolete packages.
(when (and (not (package-installed-p (package-desc-name pkg)
(package-desc-version pkg)))
+ (package--compatible-p pkg)
(package--has-keyword-p pkg keywords))
(package--push pkg (package-desc-status pkg) info-list)))))
--
1.7.12.4
^ permalink raw reply related [flat|nested] 4+ messages in thread