unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Artur Malabarba <bruce.connor.am@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: package.el and emacs-version dependencies
Date: Tue, 10 Feb 2015 09:45:00 +0000	[thread overview]
Message-ID: <CAAdUY-J6wu+ALXvLM4bn0UzE3ud4QtMD_9vU2DQux_yyLtA5BQ@mail.gmail.com> (raw)
In-Reply-To: <CAAdUY-LMhaPFJoJstM2xGrtUu5-22RumdkHnVH_2K+50=D2Y4Q@mail.gmail.com>

[-- 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


  reply	other threads:[~2015-02-10  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  9:13 package.el and emacs-version dependencies Artur Malabarba
2015-02-10  9:45 ` Artur Malabarba [this message]
2015-02-10 18:33 ` Kelly Dean
2015-02-10 23:09   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAdUY-J6wu+ALXvLM4bn0UzE3ud4QtMD_9vU2DQux_yyLtA5BQ@mail.gmail.com \
    --to=bruce.connor.am@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).