all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: "Marcin Włodarczak" <marcin@wlodarczak.org>
Cc: Eduardo Mercovich <eduardo@mercovich.net>, 41436@debbugs.gnu.org
Subject: bug#41436: 26.1; How to list upgradable packages only
Date: Tue, 8 Sep 2020 12:53:20 +0000	[thread overview]
Message-ID: <CADwFkmnCPi4+mZzxzSTJEotNkFdRyUU2Zat6JUjZgB2qh5-96Q@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmkbjLx2rUTcMEG2poHEE50RMuA0O14CKKUgz_Um6t64vg@mail.gmail.com> (Stefan Kangas's message of "Sun, 23 Aug 2020 13:55:36 -0400")

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

tags 41436 + patch
thanks

Stefan Kangas <stefankangas@gmail.com> writes:

>> I wonder whether it would not be nice to be able to list all upgradable
>> packages and then give the user an option of marking them one by one.
>
> I think it sounds useful.

Could you please try the attached patch and see if it works for you?
It should be applied to the master branch.

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Add-command-package-menu-filter-upgradable.patch --]
[-- Type: text/x-diff, Size: 2718 bytes --]

From 89d0a1d7f1b6f3e243edfd2df7ac720540535f66 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Tue, 8 Sep 2020 14:50:29 +0200
Subject: [PATCH] Add command package-menu-filter-upgradable

* lisp/emacs-lisp/package.el (package-menu-filter-upgradable):
New command.  (Bug#41436)
(package-menu-mode-map): Bind the new command.
* doc/emacs/package.texi (Package Menu): Document the new command.
---
 doc/emacs/package.texi     |  6 ++++++
 etc/NEWS                   |  1 +
 lisp/emacs-lisp/package.el | 10 ++++++++++
 3 files changed, 17 insertions(+)

diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 453d9eb401..56e8ee1363 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -222,6 +222,12 @@ Package Menu
 Filter package list by non-empty mark (@code{package-menu-filter-marked}).
 This shows only the packages that have been marked to be installed or deleted.
 
+@item / u
+@kindex / u @r{(Package Menu)}
+@findex package-menu-filter-upgradable
+Filter package list to show only packages for which there are
+available upgrades (@code{package-menu-filter-upgradable}).
+
 @item / /
 @kindex / / @r{(Package Menu)}
 @findex package-menu-filter-clear
diff --git a/etc/NEWS b/etc/NEWS
index aa3acc26b3..de57e559ba 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -554,6 +554,7 @@ key             binding
 / s             package-menu-filter-by-status
 / v             package-menu-filter-by-version
 / m             package-menu-filter-marked
+/ u             package-menu-filter-upgradable
 / /             package-menu-filter-clear
 
 ---
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index a173fc060a..803bae2ece 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2710,6 +2710,7 @@ package-menu-mode-map
     (define-key map (kbd "/ s") 'package-menu-filter-by-status)
     (define-key map (kbd "/ v") 'package-menu-filter-by-version)
     (define-key map (kbd "/ m") 'package-menu-filter-marked)
+    (define-key map (kbd "/ u") 'package-menu-filter-upgradable)
     map)
   "Local keymap for `package-menu-mode' buffers.")
 
@@ -3906,6 +3907,15 @@ package-menu-filter-marked
 	      (tabulated-list-put-tag (char-to-string mark) t)))
 	(user-error "No packages found")))))
 
+(defun package-menu-filter-upgradable ()
+  "Filter \"*Packages*\" buffer to show only upgradable packages."
+  (interactive)
+  (let ((pkgs (mapcar #'car (package-menu--find-upgrades))))
+    (package-menu--filter-by
+     (lambda (pkg)
+       (memql (package-desc-name pkg) pkgs))
+     "upgradable")))
+
 (defun package-menu-clear-filter ()
   "Clear any filter currently applied to the \"*Packages*\" buffer."
   (interactive)
-- 
2.28.0


  parent reply	other threads:[~2020-09-08 12:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 14:00 bug#41436: 26.1; How to list upgradable packages only Eduardo Mercovich
2020-08-23 16:16 ` Marcin Włodarczak
2020-08-23 16:43 ` Stefan Kangas
2020-08-23 16:58   ` Marcin Włodarczak
2020-08-23 17:55     ` Stefan Kangas
2020-08-23 21:01       ` Eduardo Mercovich
2020-09-08 12:53       ` Stefan Kangas [this message]
2020-10-19 18:42         ` Stefan Kangas

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

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

  git send-email \
    --in-reply-to=CADwFkmnCPi4+mZzxzSTJEotNkFdRyUU2Zat6JUjZgB2qh5-96Q@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=41436@debbugs.gnu.org \
    --cc=eduardo@mercovich.net \
    --cc=marcin@wlodarczak.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.