unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* package.el and emacs-version dependencies
@ 2015-02-10  9:13 Artur Malabarba
  2015-02-10  9:45 ` Artur Malabarba
  2015-02-10 18:33 ` Kelly Dean
  0 siblings, 2 replies; 4+ messages in thread
From: Artur Malabarba @ 2015-02-10  9:13 UTC (permalink / raw)
  To: emacs-devel

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).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* 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

* 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
  2015-02-10 23:09   ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Kelly Dean @ 2015-02-10 18:33 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: emacs-devel

Artur Malabarba wrote:
> 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.

Maybe indicate incompatible packages and allow hiding them, but show them by default, to goad people into upgrading their Emacs so they can use all the great new packages.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: package.el and emacs-version dependencies
  2015-02-10 18:33 ` Kelly Dean
@ 2015-02-10 23:09   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-02-10 23:09 UTC (permalink / raw)
  To: Kelly Dean; +Cc: Artur Malabarba, emacs-devel

> Maybe indicate incompatible packages and allow hiding them, but show them by
> default, to goad people into upgrading their Emacs so they can use all the
> great new packages.

I agree that completely hiding them is not a good idea.  They can be
marked specially (including greyed out), but they should appear.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-10 23:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-02-10 23:09   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).