From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 09 03:21:16 2019 Received: (at submit) by debbugs.gnu.org; 9 Aug 2019 07:21:16 +0000 Received: from localhost ([127.0.0.1]:42003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvzD9-0003lf-PD for submit@debbugs.gnu.org; Fri, 09 Aug 2019 03:21:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:35044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hvzD7-0003lX-Js for submit@debbugs.gnu.org; Fri, 09 Aug 2019 03:21:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54292) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvzD6-0004uV-MD for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 03:21:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvzD5-0001lp-Ob for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 03:21:12 -0400 Received: from fmfe26.onbox.hu ([46.107.16.231]:42300 helo=web-out.onbox.hu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hvzD5-0001h5-5c for bug-gnu-emacs@gnu.org; Fri, 09 Aug 2019 03:21:11 -0400 X-fm-smtp-source: yes Received: from localhost (localhost [94.21.43.56]) by web-out.onbox.hu (Postfix) with SMTP id 464c9B0gWQzFhD for ; Fri, 9 Aug 2019 09:21:02 +0200 (CEST) From: ndame Message-ID: Subject: 26.2; request: add searching by package name to list-packages MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_393_48740678.1565335139349" To: "bug-gnu-emacs@gnu.org" X-AccountId: 57978162 X-Originating-Ip: 94.21.43.56 Date: Fri, 9 Aug 2019 09:21:02 +0200 (CEST) X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudduiedguddujecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdcuhfftgffgofetkffnnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffkufggtgfvihffsegrtdersgdttddunecuhfhrohhmpehnuggrmhgvuceovghmrggtshhushgvrhesfhhrvggvmhgrihhlrdhhuheqnecukfhppeelgedrvddurdegfedrheeinecurfgrrhgrmhephhgvlhhopedpihhnvghtpeelgedrvddurdegfedrheeipdhmrghilhhfrhhomhepvghmrggtshhushgvrhesfhhrvggvmhgrihhlrdhhuhdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/relaxed; t=1565335262; s=20181004; d=freemail.hu; h=From:Message-ID:Subject:MIME-Version:Content-Type:To:Date; l=1175; bh=N9NhRVOOsRkMxL1dViAhmnoIUeL5sELaAokiuwQSyEw=; b=xexyG9HH8I4GH5/RzRPsNTn+YK0/hMWp74XwyvgqkwMHoqeEVNaBOkxy91OIbHqw BDprmUqL33l5skRV960iZ6VMbjzs7EXNubAbqqRYfMO+mGdZJjDTATSGq/wjoI07/3s zA/5B7So+91L+d463Ked2UQ91FQeI9o1hlx/nrUIjRmGmjvMyqaXycOFF/FknBfmekH Jmjv9M+PlHTkgFqXOjWRtHs7dLDm0XqBHAI3yJcLtzHFans+bIimHWSffergQfnuNS/ RKvXgKxwHj8GzMbtslH//vM3COcvSgkvf5NMqdYJs/unFtzUnOKi8e0SLjgAljJ53Dy MEozK54Kzw== X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 46.107.16.231 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) ------=_Part_393_48740678.1565335139349 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable When installing a package from list-packages it's often inconvenient to find a package which has a string which occurs many times in the packages buffer. (e.g. in the descriptions). The package buffer has f for filtering, but it filters only for package keywords, not names. Add a new command s for search which searches (or filters) the package list by a substring match on the package name. =C2=A0 ------=_Part_393_48740678.1565335139349 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit When installing a package from list-packages it's often
inconvenient to find a package which has a string which occurs
many times in the packages buffer. (e.g. in the descriptions).

The package buffer has f for filtering, but it filters only for
package keywords, not names.

Add a new command s for search which searches (or filters) the
package list by a substring match on the package name.
  ------=_Part_393_48740678.1565335139349-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 07 20:48:09 2019 Received: (at 36981) by debbugs.gnu.org; 8 Sep 2019 00:48:09 +0000 Received: from localhost ([127.0.0.1]:38249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i6lNA-0007N7-RD for submit@debbugs.gnu.org; Sat, 07 Sep 2019 20:48:09 -0400 Received: from mail-ed1-f47.google.com ([209.85.208.47]:34230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i6lN8-0007Mf-LG for 36981@debbugs.gnu.org; Sat, 07 Sep 2019 20:48:07 -0400 Received: by mail-ed1-f47.google.com with SMTP id c20so888603eds.1 for <36981@debbugs.gnu.org>; Sat, 07 Sep 2019 17:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=M/JpiMt/MjiQYtkZ8mw6DmykZtp8oUKDImI8Mm0FEfM=; b=rt9Uf8XNkiwOtBPfANJzAwPrInXKXCkphvFGae8mTVWRkRcuIxgXNpqRYyTCz59Rsp jYUE51zkPRYyFkDQl5jzQrnCAwGFytH6m5Ib8mUYQZ7EOJktGvqyAs6Hkt9kE82LfoDX 0ZEisXb38olBBcTH+GMFDKOctKVeUwnlxK8uOIVldp0qLRoCkpW5ZcSwfbLPOcfEBPv6 kDBCcqEBsAuYyGGR7bEHezNGZd059Tkky7+x9DIBEHe4epCyo+OOZ5i61dj/Lyy9BwdW fYekoZInk9ajYcl4lyQ9QkcJxprvyrL3vYiyK/F5CVcD3SPMe9R6T21JoC5hTk1wH7qs YnQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=M/JpiMt/MjiQYtkZ8mw6DmykZtp8oUKDImI8Mm0FEfM=; b=fSrUCt1OVsR9Q9j18xlOA+8A0QSniisXHGjpDqLWSIICSdjU0xIeFvXt82R1E75yIi htio8zENAPvGzPq5JtToZRDkvFNSyflegqni+L7ehFgBpgzb9y41LQ3UULE2L5+kZvW/ EoZhYd/V27HMFGYRs4rVOWHj5ie+TAl7ou1vblhMT1D/iHCMb0PpKpp57h8HGotCbNPJ 8gdjGw+2a/CLjUiItZUeVbJuu4gCj71A7Yh/6Eku7VBGayr1qUarO8cT4i446oeBKKtJ 4GGwgbjAjdh6bfPT25PSb1XRppsQ9vfPt+k3NDpH6JRY/3Twom3Ixr57rfP6qb/HT+8h UEaQ== X-Gm-Message-State: APjAAAVC1uN61ATGjAScvPmwKWAgNT8GAO2gmo866uLMzPB9l1wIHvID L4lES0f4C8LyL7M4T+ZJ9SeENAFSZ/8= X-Google-Smtp-Source: APXvYqzlwlhEYKN6x8Gcd2bSLBIJd73b3KwImzTNnSGC9b4uyYkD4AQLfdzCEuMWnoEbH4e8F8V4HQ== X-Received: by 2002:a17:906:d0c5:: with SMTP id bq5mr13661184ejb.95.1567903680333; Sat, 07 Sep 2019 17:48:00 -0700 (PDT) Received: from lead (dslb-188-103-126-075.188.103.pools.vodafone-ip.de. [188.103.126.75]) by smtp.gmail.com with ESMTPSA id k46sm1078829edd.71.2019.09.07.17.47.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Sep 2019 17:47:59 -0700 (PDT) From: Federico Tedin To: ndame Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: Date: Sun, 08 Sep 2019 02:47:57 +0200 In-Reply-To: (ndame's message of "Fri, 9 Aug 2019 09:21:02 +0200 (CEST)") Message-ID: <87ef0r396q.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain ndame writes: > When installing a package from list-packages it's often > inconvenient to find a package which has a string which occurs > many times in the packages buffer. (e.g. in the descriptions). > > The package buffer has f for filtering, but it filters only for > package keywords, not names. > > Add a new command s for search which searches (or filters) the > package list by a substring match on the package name. I've implemented this feature using the "s" key as you suggested. I'm attaching a patch with my changes. - Fede --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=search.patch Content-Description: patch >From cb14b951949e26bea8c12b202b70754271d9f4e2 Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Sun, 8 Sep 2019 02:38:43 +0200 Subject: [PATCH 1/1] Search packages by name in list-packages (Bug#36981) * lisp/emacs-lisp/package.el (package-menu-search): Added a new function that allows filtering packages by name. (package-menu--generate): Show full packages list with 'q' if current list has been filtered. (package-menu-mode-map): Bind 's' to package-menu-search. * test/lisp/emacs-lisp/package-tests.el (package-test-list-search): Added a test for package-menu-search. --- lisp/emacs-lisp/package.el | 30 +++++++++++++++++++++++++-- test/lisp/emacs-lisp/package-tests.el | 11 +++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ef0c5171de..0993015fde 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2621,6 +2621,7 @@ package-menu-mode-map (define-key map "U" 'package-menu-mark-upgrades) (define-key map "r" 'package-menu-refresh) (define-key map "f" 'package-menu-filter) + (define-key map "s" 'package-menu-search) (define-key map "~" 'package-menu-mark-obsolete-for-deletion) (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) @@ -2652,7 +2653,8 @@ package-menu-mode-map ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] "--" - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] + ["Filter Packages by Keywords" package-menu-filter :help "Filter packages by keywords (q to go back)"] + ["Filter Packages by Name" package-menu-search :help "Filter packages by name (q to go back)"] ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] ["Display Older Versions" package-menu-toggle-hiding :style toggle :selected (not package-menu--hide-packages) @@ -2963,7 +2965,7 @@ package-menu--generate (let ((filters (mapconcat #'identity keywords ","))) (concat "Package[" filters "]")) "Package")) - (if keywords + (if (or keywords (and packages (listp packages))) (define-key package-menu-mode-map "q" 'package-show-package-list) (define-key package-menu-mode-map "q" 'quit-window)) (tabulated-list-init-header) @@ -3598,6 +3600,30 @@ package-menu-filter (list keyword) keyword))) +(defun package-menu-search (name) + "Filter the *Packages* buffer. +Show only those items whose name matches NAME. If NAME is nil or an +empty string, show all packages. + +To restore the full package list, type `q'." + (interactive + (list (read-from-minibuffer "Package name: ") + current-prefix-arg)) + (if (or (not name) (string-empty-p name)) + (package-show-package-list t nil) + ;; Update `tabulated-list-entries' so that in contains all + ;; packages before searching. + (package-menu--refresh t nil) + (let (matched) + (dolist (entry tabulated-list-entries) + (let* ((pkg-name-sym (package-desc-name (car entry))) + (pkg-name (symbol-name pkg-name-sym))) + (when (string-match name pkg-name) + (push pkg-name-sym matched)))) + (if matched + (package-show-package-list matched nil) + (user-error "No packages found"))))) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c757bccf67..ea28db83ce 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -28,7 +28,7 @@ ;; Run this in a clean Emacs session using: ;; -;; $ emacs -Q --batch -L . -l package-test.el -l ert -f ert-run-tests-batch-and-exit +;; $ emacs -Q --batch -L . -l package-tests.el -l ert -f ert-run-tests-batch-and-exit ;;; Code: @@ -360,6 +360,15 @@ package-test--compatible-p (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-search () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-search "tetris") + (should (= (length tabulated-list-entries) 1)) + (should (eq (package-desc-name (caar tabulated-list-entries)) 'tetris)) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () -- 2.17.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 08 11:20:10 2019 Received: (at 36981) by debbugs.gnu.org; 8 Sep 2019 15:20:10 +0000 Received: from localhost ([127.0.0.1]:39040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i6yz3-00018w-MB for submit@debbugs.gnu.org; Sun, 08 Sep 2019 11:20:09 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:34738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i6yz1-00018h-SH for 36981@debbugs.gnu.org; Sun, 08 Sep 2019 11:20:08 -0400 Received: by mail-wm1-f68.google.com with SMTP id y135so10997092wmc.1 for <36981@debbugs.gnu.org>; Sun, 08 Sep 2019 08:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=NGi3BEx9D/7/4JMRmcE4vdJdL3H5M1vc42xPzZMVj6A=; b=urvvhIGJfThwqGIBFvH4Wmjfi9wz11ydqyv/P+93yD4e4tKx+U4ZeDr8CuzfEX7auc A1WxyJW2Bs0jXYdYqXFsogj3lyfdesRzI7TWsxezoIlczcu088SoAFFj8+OHt2i+xLKX bAJwIE70fVSgoH82RFtbr1gWZGkXsvl12A2zbpubElBGLRtauXaM2Kr72imdFXemZDXU 4C8GKecXtXQbiElA5KPIckMqEYjLg6A2OYNZ3RYX6KnT5ar/XBxn3nusFR7gA8lF7Ut0 eGPhvLratl3nmKpBnxWvfoVk2M4V+6i0dOoiLY+XMMLuPTxOqVBrsySYsjIXTIn41QK7 aF1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=NGi3BEx9D/7/4JMRmcE4vdJdL3H5M1vc42xPzZMVj6A=; b=H0CNUBROspUgzUnFLJ2i5qyoH53HcRkhyxClRrVoBoeO2dV9/ruVAYv/7KVJAD9al8 IXHo3iZWRBKO1cobkFM/eI/QBg3eAHxVfE5LNxje7UTy6J3qlAIHAuwnVE8kAay0Invj HhmdoxJ9FQuV1AtgdQ9yg1j6Qj3T0gf9x4p5aZ+5hyxYsPueQN5c5fDie1mH6Mdw9dgI ulR3/7vUXQbuo0DqhHGO1Re6UamBL7VXgE/uHtIqs38oHwdUPWj4EkfhQyS4rldq/Gas WEyDHHhl+h0ll1eUyL0O2FyLyf+7BDU/Bn8zsmH8zJvKzgiIS9mdmv+zoGzHnS+t+22X GKAA== X-Gm-Message-State: APjAAAUFdvdBoitZT92qL9H7OZbgMhMKt2DnYZJt5jEvCZyz8f/QqrKP ZrVMQ5QhCOcgzwVgXW4Ch1w= X-Google-Smtp-Source: APXvYqwcbvS5xy8JqfZ8akzU/sb8veVSoXXpWgYowtdq/qoksYaDjYMruWfU0kFCyW4/5c9U/zFxUQ== X-Received: by 2002:a1c:4384:: with SMTP id q126mr16663274wma.153.1567956002055; Sun, 08 Sep 2019 08:20:02 -0700 (PDT) Received: from localhost ([185.112.167.114]) by smtp.gmail.com with ESMTPSA id k6sm24437954wrg.0.2019.09.08.08.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2019 08:20:01 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Federico Tedin Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages In-Reply-To: <87ef0r396q.fsf@gmail.com> (Federico Tedin's message of "Sun, 08 Sep 2019 02:47:57 +0200") References: <87ef0r396q.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Sun, 08 Sep 2019 17:20:00 +0200 Message-ID: <87tv9mke73.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I don't use package.el, but here are a few observations: > From: Federico Tedin > Date: Sun, 8 Sep 2019 02:38:43 +0200 > Subject: [PATCH 1/1] Search packages by name in list-packages (Bug#36981) > > + (if (or keywords (and packages (listp packages))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AKA "(consp packages)", though maybe you find your version more descriptive. > +(defun package-menu-search (name) > + "Filter the *Packages* buffer. > +Show only those items whose name matches NAME. If NAME is nil or an > +empty string, show all packages. If I was reading it as a user, I would appreciate it if the doc string was more specific regarding the NAME argument, e.g. said "matches the regular expression NAME" or something to that effect. Also, I think "empty string" is usually prefixed with "the", not "an", as there is only one such thing, e.g. (eq "" "") =3D> t.=20 > +To restore the full package list, type `q'." > + (interactive > + (list (read-from-minibuffer "Package name: ") > + current-prefix-arg)) ^^^^^^^^^^^^^^^^^^ Is this a remnant of some previous WIP version? The function now takes a single argument, right? Thanks! --=20 =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 09 16:55:09 2019 Received: (at 36981) by debbugs.gnu.org; 9 Sep 2019 20:55:09 +0000 Received: from localhost ([127.0.0.1]:40627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i7Qgm-0003sm-Qf for submit@debbugs.gnu.org; Mon, 09 Sep 2019 16:55:09 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:37528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i7Qgj-0003sA-Rx for 36981@debbugs.gnu.org; Mon, 09 Sep 2019 16:55:06 -0400 Received: by mail-wr1-f47.google.com with SMTP id i1so15268580wro.4 for <36981@debbugs.gnu.org>; Mon, 09 Sep 2019 13:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=muBWxDrxB5r1HaC8AL6DsVsFIkce6rSDgJ4/fJdb4MI=; b=I20oeffdoFD4eSr/zd2SdxD/HBRsXgt95JOynCfsBfxWapk0aFX9lhEzqktHHsGAO0 VoUpijjNC51zYM5wecY9oSyYrRKlGQmiUaBMo5yORvWVLpeBNBcyBCpGxP8sp51rXeqD FEtDNc2RbaYD/sgaZiJGYfLwHNfEQpGCADJlwSEbcRT+rRCRHDEztKPg61hNUx6+Gb69 R+o+Hws5wO+gaQwTzQp17HXnUlxfqFOYk0xC5BfZP8Vx1MOLQxw5qSq+tMJb5SkozizB JXOT+Oqg3lvePda5eGuh9NPI8MkacqO5ccyTYh3ygHTt7H2IsP1jUGRM2FxdsUEu2r0f XpWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=muBWxDrxB5r1HaC8AL6DsVsFIkce6rSDgJ4/fJdb4MI=; b=eeshbLmTlB+wqJdY1QJki+/rAeOM5KtHWn0Hxqg3OctP8269AV9YdVfTUxxXZIpoc3 tNRF/3ibpGD/Jnxv/MiB4tIea5IhzMTNrsQizUBycbdVW+mmm6OH1L8X0y76xgZHv5t4 aUOA5W7OnP2/2ugPOgty/jKqmsJUqcv1aTVHAeXl0YyD8AZMfRESQPpSDFdZt1J+CWRW l35O4OC4nruhFXG4EbJ8PaO5R5n7Y26QjK1QfSKYLQqv6T5WtFDvcR6UpA0Vzjz0vqEr 1pocCBIoPOiq5Gwz/NCwfcw9wV+Bpi7oPav9c1FvRhN7fJXba2ZYrlxPiifxPyT9sl7A QBHA== X-Gm-Message-State: APjAAAXBZ+yxof7UQTWVIHBquSLxnHS4UFfobJUvSKJxOCG8vJQjGtGB 6euXACMVFgB9jfpZ+rJGsi4= X-Google-Smtp-Source: APXvYqxEhumBrLa8UAU4XkleDB059ot31hSL/sFjooq6KPy9RYp777rC0ci6/G6/4IE/GrK6R/Xudg== X-Received: by 2002:a5d:6108:: with SMTP id v8mr16217464wrt.255.1568062499918; Mon, 09 Sep 2019 13:54:59 -0700 (PDT) Received: from lead (dslb-188-103-126-075.188.103.pools.vodafone-ip.de. [188.103.126.75]) by smtp.gmail.com with ESMTPSA id 189sm1135452wma.6.2019.09.09.13.54.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Sep 2019 13:54:57 -0700 (PDT) From: Federico Tedin To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: <87ef0r396q.fsf@gmail.com> <87tv9mke73.fsf@gmail.com> Date: Mon, 09 Sep 2019 22:54:56 +0200 In-Reply-To: <87tv9mke73.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sun, 08 Sep 2019 17:20:00 +0200") Message-ID: <87woeh197j.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi =C5=A0t=C4=9Bp=C3=A1n, thanks for your very detailed feedback. >> + (if (or keywords (and packages (listp packages))) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > AKA "(consp packages)", though maybe you find your version more > descriptive. Thanks, didn't know they were equivalent. >> +(defun package-menu-search (name) >> + "Filter the *Packages* buffer. >> +Show only those items whose name matches NAME. If NAME is nil or an >> +empty string, show all packages. > > If I was reading it as a user, I would appreciate it if the doc string > was more specific regarding the NAME argument, e.g. said "matches the > regular expression NAME" or something to that effect. > Also, I think "empty string" is usually prefixed with "the", not "an", > as there is only one such thing, e.g. (eq "" "") =3D> t.=20 I've changed the docstring as you described, I think it's clearer now. >> +To restore the full package list, type `q'." >> + (interactive >> + (list (read-from-minibuffer "Package name: ") >> + current-prefix-arg)) > ^^^^^^^^^^^^^^^^^^ > > Is this a remnant of some previous WIP version? The function now takes a > single argument, right? Correct! I forgot to remove it. I was experimenting with making 'C-u s' search packages by name, but only considering packages that were already listed. This way it was possible to combine the keyword search and name search. I decided against it in the end because I'm not sure if it is a necessary addition. I'm attaching a new patch with some changes. - Fede --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=search.patch Content-Description: patch >From e1a8d4ab5b03d5800e5c42c61cd2471e45f2a9f5 Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Mon, 9 Sep 2019 22:48:36 +0200 Subject: [PATCH 1/1] Search packages by name in list-packages (Bug#36981) * lisp/emacs-lisp/package.el (package-menu-search): Added a new function that allows filtering packages by name. (package-menu--generate): Show full packages list with 'q' if current list has been filtered. (package-menu-mode-map): Bind 's' to package-menu-search. * test/lisp/emacs-lisp/package-tests.el (package-test-list-search): Added a test for package-menu-search. * doc/emacs/package.texi: Document usage of 'package-menu-search'. * etc/NEWS: Announce changes. --- doc/emacs/package.texi | 5 +++++ etc/NEWS | 4 ++++ lisp/emacs-lisp/package.el | 28 +++++++++++++++++++++++++-- test/lisp/emacs-lisp/package-tests.el | 11 ++++++++++- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 4b33f250c4..84de3a5103 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -142,6 +142,11 @@ Package Menu that relate to that keyword. To restore the full package list, type @kbd{q}. +@item s +Search packages by name (@code{package-menu-search}). This prompts +for a string, then shows only the packages whose names match a regexp +with that value. To restore the full package list, type @kbd{q}. + @item H Permanently hide packages that match a regexp (@code{package-menu-hide-package}). diff --git a/etc/NEWS b/etc/NEWS index 87666740df..6554dc1f79 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -968,6 +968,10 @@ early init file. *** New function 'package-activate-all'. +*** New function 'package-menu-search'. +Allows users to search packages by name on the packages list. By +default, it is bound to 's'. + --- *** Imenu support has been added to 'package-menu-mode'. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ef0c5171de..d1ff7b964d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2621,6 +2621,7 @@ package-menu-mode-map (define-key map "U" 'package-menu-mark-upgrades) (define-key map "r" 'package-menu-refresh) (define-key map "f" 'package-menu-filter) + (define-key map "s" 'package-menu-search) (define-key map "~" 'package-menu-mark-obsolete-for-deletion) (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) @@ -2652,7 +2653,8 @@ package-menu-mode-map ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] "--" - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] + ["Filter Packages by Keywords" package-menu-filter :help "Filter packages by keywords (q to go back)"] + ["Filter Packages by Name" package-menu-search :help "Filter packages by name (q to go back)"] ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] ["Display Older Versions" package-menu-toggle-hiding :style toggle :selected (not package-menu--hide-packages) @@ -2963,7 +2965,7 @@ package-menu--generate (let ((filters (mapconcat #'identity keywords ","))) (concat "Package[" filters "]")) "Package")) - (if keywords + (if (or keywords (consp packages)) (define-key package-menu-mode-map "q" 'package-show-package-list) (define-key package-menu-mode-map "q" 'quit-window)) (tabulated-list-init-header) @@ -3598,6 +3600,28 @@ package-menu-filter (list keyword) keyword))) +(defun package-menu-search (name) + "Filter the *Packages* buffer. +Show only those items whose name matches the regular expression +NAME. If NAME is nil or the empty string, show all packages. + +To restore the full package list, type `q'." + (interactive (list (read-from-minibuffer "Package name: "))) + (if (or (not name) (string-empty-p name)) + (package-show-package-list t nil) + ;; Update `tabulated-list-entries' so that in contains all + ;; packages before searching. + (package-menu--refresh t nil) + (let (matched) + (dolist (entry tabulated-list-entries) + (let* ((pkg-name-sym (package-desc-name (car entry))) + (pkg-name (symbol-name pkg-name-sym))) + (when (string-match name pkg-name) + (push pkg-name-sym matched)))) + (if matched + (package-show-package-list matched nil) + (user-error "No packages found"))))) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c757bccf67..ea28db83ce 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -28,7 +28,7 @@ ;; Run this in a clean Emacs session using: ;; -;; $ emacs -Q --batch -L . -l package-test.el -l ert -f ert-run-tests-batch-and-exit +;; $ emacs -Q --batch -L . -l package-tests.el -l ert -f ert-run-tests-batch-and-exit ;;; Code: @@ -360,6 +360,15 @@ package-test--compatible-p (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-search () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-search "tetris") + (should (= (length tabulated-list-entries) 1)) + (should (eq (package-desc-name (caar tabulated-list-entries)) 'tetris)) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () -- 2.17.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 14 07:15:26 2019 Received: (at 36981) by debbugs.gnu.org; 14 Sep 2019 11:15:26 +0000 Received: from localhost ([127.0.0.1]:45925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i961V-0006Gs-QD for submit@debbugs.gnu.org; Sat, 14 Sep 2019 07:15:26 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:40664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i961T-0006Ge-51 for 36981@debbugs.gnu.org; Sat, 14 Sep 2019 07:15:24 -0400 Received: by mail-wr1-f45.google.com with SMTP id l3so11673626wru.7 for <36981@debbugs.gnu.org>; Sat, 14 Sep 2019 04:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=eTt3Ry5R/l752rwPYmfC8oDAjRFl7qKkddSHyK2Jfg0=; b=BTo0m5fVM7ONBpzWZMHvpnK4OWhjyM2eHAkWtkXoqCIWdPjhMOJdS7sHNBs3MA3tXr 5CoM2A4zMeSznQpseGs5rsdZ1oN/ChFj2iXdBdbJULsOCtY+yBKICYeOC8iV3N0ZUBMk Ulx9+aXDUHkfWgCuTTOPDK5fbd5+EHh+BeO0jFQNtBMHS7G43by8Drn5+Cu4SjCCEvkd AGfCK4FoR3k8xH/RPRzZGJ3IdBnu6QXhmpyZi8f0BRrY4KmwnPyXSZzxZ6WJOB+Cs+ER ipiY5TRSoX9CvZpnJhwFdGOfbFPVSn5s0APe+rqBJQajGA+b9MvnIZkW1zNbHizIaCm0 3+6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=eTt3Ry5R/l752rwPYmfC8oDAjRFl7qKkddSHyK2Jfg0=; b=EKFaqgCKtsygo+lGk0m9MyHwa/+hpPI8K09KAhSE8bG95Eg2H47rMZzp+qUcrWQBR4 qQGnVPbFJoKkVX4OE+1qyK5DK4VMk8xeqL5riCfVeoNmTccGjmkEvRES7O/x7Dfz/Lbc T12LuvVSheL7AgAoSmtB9vX5Ph9C0cUyyTK0IvRYzEvtP6GCRLApvtk1Ef9qiI18iwL/ 2mzz+I4W6Nwg1g4mrgM+YEkUphamSPbejlh2wgqs5VIoMPmwmLapFnV6lj+XTAZvaN/D C3gBDS0Etpsj3Kfdi2imN/anwamCO/yZnsg4Xb32zbYlGgqqhC8eFcWllGlrOjD2YGKs 28sw== X-Gm-Message-State: APjAAAXNB8zn2wf44UhLld/Ofhx8I1d1PnKUAiOfCAmD0FxnDt8BxZiz q/Rsnk2bKMtJ3Yl422xmoA8= X-Google-Smtp-Source: APXvYqzJBS0Fv4W22nz6kVi3qJTV3+2iTK+3O1ch2P1LdF9HmXA5OWGZlB7elnxuYolxniyOyjer9A== X-Received: by 2002:a5d:63c6:: with SMTP id c6mr2033029wrw.117.1568459717314; Sat, 14 Sep 2019 04:15:17 -0700 (PDT) Received: from lead (dslb-188-103-126-075.188.103.pools.vodafone-ip.de. [188.103.126.75]) by smtp.gmail.com with ESMTPSA id 17sm32222818wrl.15.2019.09.14.04.15.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 14 Sep 2019 04:15:13 -0700 (PDT) From: Federico Tedin To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: <87ef0r396q.fsf@gmail.com> <87tv9mke73.fsf@gmail.com> <87woeh197j.fsf@gmail.com> Date: Sat, 14 Sep 2019 13:15:12 +0200 In-Reply-To: <87woeh197j.fsf@gmail.com> (Federico Tedin's message of "Mon, 09 Sep 2019 22:54:56 +0200") Message-ID: <87a7b7164f.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Forgot to add '+++' above my NEWS entry, sending a new patch. - Federico --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=search.patch Content-Description: patch >From 419c60d1d96aa0af1cece39c1aeebb6ae95a558d Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Sat, 14 Sep 2019 13:02:07 +0200 Subject: [PATCH 1/1] Search packages by name in list-packages (Bug#36981) * lisp/emacs-lisp/package.el (package-menu-search): Added a new function that allows filtering packages by name. (package-menu--generate): Show full packages list with 'q' if current list has been filtered by name as well. (package-menu-mode-map): Bind 's' to package-menu-search. * test/lisp/emacs-lisp/package-tests.el (package-test-list-search): Added a test for package-menu-search. * doc/emacs/package.texi: Document usage of 'package-menu-search'. * etc/NEWS: Announce changes. --- doc/emacs/package.texi | 5 +++++ etc/NEWS | 5 +++++ lisp/emacs-lisp/package.el | 28 +++++++++++++++++++++++++-- test/lisp/emacs-lisp/package-tests.el | 11 ++++++++++- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 4b33f250c4..84de3a5103 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -142,6 +142,11 @@ Package Menu that relate to that keyword. To restore the full package list, type @kbd{q}. +@item s +Search packages by name (@code{package-menu-search}). This prompts +for a string, then shows only the packages whose names match a regexp +with that value. To restore the full package list, type @kbd{q}. + @item H Permanently hide packages that match a regexp (@code{package-menu-hide-package}). diff --git a/etc/NEWS b/etc/NEWS index 94c98a7ebe..37eb23c4a9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -968,6 +968,11 @@ early init file. *** New function 'package-activate-all'. ++++ +*** New function 'package-menu-search'. +Allows users to search packages by name on the packages list. By +default, it is bound to 's'. + --- *** Imenu support has been added to 'package-menu-mode'. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ef0c5171de..d1ff7b964d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2621,6 +2621,7 @@ package-menu-mode-map (define-key map "U" 'package-menu-mark-upgrades) (define-key map "r" 'package-menu-refresh) (define-key map "f" 'package-menu-filter) + (define-key map "s" 'package-menu-search) (define-key map "~" 'package-menu-mark-obsolete-for-deletion) (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) @@ -2652,7 +2653,8 @@ package-menu-mode-map ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] "--" - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] + ["Filter Packages by Keywords" package-menu-filter :help "Filter packages by keywords (q to go back)"] + ["Filter Packages by Name" package-menu-search :help "Filter packages by name (q to go back)"] ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] ["Display Older Versions" package-menu-toggle-hiding :style toggle :selected (not package-menu--hide-packages) @@ -2963,7 +2965,7 @@ package-menu--generate (let ((filters (mapconcat #'identity keywords ","))) (concat "Package[" filters "]")) "Package")) - (if keywords + (if (or keywords (consp packages)) (define-key package-menu-mode-map "q" 'package-show-package-list) (define-key package-menu-mode-map "q" 'quit-window)) (tabulated-list-init-header) @@ -3598,6 +3600,28 @@ package-menu-filter (list keyword) keyword))) +(defun package-menu-search (name) + "Filter the *Packages* buffer. +Show only those items whose name matches the regular expression +NAME. If NAME is nil or the empty string, show all packages. + +To restore the full package list, type `q'." + (interactive (list (read-from-minibuffer "Package name: "))) + (if (or (not name) (string-empty-p name)) + (package-show-package-list t nil) + ;; Update `tabulated-list-entries' so that in contains all + ;; packages before searching. + (package-menu--refresh t nil) + (let (matched) + (dolist (entry tabulated-list-entries) + (let* ((pkg-name-sym (package-desc-name (car entry))) + (pkg-name (symbol-name pkg-name-sym))) + (when (string-match name pkg-name) + (push pkg-name-sym matched)))) + (if matched + (package-show-package-list matched nil) + (user-error "No packages found"))))) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c757bccf67..ea28db83ce 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -28,7 +28,7 @@ ;; Run this in a clean Emacs session using: ;; -;; $ emacs -Q --batch -L . -l package-test.el -l ert -f ert-run-tests-batch-and-exit +;; $ emacs -Q --batch -L . -l package-tests.el -l ert -f ert-run-tests-batch-and-exit ;;; Code: @@ -360,6 +360,15 @@ package-test--compatible-p (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-search () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-search "tetris") + (should (= (length tabulated-list-entries) 1)) + (should (eq (package-desc-name (caar tabulated-list-entries)) 'tetris)) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () -- 2.17.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 15 20:30:08 2019 Received: (at 36981) by debbugs.gnu.org; 16 Sep 2019 00:30:08 +0000 Received: from localhost ([127.0.0.1]:48923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i9eu7-0002qY-RH for submit@debbugs.gnu.org; Sun, 15 Sep 2019 20:30:08 -0400 Received: from mail-pl1-f174.google.com ([209.85.214.174]:37260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i9eu6-0002oy-PB for 36981@debbugs.gnu.org; Sun, 15 Sep 2019 20:30:07 -0400 Received: by mail-pl1-f174.google.com with SMTP id b10so16106283plr.4 for <36981@debbugs.gnu.org>; Sun, 15 Sep 2019 17:30:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xIXOkrO5f/GhC586xmgX3dGRGxKpnbZFLx+vDfk3gfI=; b=FRCfcScFohMFO8Dq6VIYCZAOsD58ITkV7xkXPRyXNxOHBwb9Akxq9jPz+2xBKxt5zV yEjWJsoSwMlSOstl+hITAAfLqD6J7Bx1PkRnk/fFedaR54WFlmt7OoIR4r5/eKfQ9tF9 rpSo2J4+EZGtau1rLJPN90d01t+d463hhCIScP3aBqwpC793JhH9TR3xDU5Eu3qpqtat 3VSci/7wkoaSd8fW3faCN9DaIRgTh/VS/UUZYuPWcznSwX6h4pV0xaxB2TenGoSGW8mN TVrrPsQ84zE+Ep7VAqx/Ll3f2rKYdp7ZfCejeChvKgGusKobOUQXhtZvLf1SR6fZaSth Z2/w== X-Gm-Message-State: APjAAAUC0eXG41kM7DfF29sracziyiZwRS60fiEIOUCmiKcqzjaAwFu3 Y99kZfIeVf22fkKenL+LwJimOwHjwNF40LzweUw= X-Google-Smtp-Source: APXvYqxEnL7rT/TwqZb9Sk6iIAnyNhO26VgAXpOAQhXLIswgntNy9lJO86GAZ57dhSvLubkOGkcC7BOF6A3zjO2p7no= X-Received: by 2002:a17:902:326:: with SMTP id 35mr62866262pld.128.1568593800813; Sun, 15 Sep 2019 17:30:00 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> In-Reply-To: <87ef0r396q.fsf@gmail.com> From: Stefan Kangas Date: Mon, 16 Sep 2019 02:29:49 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Federico Tedin writes: > ndame writes: > > > When installing a package from list-packages it's often > > inconvenient to find a package which has a string which occurs > > many times in the packages buffer. (e.g. in the descriptions). > > > > The package buffer has f for filtering, but it filters only for > > package keywords, not names. > > > > Add a new command s for search which searches (or filters) the > > package list by a substring match on the package name. > > I've implemented this feature using the "s" key as you suggested. I'm > attaching a patch with my changes. Thanks for working on this. My first observation is that the search you have implemented works very much like the package-menu-filter command bound to "f". Maybe it would be better to put all the filtering commands on "/", and use something like the following key bindings: "/ n" - package-menu-search [from "s"] "/ k" - package-menu-filter [from "f"] And add the new command and key binding: "/ /" - package-menu-clear-filter This would be more in line with filtering in ibuffer, bookmark-bmenu, and others. Later, we could add more filters (for example to filter by status, archive, time since update, etc.). But then we probably want to rename as follows: package-menu-search => package-menu-filter-by-name package-menu-filter => package-menu-filter-by-keyword Also, this would free up the "s" key for a sorting command, which is in line with the key binding in e.g. dired. I also have some other, related ideas: 1. How about implementing an option to search only the package names using isearch? Compare to dired-isearch-filenames. 2. How about making the filtering for both package-menu-search and package-menu-filter interactive -- that is, that the commands shows the results as you type keys? One could look at bookmark-bmenu-search for inspiration. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 18 12:38:50 2019 Received: (at 36981) by debbugs.gnu.org; 18 Sep 2019 16:38:50 +0000 Received: from localhost ([127.0.0.1]:54775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAcyg-0000Mb-DU for submit@debbugs.gnu.org; Wed, 18 Sep 2019 12:38:50 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:34011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAcyf-0000MK-Av for 36981@debbugs.gnu.org; Wed, 18 Sep 2019 12:38:49 -0400 Received: by mail-wm1-f50.google.com with SMTP id y135so5201709wmc.1 for <36981@debbugs.gnu.org>; Wed, 18 Sep 2019 09:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=SqdY5K0KAtUTDuTQhe0fu5aeap0ztGJO2Ewz1SHqaT8=; b=seq7vVyCNqwpzLADuBuuLH1IaJq8D/8P0otzPw35c/+2bGjFnuz0OeJhxCEWC3esSH DdaFyLavGteIggKHms0jF+JriGcvuehrqreMUN2NaiX86oi8sUsdqPCdfwbOUgTLCzBZ dffWcHseO+QCVHiBXLwsnh/2oD8XpXaXesMx8b0lNHFe4RnkbdTGTE66D8OGgPVgFYXM fCt+vy1G285Po2JH3C8hjCHwN9Mkntc6aJHV3tE1vqgZmugU+Tgc3pTetfnKMpG5lKDo vUWGdyf437poQNde+cf4IIakFY09fAwN9e+rZdRz8XDCWeC7Szgz+I1KD/UpjfagLsI4 9lAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=SqdY5K0KAtUTDuTQhe0fu5aeap0ztGJO2Ewz1SHqaT8=; b=Wp0suo5t4epqXvw+B49Tdqrh0qUFRzaB4Io/fBsXmDqLNJgoiWbQ5O6d5Sd8vSsT5l Ea4XoahJe7cs8IWE9lz1kewaBtpcCvrNZ6psl964d/5VVEKNfluhNBaxZXoit4dlEDk6 JewJ+Dtk7fzH4am/fbnpLtuFWRJnL/8hVWjra0Q+VqSEbqGRGkbkbkR4Y4P4GzBdyOOV Qlxb8JJ7m9l2CIvbbHm5L6U+QY6ULjewXqWoMZn5NWskI6Gs02pVzaJle7T2iL+JZJUU yhgJGphbLCIfeDyIoJ9vCn+fupvXyjZr74/z8lmYcB2wBBIqh9Q+Y6jp3rhMHONbeS0Y 2o+g== X-Gm-Message-State: APjAAAVxMXIYFeQkiAXceZCLBOfUjoA/6sWzM/gXl6mnyW0Iaqr33oXW W0LLI5Bi83Vg9r8xtJPhb4kfdXzigYo= X-Google-Smtp-Source: APXvYqyJUeiLz3XoXISTfjoS03x0sips5uq7HWcQRLRwv7LPFJ/7Xjcn3YeCtuzBzHmMwOpCdBehpw== X-Received: by 2002:a05:600c:2052:: with SMTP id p18mr3575510wmg.13.1568824723053; Wed, 18 Sep 2019 09:38:43 -0700 (PDT) Received: from lead (dslb-188-103-126-075.188.103.pools.vodafone-ip.de. [188.103.126.75]) by smtp.gmail.com with ESMTPSA id c132sm4360268wme.27.2019.09.18.09.38.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Sep 2019 09:38:41 -0700 (PDT) From: Federico Tedin To: Stefan Kangas Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: <87ef0r396q.fsf@gmail.com> Date: Wed, 18 Sep 2019 18:38:39 +0200 In-Reply-To: (Stefan Kangas's message of "Mon, 16 Sep 2019 02:29:49 +0200") Message-ID: <87tv995zlc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Stefan, thanks for your input. > Thanks for working on this. > > My first observation is that the search you have implemented works > very much like the package-menu-filter command bound to "f". > > Maybe it would be better to put all the filtering commands on "/", and > use something like the following key bindings: > > "/ n" - package-menu-search [from "s"] > "/ k" - package-menu-filter [from "f"] > > And add the new command and key binding: > > "/ /" - package-menu-clear-filter > > This would be more in line with filtering in ibuffer, bookmark-bmenu, > and others. Later, we could add more filters (for example to filter > by status, archive, time since update, etc.). But then we probably > want to rename as follows: > > package-menu-search => package-menu-filter-by-name > package-menu-filter => package-menu-filter-by-keyword > > Also, this would free up the "s" key for a sorting command, which is > in line with the key binding in e.g. dired. I think the "/" prefix keybindings are a good idea; however I'm not sure if it's OK to change an already existing keybinding. But on the other hand this is a really minor thing so I imagine it's not that much of a problem. The new names you chose for the commands also make more sense than the current ones, I don't have a problem with updating them. > I also have some other, related ideas: > > 1. How about implementing an option to search only the package names > using isearch? Compare to dired-isearch-filenames. Didn't know about that command, looks really useful. The only problem I can think of implementing search that way is that it would stop being similar to `package-menu-filter', in the sense that it currently only shows packages that have matched the search, instead of jumping between packages that match. On the other hand, the way I've implemented the search is really primitive, so I guess using isearch would actually make it much more powerful. > 2. How about making the filtering for both package-menu-search and > package-menu-filter interactive -- that is, that the commands shows > the results as you type keys? One could look at bookmark-bmenu-search > for inspiration. Nice! This is the first command in Emacs that I've used that has incremental search. For this patch though I would like not to modify package-menu-filter and just stick to adding package-menu-search. For package-menu-search I like more the idea of making the command be just a regular filter (like it is now) or have it use isearch, like you suggested. - Federico From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 18 18:22:50 2019 Received: (at 36981) by debbugs.gnu.org; 18 Sep 2019 22:22:50 +0000 Received: from localhost ([127.0.0.1]:54930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAiLZ-0001nF-O0 for submit@debbugs.gnu.org; Wed, 18 Sep 2019 18:22:50 -0400 Received: from mail-pl1-f177.google.com ([209.85.214.177]:33886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAiLY-0001mz-9e for 36981@debbugs.gnu.org; Wed, 18 Sep 2019 18:22:48 -0400 Received: by mail-pl1-f177.google.com with SMTP id d3so631809plr.1 for <36981@debbugs.gnu.org>; Wed, 18 Sep 2019 15:22:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9g1Zzk4QTaHsbdiEn/CboZuaUPUPps6mWrIgM3j5OnM=; b=Yq/lAfke8Iq71GE8IcxTa1rqZKTlo0kwswg2Cl9HPTP49EKCIhvMoiU5LXQID8w/kh f+PBI+Godk94v/3RrufjKm+V914v7/cz/cp9Wb4jhc4WJJvogARDxsWxjBrItrWaQuUD 6/oGawJ6+hA24526/YChO/zCtsYZezXmJBFdEWppE42nnPO+2kCymyBiACAF5AAJx4Nr SMZrZXQ/4KS/eIFVVcGLaLx37Rn4hzW0M3yd4JtVVOkDtz/eHSWs/dZnUwW720ho52sm 191wyCkie+yFdAgGRuperuKI2i7g2276j71Gwu6MXHAcHoDxd+xlH7BkYCoLwdpKugOF 9HjA== X-Gm-Message-State: APjAAAXS7bJrxKlghdt65N5pm4aw3oBS5b3RyKLVihC+KuEdJSN2+oHL TRfV6xCuEWjJ/DN0nTJ/vPz/dAzhQXEiUwYly2Q= X-Google-Smtp-Source: APXvYqwKSD12ndLu0RC2Lgr3JrtHd5E4/TNROuAls8rvKM5p7Hmfb2Iuyqn/AMJBgCzvciFNz1794GCH+SqevD8+P/A= X-Received: by 2002:a17:902:8b8c:: with SMTP id ay12mr6207489plb.251.1568845362444; Wed, 18 Sep 2019 15:22:42 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> In-Reply-To: <87tv995zlc.fsf@gmail.com> From: Stefan Kangas Date: Thu, 19 Sep 2019 00:22:30 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Federico Tedin writes: > Hi Stefan, thanks for your input. Hi again, and thanks for considering it. > I think the "/" prefix keybindings are a good idea; however I'm not sure > if it's OK to change an already existing keybinding. But on the other > hand this is a really minor thing so I imagine it's not that much of a > problem. The new names you chose for the commands also make more sense > than the current ones, I don't have a problem with updating them. It's neither a critical key binding nor a very long-standing one, so I don't see the harm in changing it to a more logical one. We'd have to announce the change in NEWS though. Of course, I'm not in any position to make any decisions around here, so that's just my opinion. If you agree, perhaps you'd be interested in adding that change to your suggested patch. On the other hand, just sticking to implementing the already suggested command would also be an improvement. But might I suggest that you in any case name the command package-menu-filter-by-name? It seems to me that it better describe what this function does. > > 1. How about implementing an option to search only the package names > > using isearch? Compare to dired-isearch-filenames. > > Didn't know about that command, looks really useful. The only problem I > can think of implementing search that way is that it would stop being > similar to `package-menu-filter', in the sense that it currently only > shows packages that have matched the search, instead of jumping between > packages that match. On the other hand, the way I've implemented the > search is really primitive, so I guess using isearch would actually make > it much more powerful. I don't want to discourage you from continuing work on the filter command by floating this idea. Having filter commands and an isearch option are not mutually exclusive. On the contrary, I could see myself wanting to use both. Perhaps it's better to regard this idea as separate from the "filter by name" command for now. Maybe I shouldn't have sidetracked this issue by even raising it, but it's good to hear that you agree that it's not a bad idea. > > 2. How about making the filtering for both package-menu-search and > > package-menu-filter interactive -- that is, that the commands shows > > the results as you type keys? One could look at bookmark-bmenu-search > > for inspiration. > > Nice! This is the first command in Emacs that I've used that has > incremental search. For this patch though I would like not to modify > package-menu-filter and just stick to adding package-menu-search. Sounds good to me. We could always revisit the idea of making them incremental later. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 18 19:18:03 2019 Received: (at 36981) by debbugs.gnu.org; 18 Sep 2019 23:18:03 +0000 Received: from localhost ([127.0.0.1]:54959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAjD0-0003Ym-GI for submit@debbugs.gnu.org; Wed, 18 Sep 2019 19:18:03 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAjCy-0003YK-Gs for 36981@debbugs.gnu.org; Wed, 18 Sep 2019 19:18:01 -0400 Received: by mail-pf1-f193.google.com with SMTP id q10so1002105pfl.0 for <36981@debbugs.gnu.org>; Wed, 18 Sep 2019 16:18:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vxtH8HREWfOqblm+A8S0YHnrZQSjgJ8gcGsjtAl8jz4=; b=q0Y8HPHP47CRxPImYWYD94sm8qQrpCTBBUws5hcZOUpG+iWDqPswZXMMTJ75/yNafw oLqHDTjWbiz4kg5+dGL8MgJv+NWROBh/sT+/Zwq1nHQ1YffBItpWjg5mMx/GAT4PQdK9 oVQO2bVSzOYlTz+vcR8wOasXfs6pWHx93q3sHahXmAsCuxFAYa5bBvknoekFNq30SnCw XSM+GlI0LAf3IxgNEWoXzDcuqpt5Psvo+yelB8trbScdz1KIlfAZ7gKDmwlr6VQ8Hb5d sDn9p454jmER5YJK/CtSFl0YVxjtUvsWOYfYo+jPe5ed6NGFP0RlboqztR9g+N+etn9T gmFQ== X-Gm-Message-State: APjAAAWQ1lRV4N/lWMN5p2M5pnZhgwdMucw5BPh6DQcjhuJDdZzcoxhQ 8PWFiYquBLPVy2RLdQpkjFNl422950O0iAIx40o= X-Google-Smtp-Source: APXvYqzURm4XosX8ebZIXqGFBvnjPqCpmeE4wDdPwScUnuxghDzLmVSdBvmQZAN5pnXr9shh4t5Osu+zkWSiFUQpZ9U= X-Received: by 2002:aa7:8009:: with SMTP id j9mr6822622pfi.107.1568848674790; Wed, 18 Sep 2019 16:17:54 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> <87tv9mke73.fsf@gmail.com> <87woeh197j.fsf@gmail.com> <87a7b7164f.fsf@gmail.com> In-Reply-To: <87a7b7164f.fsf@gmail.com> From: Stefan Kangas Date: Thu, 19 Sep 2019 01:17:43 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: multipart/alternative; boundary="000000000000f7a1bc0592dc0b87" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame , =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --000000000000f7a1bc0592dc0b87 Content-Type: text/plain; charset="UTF-8" Hi Federico, Here's a more detailed review of your patch. Federico Tedin writes: > Subject: [PATCH 1/1] Search packages by name in list-packages (Bug#36981) Perhaps instead: "Filter packages by name in list-packages." > * lisp/emacs-lisp/package.el (package-menu-search): Added a new > function that allows filtering packages by name. Or, shorter: "New function to filter packages by name." > (package-menu--generate): Show full packages list with 'q' if current > list has been filtered by name as well. > (package-menu-mode-map): Bind 's' to package-menu-search. > * test/lisp/emacs-lisp/package-tests.el (package-test-list-search): > Added a test for package-menu-search. We prefer the imperative rather than the past tense in commit messages, so that should just be "Add". > +Search packages by name (@code{package-menu-search}). This prompts Suggest to change "Search" to "Filter". > +(defun package-menu-search (name) Suggest to rename to package-menu-filter-by-name > + "Filter the *Packages* buffer. I suggest "Filter the \"*Packages\" buffer by NAME. > + (interactive (list (read-from-minibuffer "Package name: "))) I suggest "Filter by name (regexp): " > + (if (or (not name) (string-empty-p name)) > + (package-show-package-list t nil) > + ;; Update `tabulated-list-entries' so that in contains all "in" -> "it" > + (let (matched) > + (dolist (entry tabulated-list-entries) > + (let* ((pkg-name-sym (package-desc-name (car entry))) > + (pkg-name (symbol-name pkg-name-sym))) This is nitpicking, but perhaps it would be easier to read if you use only one variable here. That means to keep "pkg-name-sym" but rename it to "pkg-name", and... > + (when (string-match name pkg-name) ... changing this to (when (string-match name (symbol-name pkg-name)) That would be preference, anyways. > +(ert-deftest package-test-list-search () > + "Ensure package list is filtered correctly by package name." > + (with-package-test () > + (let ((buf (package-list-packages))) > + (package-menu-search "tetris") > + (should (= (length tabulated-list-entries) 1)) > + (should (eq (package-desc-name (caar tabulated-list-entries)) 'tetris)) > + (kill-buffer buf)))) Wouldn't it be better to verify the buffer contents here? That way we it's less coupled to the implementation of tabulated-list-mode. Best regards, Stefan Kangas --000000000000f7a1bc0592dc0b87 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Federico,

Here's a more detailed review of y= our patch.

Federico Tedin <federicotedin@gmail.com> writes:

> Subject: [PATCH 1/= 1] Search packages by name in list-packages (Bug#36981)

Perhaps inst= ead: "Filter packages by name in list-packages."

> * li= sp/emacs-lisp/package.el (package-menu-search): Added a new
> functio= n that allows filtering packages by name.

Or, shorter: "New fun= ction to filter packages by name."

> (package-menu--generate= ): Show full packages list with 'q' if current
> list has bee= n filtered by name as well.
> (package-menu-mode-map): Bind 's= 9; to package-menu-search.
> * test/lisp/emacs-lisp/package-tests.el = (package-test-list-search):
> Added a test for package-menu-search.
We prefer the imperative rather than the past tense in commit message= s,
so that should just be "Add".

> +Search packages = by name (@code{package-menu-search}).=C2=A0 This prompts

Suggest to = change "Search" to "Filter".

> +(defun packag= e-menu-search (name)

Suggest to rename to package-menu-filter-by-nam= e

> + =C2=A0"Filter the *Packages* buffer.

I suggest = "Filter the \"*Packages\" buffer by NAME.

> + =C2= =A0(interactive (list (read-from-minibuffer "Package name: ")))
I suggest "Filter by name (regexp): "

> + =C2=A0(= if (or (not name) (string-empty-p name))
> + =C2=A0 =C2=A0 =C2=A0(pac= kage-show-package-list t nil)
> + =C2=A0 =C2=A0;; Update `tabulated-l= ist-entries' so that in contains all

"in" -> "= it"

> + =C2=A0 =C2=A0(let (matched)
> + =C2=A0 =C2=A0 = =C2=A0(dolist (entry tabulated-list-entries)
> + =C2=A0 =C2=A0 =C2=A0= =C2=A0(let* ((pkg-name-sym (package-desc-name (car entry)))
> + =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (pkg-name (symbol-name pkg-na= me-sym)))

This is nitpicking, but perhaps it would be easier to read= if you use
only one variable here.=C2=A0 That means to keep "pkg-n= ame-sym" but rename it
to "pkg-name", and...

> = + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (string-match name pkg-name)
<= br>... changing this to (when (string-match name (symbol-name pkg-name))
That would be preference, anyways.

> +(ert-deftest package-t= est-list-search ()
> + =C2=A0"Ensure package list is filtered co= rrectly by package name."
> + =C2=A0(with-package-test ()
>= ; + =C2=A0 =C2=A0(let ((buf (package-list-packages)))
> + =C2=A0 =C2= =A0 =C2=A0(package-menu-search "tetris")
> + =C2=A0 =C2=A0 = =C2=A0(should (=3D (length tabulated-list-entries) 1))
> + =C2=A0 =C2= =A0 =C2=A0(should (eq (package-desc-name (caar tabulated-list-entries)) = 9;tetris))
> + =C2=A0 =C2=A0 =C2=A0(kill-buffer buf))))

Wouldn= 't it be better to verify the buffer contents here?=C2=A0 That way weit's less coupled to the implementation of tabulated-list-mode.
Best regards,
Stefan Kangas
--000000000000f7a1bc0592dc0b87-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 19 16:49:29 2019 Received: (at 36981) by debbugs.gnu.org; 19 Sep 2019 20:49:29 +0000 Received: from localhost ([127.0.0.1]:56491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iB3Mm-000097-LF for submit@debbugs.gnu.org; Thu, 19 Sep 2019 16:49:28 -0400 Received: from bongo.elm.relay.mailchannels.net ([23.83.212.21]:53223) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iB3Mk-00008x-Sv for 36981@debbugs.gnu.org; Thu, 19 Sep 2019 16:49:27 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CAB7E501CBB; Thu, 19 Sep 2019 20:49:25 +0000 (UTC) Received: from pdx1-sub0-mail-a17.g.dreamhost.com (100-96-6-94.trex.outbound.svc.cluster.local [100.96.6.94]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id D1A2950217F; Thu, 19 Sep 2019 20:49:24 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a17.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.5); Thu, 19 Sep 2019 20:49:25 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Shade-Spicy: 0b624ddd33823651_1568926165087_2307555865 X-MC-Loop-Signature: 1568926165087:1490716305 X-MC-Ingress-Time: 1568926165087 Received: from pdx1-sub0-mail-a17.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a17.g.dreamhost.com (Postfix) with ESMTP id 7DB57836B4; Thu, 19 Sep 2019 13:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=cMao4IcTfEmJ37FPDWbR8szopyU=; b= H54xIB1h1j6DjyQ/nIWExhH/XnOrVbxi0a7CjfpUNbhhKiNNNuVrNj87LarsCzvz rgNwfyRJZUjasWeAeU8qKqY/BwvfvBGfCQJvVHnjpxDAgiOQJOmvZ0Kv47Vi2tZy vigVyYYMOuS6SabLZPTc+icba0ShRD0qjjnQkv4jucM= Received: from mail.jurta.org (m91-129-107-243.cust.tele2.ee [91.129.107.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a17.g.dreamhost.com (Postfix) with ESMTPSA id 56D4B836B1; Thu, 19 Sep 2019 13:49:16 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a17 From: Juri Linkov To: Stefan Kangas Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages Organization: LINKOV.NET References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> Date: Thu, 19 Sep 2019 23:29:30 +0300 In-Reply-To: (Stefan Kangas's message of "Thu, 19 Sep 2019 00:22:30 +0200") Message-ID: <87h858ryot.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgdduheehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdejrddvgeefnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtjedrvdegfedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehsthgvfhgrnhesmhgrrhigihhsthdrshgvnecuvehluhhsthgvrhfuihiivgepud X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame , Federico Tedin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > I don't want to discourage you from continuing work on the filter > command by floating this idea. Having filter commands and an isearch > option are not mutually exclusive. On the contrary, I could see > myself wanting to use both. > > Perhaps it's better to regard this idea as separate from the "filter > by name" command for now. Maybe I shouldn't have sidetracked this > issue by even raising it, but it's good to hear that you agree that > it's not a bad idea. I agree, let's first have a basic implementation of "filter by name", and then maybe add an isearch option later. The way currently I have to search by name is to start isearch, type a name, and open occur from isearch. Then jumping from the *Occur* buffer back to packages is so ugly workaround for having a proper filter by name. Filtering a huge list of packages will improve the current situation. (Another useful command would be "filter by description and name" like in Synaptic package manager.) From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 20 14:49:54 2019 Received: (at 36981) by debbugs.gnu.org; 20 Sep 2019 18:49:54 +0000 Received: from localhost ([127.0.0.1]:58491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBNyc-0004xs-HK for submit@debbugs.gnu.org; Fri, 20 Sep 2019 14:49:54 -0400 Received: from mail-ed1-f49.google.com ([209.85.208.49]:34057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBNya-0004xc-Jv for 36981@debbugs.gnu.org; Fri, 20 Sep 2019 14:49:53 -0400 Received: by mail-ed1-f49.google.com with SMTP id p10so7420228edq.1 for <36981@debbugs.gnu.org>; Fri, 20 Sep 2019 11:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oKWtdi87+wqFKkG9f4yutHS/UCa44tfyyyBgtgS2sig=; b=s/M4bvPPuCmA6COwQTvYqkvcr3cc1Zt8LtMuKZgzxARPYmaJb3JUcIr6/dV7z+woHH YG0PWfXhEpyMOWhO5meukfCfVBULPapWCHAVelVlzWZmjpt7AVPp6+S9h2rL7fZc7n6/ xvoqDcS0dyod49gwcuFkuCpqv5fD8cWCuaASnoSlGO6FLQirHk6GOxxcp3dNquDHYcRh vKGyRGLxQTxgZkFbuEDBV4qJq0BgzerhYbyOfRv51mPEm/zoDl6+rC3gDEdBFDMJ0NIo XB0QuxP/6aTBoGlxhdUNtlOm8pe6gdMB2GuXJgRkr7GIOpBWbjsIR+zsRReZzYK05w7h Q0cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=oKWtdi87+wqFKkG9f4yutHS/UCa44tfyyyBgtgS2sig=; b=QWkwbTjfpwNojYpPGynwdK6n7M6/Gro9m67xfz7GxmpPLUSnhlFrekP6cX3UZ0j3Oh jksuOCMBCOo1MBaCYnh86W/8Cc0dkG3va9+RFJ8smJIob0VYacwysXYQUjvPbpDthKCf vf3lczSHXmTjzLbLlSRNb1m3RDS4PaZEygJ48LTNU2js9Yo1RlWNiyVUXT/N2YYsVKpV uKJ+bLK0XIL2KRRLU7jn46vztQKz186ig34m6HEGkW2aQKXxM2iKEWEt32y5jBDPZtsQ 6C/DOAJ1r7g4LLqY360TQajrTrLSy34bmzAAX2GlR+BPHoqJFKdm+oIIFfb3nKgz1NZN TLLw== X-Gm-Message-State: APjAAAVDEnsO9AZwwJMkQlkFd6ZzQXnq+K+LyJCggyY7FMxWlLb81zUU QduiUa26SEG/ks8GtEUJUSg= X-Google-Smtp-Source: APXvYqwTR8NUdSjmH+oXoHtXhgHh2NWSXdKInySrTx2taiM5BtweP32Vm4ehizcbL88ogP7jg03KZg== X-Received: by 2002:a17:907:2042:: with SMTP id pg2mr20469399ejb.97.1569005386656; Fri, 20 Sep 2019 11:49:46 -0700 (PDT) Received: from lead (dslb-188-103-126-075.188.103.pools.vodafone-ip.de. [188.103.126.75]) by smtp.gmail.com with ESMTPSA id a8sm319063ejp.58.2019.09.20.11.49.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Sep 2019 11:49:45 -0700 (PDT) From: Federico Tedin To: Juri Linkov Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> Date: Fri, 20 Sep 2019 20:49:45 +0200 In-Reply-To: <87h858ryot.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 19 Sep 2019 23:29:30 +0300") Message-ID: <87ef0aajli.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> I don't want to discourage you from continuing work on the filter >> command by floating this idea. Having filter commands and an isearch >> option are not mutually exclusive. On the contrary, I could see >> myself wanting to use both. >> >> Perhaps it's better to regard this idea as separate from the "filter >> by name" command for now. Maybe I shouldn't have sidetracked this >> issue by even raising it, but it's good to hear that you agree that >> it's not a bad idea. > > I agree, let's first have a basic implementation of "filter by name", > and then maybe add an isearch option later. The way currently I have > to search by name is to start isearch, type a name, and open occur > from isearch. Then jumping from the *Occur* buffer back to packages > is so ugly workaround for having a proper filter by name. > Filtering a huge list of packages will improve the current situation. > (Another useful command would be "filter by description and name" > like in Synaptic package manager.) No problem then, I'll change the function names as Stefan suggested: package-menu-search => package-menu-filter-by-name package-menu-filter => package-menu-filter-by-keyword Then, I'll add the new keybindings and also address the feedback he gave me regarding my last patch. Thanks for the feedback! From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 20 18:09:54 2019 Received: (at 36981) by debbugs.gnu.org; 20 Sep 2019 22:09:54 +0000 Received: from localhost ([127.0.0.1]:58703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBR6A-0004ES-ER for submit@debbugs.gnu.org; Fri, 20 Sep 2019 18:09:54 -0400 Received: from mail-pg1-f182.google.com ([209.85.215.182]:36979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBR68-0004ED-Fr for 36981@debbugs.gnu.org; Fri, 20 Sep 2019 18:09:52 -0400 Received: by mail-pg1-f182.google.com with SMTP id c17so4599248pgg.4 for <36981@debbugs.gnu.org>; Fri, 20 Sep 2019 15:09:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TDQquLFJl55FQplWQn1SzdKyL1vtqU+pXE3OGtAicoM=; b=XsvyyqvRfwtN8ICGS+1LROAbIDbK7FD/hGF2ovtPUHX19uKreXFJf2vPHVvRBCCe3/ FlqqjP5NcuN2yDtEADrafxfk/Zd/90dvB58yZGkiNIiQjko/ajzS4VNXsS63Z4WGDxWy CrwNRLi1z5focBGnGocHyXuT9fvMWwnakbPO5+vtKRyEb+zg/fWJU1CkbpD+4ijF2Kcg sThC7A1vreMKKJPcT3fVIsxV1F/4lfrFbXKB3hTfikUN378un5+gzzEibmeI9sJBC7Cf Bh8f84dNfQc6Kq5ZWiapbYTg5w/fb85owQ4jdmmz3rVuFLZd+An0f72aOIFAOnlc+AoJ kQBQ== X-Gm-Message-State: APjAAAU1xhqsuc/9vYo7lIkd7D/xhwiT1wyjQHegkrDIxVw4rUcVyZS9 w2iSFy67ddlTHUqiKMTixh5s0vti/PTpTZCXpJI= X-Google-Smtp-Source: APXvYqyd9GtuW8jY/opI3cwRQLt1B/irUb0JSuFACL6hiXun0dz96TvP3547mQhPtsO6FaTkyT/ZZMw8iTiXi8oiChg= X-Received: by 2002:a17:90a:1150:: with SMTP id d16mr7403531pje.2.1569017385443; Fri, 20 Sep 2019 15:09:45 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> <87ef0aajli.fsf@gmail.com> In-Reply-To: <87ef0aajli.fsf@gmail.com> From: Stefan Kangas Date: Sat, 21 Sep 2019 00:09:34 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame , Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) Federico Tedin writes: > No problem then, I'll change the function names as Stefan suggested: > > package-menu-search => package-menu-filter-by-name > package-menu-filter => package-menu-filter-by-keyword > > Then, I'll add the new keybindings and also address the feedback he gave > me regarding my last patch. Thanks for the feedback! Sounds great, thanks. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 26 14:28:30 2019 Received: (at 36981) by debbugs.gnu.org; 26 Sep 2019 18:28:30 +0000 Received: from localhost ([127.0.0.1]:45121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYVC-00072M-6h for submit@debbugs.gnu.org; Thu, 26 Sep 2019 14:28:30 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]:38734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYVA-000727-6c for 36981@debbugs.gnu.org; Thu, 26 Sep 2019 14:28:29 -0400 Received: by mail-wm1-f48.google.com with SMTP id 3so3611881wmi.3 for <36981@debbugs.gnu.org>; Thu, 26 Sep 2019 11:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Z1GqAz6g/uicjADl5lCBtayvuxNuKdy0+SLglD4taMg=; b=m1+NiJTx7T3zuTTelnLZqIqgwGDanzAiww2amtPJy8gkZI0oP1OFoDn4tE+rdjLrEw Bh/xjij8dp4MrqFoyk1I98g96NELz+XVQgZrTtmquvIYwlLjctH+Yr2EE30Abm/4UivQ dlqRIedzN2sBAHHAbLYAbCLdtdclOF6halWLzx6PZUKwqKXNlej8lJIEns1G348DrSCs IlezzA88sekcqs4Jzy0CeYWp9UstO9xUNIxp/M8eWtgmv9IUgnvsNBvjO1CGTgrWOrwF cNBFmx6+ZZf8WW2dyusLsRznFeRnyhYU71JgbEiBGIUC7qgmOGpxXdNU1g7otSZeiGLj ny+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Z1GqAz6g/uicjADl5lCBtayvuxNuKdy0+SLglD4taMg=; b=M4QDYgsi0RagEwDCWDmS94My7mpkykaLq0ccbe4ZElh56vN8TevpPwJtpeFFtRx2vC Sf4s8fkYCG2BFH7K03QC6C44+swbQ2I1XcALpBJkjEonq+K2lqucFoeXI8X7zgr9dQUf Ll3g5rioZ6qXdSeW+Biw9jDmHJkH5X5b6de6YVvG/iOUNPO0BvdFpXzxEFQLkQhaMyBP Yr6aAZddk1/4J1TFyHIED99r588pKi2XTYcU0VbYh24Ud7tEV/ZjvkUlZlamFtWL6iCK 0UyL5Rce1G+Blj+8mW8wFMAAZQlHp21tgPQeXhMPb3d8bjFQ47bmhtjm5HKWOetwxGuX 7XGg== X-Gm-Message-State: APjAAAU/nw7j53jrOFFNjavFPrniO/KN5bU8+gwADDRP3F+e1mbQ1aST KhWkyMnGDk5Es3gNIQiph5Y= X-Google-Smtp-Source: APXvYqzoeEOMBnmdbh6p8x2cEg4KNql8hdErwUZGgpUBRnkWcr74hs6Xnji/uslLILa/01gYH6oQRQ== X-Received: by 2002:a1c:980e:: with SMTP id a14mr3893789wme.99.1569522501584; Thu, 26 Sep 2019 11:28:21 -0700 (PDT) Received: from lead (dslb-178-008-086-051.178.008.pools.vodafone-ip.de. [178.8.86.51]) by smtp.gmail.com with ESMTPSA id e30sm46329wra.48.2019.09.26.11.28.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 11:28:19 -0700 (PDT) From: Federico Tedin To: Stefan Kangas Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> <87ef0aajli.fsf@gmail.com> Date: Thu, 26 Sep 2019 20:28:18 +0200 In-Reply-To: (Stefan Kangas's message of "Sat, 21 Sep 2019 00:09:34 +0200") Message-ID: <875zle9akd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame , Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Stefan, Juri, here's a new version of the patch for filtering packages by name. Because I added the new function `package-menu-clear-filter' (bound to '/ /'), I decided to remove the behavior in `package-menu--generate' that previously bound 'q' to clearing the filter. I think it's better the way it is now because the user can now bind `package-menu-clear-filter' to whatever they like. Thanks! - Federico --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=search.patch Content-Description: patch >From c38a35406a9c76d5bf5479d01aee169a056a254c Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Thu, 26 Sep 2019 19:18:58 +0200 Subject: [PATCH 1/1] Filter packages by name in list-packages. (Bug#36981) * lisp/emacs-lisp/package.el (package-menu-filter-by-name): New function to filter packages by name. (package-menu-clear-filter): New function to clear applied filters. (package-menu-filter-by-keyword): Rename function from package-menu-filter. (package-menu--generate): Don't change 'q' binding anymore. (package-menu-mode-map): Bind '/ n' to package-menu-filter-by-name, '/ k' to package-menu-filter-by-keyword and '/ /' to package-menu-clear-filter. (package-menu-mode-menu): Update menu entries for the three functions. * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name): Add a test for package-menu-filter-by-name. (package-test-list-clear-filter): Add a test for package-menu-clear-filter. * doc/emacs/package.texi: Document usage of package-menu-filter-by-name, package-menu-clear-filter and update reference to package-menu-filter-by-keyword. * etc/NEWS: Announce changes. --- doc/emacs/package.texi | 19 ++++++++---- etc/NEWS | 16 ++++++++++ lisp/emacs-lisp/package.el | 43 ++++++++++++++++++++------- test/lisp/emacs-lisp/package-tests.el | 24 ++++++++++++++- 4 files changed, 85 insertions(+), 17 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 2c09ca8902..f7ff4f01a1 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -136,11 +136,20 @@ Package Menu the list of available packages from the package archive again, and recomputes the package list. -@item f -Filter the package list (@code{package-menu-filter}). This prompts -for a keyword (e.g., @samp{games}), then shows only the packages -that relate to that keyword. To restore the full package list, -type @kbd{q}. +@item / k +Filter the package list by keyword +(@code{package-menu-filter-by-keyword}). This prompts for a keyword +(e.g., @samp{games}), then shows only the packages that relate to that +keyword. + +@item / s +Filter the package list by name (@code{package-menu-filter-by-name}). +This prompts for a string, then shows only the packages whose names +match a regexp with that value. + +@item / / +Clear filter currently applied to the package list +(@code{package-menu-clear-filter}). @item H Permanently hide packages that match a regexp diff --git a/etc/NEWS b/etc/NEWS index 09394432aa..75b01f7372 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -974,6 +974,22 @@ early init file. *** New function 'package-activate-all'. ++++ +*** New function 'package-menu-filter-by-name'. +Allows users to filter packages by name on the packages list. By +default, it is bound to '/ n'. To clear the filter, use '/ /'. + ++++ +*** Function 'package-menu-fiter-by-keyword' has been renamed +from 'package-menu-filter'. Its keybinding has also been changed to +'/ k' (from 'f'). To clear the filter, '/ /' must now be used instead +of 'q'. + ++++ +*** New function 'package-menu-clear-filter' +Allows users to clear a filter applied with 'package-menu-filter-by-name' or +'package-menu-filter-by-keyword'. + --- *** Imenu support has been added to 'package-menu-mode'. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a8362cb205..ef3da5298c 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2667,7 +2667,9 @@ package-menu-mode-map (define-key map "i" 'package-menu-mark-install) (define-key map "U" 'package-menu-mark-upgrades) (define-key map "r" 'package-menu-refresh) - (define-key map "f" 'package-menu-filter) + (define-key map (kbd "/ k") 'package-menu-filter-by-keyword) + (define-key map (kbd "/ n") 'package-menu-filter-by-name) + (define-key map (kbd "/ /") 'package-menu-clear-filter) (define-key map "~" 'package-menu-mark-obsolete-for-deletion) (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) @@ -2699,7 +2701,9 @@ package-menu-mode-map ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] "--" - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] + ["Filter Packages by Keyword" package-menu-filter-by-keyword :help "Filter packages by keyword"] + ["Filter Packages by Name" package-menu-filter-by-name :help "Filter packages by name"] + ["Clear Packages Filter" package-menu-clear-filter :help "Clear package list filter"] ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] ["Display Older Versions" package-menu-toggle-hiding :style toggle :selected (not package-menu--hide-packages) @@ -3010,9 +3014,6 @@ package-menu--generate (let ((filters (mapconcat #'identity keywords ","))) (concat "Package[" filters "]")) "Package")) - (if keywords - (define-key package-menu-mode-map "q" 'package-show-package-list) - (define-key package-menu-mode-map "q" 'quit-window)) (tabulated-list-init-header) (tabulated-list-print remember-pos)) @@ -3627,9 +3628,7 @@ package-show-package-list (select-window win) (switch-to-buffer buf)))) -;; package-menu--generate rebinds "q" on the fly, so we have to -;; hard-code the binding in the doc-string here. -(defun package-menu-filter (keyword) +(defun package-menu-filter-by-keyword (keyword) "Filter the *Packages* buffer. Show only those items that relate to the specified KEYWORD. @@ -3640,9 +3639,7 @@ package-menu-filter KEYWORD can also be used to filter by status or archive name by using keywords like \"arc:gnu\" and \"status:available\". Statuses available include \"incompat\", \"available\", -\"built-in\" and \"installed\". - -To restore the full package list, type `q'." +\"built-in\" and \"installed\"." (interactive (list (completing-read-multiple "Keywords (comma separated): " (package-all-keywords)))) @@ -3650,6 +3647,30 @@ package-menu-filter (list keyword) keyword))) +(defun package-menu-filter-by-name (name) + "Filter the *Packages* buffer by NAME. +Show only those items whose name matches the regular expression +NAME. If NAME is nil or the empty string, show all packages." + (interactive (list (read-from-minibuffer "Filter by name (regexp): "))) + (if (or (not name) (string-empty-p name)) + (package-show-package-list t nil) + ;; Update `tabulated-list-entries' so that it contains all + ;; packages before searching. + (package-menu--refresh t nil) + (let (matched) + (dolist (entry tabulated-list-entries) + (let* ((pkg-name (package-desc-name (car entry)))) + (when (string-match name (symbol-name pkg-name)) + (push pkg-name matched)))) + (if matched + (package-show-package-list matched nil) + (user-error "No packages found"))))) + +(defun package-menu-clear-filter () + "Clear any filter currently applied to the *Packages* buffer." + (interactive) + (package-menu--generate t t)) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c757bccf67..a2ee9f06b1 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -28,7 +28,7 @@ ;; Run this in a clean Emacs session using: ;; -;; $ emacs -Q --batch -L . -l package-test.el -l ert -f ert-run-tests-batch-and-exit +;; $ emacs -Q --batch -L . -l package-tests.el -l ert -f ert-run-tests-batch-and-exit ;;; Code: @@ -360,6 +360,28 @@ package-test--compatible-p (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-filter-by-name () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-filter-by-name "tetris") + (goto-char (point-min)) + (should (re-search-forward "^\\s-+tetris" nil t)) + (should (= (count-lines (point-min) (point-max)) 1)) + (kill-buffer buf)))) + +(ert-deftest package-test-list-clear-filter () + "Ensure package list filter is cleared correctly." + (with-package-test () + (let ((buf (package-list-packages))) + (let ((num-packages (count-lines (point-min) (point-max)))) + (should (> num-packages 1)) + (package-menu-filter-by-name "tetris") + (should (= (count-lines (point-min) (point-max)) 1)) + (package-menu-clear-filter) + (should (= (count-lines (point-min) (point-max)) num-packages))) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () -- 2.17.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 27 06:32:40 2019 Received: (at 36981) by debbugs.gnu.org; 27 Sep 2019 10:32:40 +0000 Received: from localhost ([127.0.0.1]:45887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDnYF-00072D-Ss for submit@debbugs.gnu.org; Fri, 27 Sep 2019 06:32:40 -0400 Received: from mail-pf1-f176.google.com ([209.85.210.176]:34214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDnYD-000720-LD for 36981@debbugs.gnu.org; Fri, 27 Sep 2019 06:32:38 -0400 Received: by mail-pf1-f176.google.com with SMTP id b128so1355566pfa.1 for <36981@debbugs.gnu.org>; Fri, 27 Sep 2019 03:32:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wB4BEMyB+hJgjP1y9XCytPxDOfxASx65xfCMmV37I5o=; b=txCfPfv0MxBNRpMUOKdx+jS4ayHT6RBeBcRE54YPe81yDCEuyBSw6/fdk2ojsuaVhk mloddMSVdsSOUuQXQxsYoLYFI3luO/UcjsPrYKg9tIm3Mzt60xdeXF8Fld6s0E0cEeup LaRzviSdwemdey4E40fCf68ivhu32/InzEctEim4RYPCo/cbJoz9CarxlrwAoj37/I2w uF9Oan9GoBWeygooWccAbwbw6crDWHiZn0a8FFtoeNEBa/0npNBd9clo2ccdIXt0cDaD O9yLSm3iy7fNbavbfoOaclLp5EuB2TY9XRg3FcLnhxnqlZxQ0o++FVl1cEWndtPWG56y kg/g== X-Gm-Message-State: APjAAAUNqqwnyoheana5oiaxEY0IYDJyKIMlhVJSx5H6Rcp8VVmQPXf1 m0aEInwjervDp9hMWXT8wNYIyJ8XdbxXJnr1a/c= X-Google-Smtp-Source: APXvYqyAFgAedrTwE/Mo6YyK2tgOnVw3eVmZgTNy3KPbpGN9MGp+VrglZxVlcmbZqP1MEW5x2Q73F9Q7o7PBAi9tAT0= X-Received: by 2002:a17:90a:1150:: with SMTP id d16mr9405908pje.2.1569580351720; Fri, 27 Sep 2019 03:32:31 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> <87ef0aajli.fsf@gmail.com> <875zle9akd.fsf@gmail.com> In-Reply-To: <875zle9akd.fsf@gmail.com> From: Stefan Kangas Date: Fri, 27 Sep 2019 12:32:20 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org, ndame , Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Federico Tedin writes: > Stefan, Juri, here's a new version of the patch for filtering packages > by name. Thanks. Looks good to me, and the code seems to work as announced. Nit-picks below. > Because I added the new function `package-menu-clear-filter' (bound to > '/ /'), I decided to remove the behavior in `package-menu--generate' > that previously bound 'q' to clearing the filter. I think it's better > the way it is now because the user can now bind > `package-menu-clear-filter' to whatever they like. Yes, that sounds like the right thing. > * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name): > Add a test for package-menu-filter-by-name. > (package-test-list-clear-filter): Add a test for > package-menu-clear-filter. Perhaps just: * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name) (package-test-list-clear-filter): New tests. > +@item / s > +Filter the package list by name (@code{package-menu-filter-by-name}). That should be "/ n" as below. > ++++ > +*** New function 'package-menu-filter-by-name'. > +Allows users to filter packages by name on the packages list. By > +default, it is bound to '/ n'. To clear the filter, use '/ /'. > + > ++++ > +*** Function 'package-menu-fiter-by-keyword' has been renamed > +from 'package-menu-filter'. Its keybinding has also been changed to > +'/ k' (from 'f'). To clear the filter, '/ /' must now be used instead > +of 'q'. > + > ++++ > +*** New function 'package-menu-clear-filter' > +Allows users to clear a filter applied with 'package-menu-filter-by-name' or > +'package-menu-filter-by-keyword'. Perhaps this would be better as just one item where all changes are explained together? > @@ -2699,7 +2701,9 @@ package-menu-mode-map > ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] > > "--" > - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] > + ["Filter Packages by Keyword" package-menu-filter-by-keyword :help "Filter packages by keyword"] > + ["Filter Packages by Name" package-menu-filter-by-name :help "Filter packages by name"] > + ["Clear Packages Filter" package-menu-clear-filter :help "Clear package list filter"] This is fine by me, but perhaps it would be better to add a submenu for filtering? Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 30 17:27:00 2019 Received: (at 36981) by debbugs.gnu.org; 30 Sep 2019 21:27:00 +0000 Received: from localhost ([127.0.0.1]:60608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF3C7-0000VR-ST for submit@debbugs.gnu.org; Mon, 30 Sep 2019 17:27:00 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:35573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF3C5-0000V9-Gz for 36981@debbugs.gnu.org; Mon, 30 Sep 2019 17:26:58 -0400 Received: by mail-wr1-f49.google.com with SMTP id v8so12992060wrt.2 for <36981@debbugs.gnu.org>; Mon, 30 Sep 2019 14:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=HZEWbwvG7GhU57ah0XB2xvKc4td0naFZ7/yht4hhUVc=; b=ABEY9/H+pKJZQRAARWSkEoyDxGLtz0Ld6tKnUdifZRS93FM/Nz0RbpAkWCz0+d1+4q m3uNNeGWaDn8PtNQOxRYTTH4Klb06OqXZcmuJol8fGI6EFNSdcV+NlL0ygMt8ZQjHWv8 zQZgViLvKaCfnli6438ti9qLwx3fSjWl+uiCRlN02jIOzNi0QtfX+sIZfDiJgnnec5HS 4Ikn/4z2ELn6WC8Ev9daGanIhMEP9v9IT5ETq2YlxgaX93zHZt9zZwHHGmQT1Ko6SwtW Xntu4W6NEHN9MIcxPCpNc0++6rXTE3nAWv50RB8R+NlEyxCw1wVZNrtrSfDFE6A5sOj1 gMdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=HZEWbwvG7GhU57ah0XB2xvKc4td0naFZ7/yht4hhUVc=; b=niYq89zyuj0Ph0Y9b7OJgAObZlm2hWeMk4tvuOY/MPcrZYfViD8sW2BpNsba39841O tkCN9YKDlVDaXrKpix5DKNaBPeiMv0L9T2O3qd8npjY+/awI/R9fOnYNr9zQHNT2GC9Q HDSHsLHIOoVrAeAqXAV8ZFLG/OwBPBrxKyHZ58yD0kPW8Rr9yRNBXfkbz5tf4jbaxS+L CO4eHzsHyM/EfJImFh9Wq5mkgGn9hr0r3KVZTfGPU9mGXfruyiDQzB/OqECvZgnWP7AA T9el0vZpRyLNyvrPVeUK9qrC8xHk478iG31k3G7y6snjbXUAM30a6/gLxlxPOCTux1gE fDdQ== X-Gm-Message-State: APjAAAUGgu9qpr55/XKOwqu9ir6HjN386Jn07kNiLyUmZXoclOcVg0Q7 V0VRvP1AOMPvUx0B51iheNzLPkTtAOo= X-Google-Smtp-Source: APXvYqw6frdPnqKdrIZnWMIu9vo/Yp0TgGRQM+maGtZVzGcdOgrgl3PTJhoWvCyDSVJC5M99ZPnaLQ== X-Received: by 2002:a5d:460b:: with SMTP id t11mr13828773wrq.377.1569878811289; Mon, 30 Sep 2019 14:26:51 -0700 (PDT) Received: from lead (dslb-178-008-086-051.178.008.pools.vodafone-ip.de. [178.8.86.51]) by smtp.gmail.com with ESMTPSA id s10sm1281214wmf.48.2019.09.30.14.26.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Sep 2019 14:26:50 -0700 (PDT) From: Federico Tedin To: Stefan Kangas Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> <87ef0aajli.fsf@gmail.com> <875zle9akd.fsf@gmail.com> Date: Mon, 30 Sep 2019 23:26:49 +0200 In-Reply-To: (Stefan Kangas's message of "Fri, 27 Sep 2019 12:32:20 +0200") Message-ID: <874l0t8oh2.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hey Stefan, thanks again for the input. > Perhaps just: > > * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name) > (package-test-list-clear-filter): New tests. > >> +@item / s >> +Filter the package list by name (@code{package-menu-filter-by-name}). > > That should be "/ n" as below. Good catch! >> ++++ >> +*** New function 'package-menu-filter-by-name'. >> +Allows users to filter packages by name on the packages list. By >> +default, it is bound to '/ n'. To clear the filter, use '/ /'. >> + >> ++++ >> +*** Function 'package-menu-fiter-by-keyword' has been renamed >> +from 'package-menu-filter'. Its keybinding has also been changed to >> +'/ k' (from 'f'). To clear the filter, '/ /' must now be used instead >> +of 'q'. >> + >> ++++ >> +*** New function 'package-menu-clear-filter' >> +Allows users to clear a filter applied with 'package-menu-filter-by-name' or >> +'package-menu-filter-by-keyword'. > > Perhaps this would be better as just one item where all changes are > explained together? > >> @@ -2699,7 +2701,9 @@ package-menu-mode-map >> ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] >> >> "--" >> - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] >> + ["Filter Packages by Keyword" package-menu-filter-by-keyword :help "Filter packages by keyword"] >> + ["Filter Packages by Name" package-menu-filter-by-name :help "Filter packages by name"] >> + ["Clear Packages Filter" package-menu-clear-filter :help "Clear package list filter"] > > This is fine by me, but perhaps it would be better to add a submenu > for filtering? Good idea, I've changed the menu entries so that they're part of a submenu now. I'm attaching the new patch. Thanks! --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=search.patch Content-Description: patch >From a6cb17c6d99113d6f6a6b2a3164a9101c8fecb51 Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Thu, 26 Sep 2019 19:18:58 +0200 Subject: [PATCH 1/1] Filter packages by name in list-packages. (Bug#36981) * lisp/emacs-lisp/package.el (package-menu-filter-by-name): New function to filter packages by name. (package-menu-clear-filter): New function to clear applied filters. (package-menu-filter-by-keyword): Rename function from package-menu-filter. (package-menu--generate): Don't change 'q' binding anymore. (package-menu-mode-map): Bind '/ n' to package-menu-filter-by-name, '/ k' to package-menu-filter-by-keyword and '/ /' to package-menu-clear-filter. (package-menu-mode-menu): Update menu entries for the three functions. * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name) (package-test-list-clear-filter): New tests. * doc/emacs/package.texi: Document usage of package-menu-filter-by-name, package-menu-clear-filter and update reference to package-menu-filter-by-keyword. * etc/NEWS: Announce changes. --- doc/emacs/package.texi | 19 ++++++++--- etc/NEWS | 10 ++++++ lisp/emacs-lisp/package.el | 45 ++++++++++++++++++++------- test/lisp/emacs-lisp/package-tests.el | 24 +++++++++++++- 4 files changed, 81 insertions(+), 17 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 2c09ca8902..d97648af1b 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -136,11 +136,20 @@ Package Menu the list of available packages from the package archive again, and recomputes the package list. -@item f -Filter the package list (@code{package-menu-filter}). This prompts -for a keyword (e.g., @samp{games}), then shows only the packages -that relate to that keyword. To restore the full package list, -type @kbd{q}. +@item / k +Filter the package list by keyword +(@code{package-menu-filter-by-keyword}). This prompts for a keyword +(e.g., @samp{games}), then shows only the packages that relate to that +keyword. + +@item / n +Filter the package list by name (@code{package-menu-filter-by-name}). +This prompts for a string, then shows only the packages whose names +match a regexp with that value. + +@item / / +Clear filter currently applied to the package list +(@code{package-menu-clear-filter}). @item H Permanently hide packages that match a regexp diff --git a/etc/NEWS b/etc/NEWS index cb8b6fcac1..015322c111 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -983,6 +983,16 @@ early init file. *** New function 'package-activate-all'. ++++ +*** New functions for filtering packages list +A new function has been added which allows users to filter the +packages list by name: 'package-menu-filter-by-name'. By default, it +is bound to '/ n'. Additionally, the function +'package-menu-fiter-by-keyword' has been renamed from +'package-menu-filter'. Its keybinding has also been changed to '/ k' +(from 'f'). To clear any of the two filters, the user can now call +the 'package-menu-clear-filter' function, bound to '/ /' by default. + --- *** Imenu support has been added to 'package-menu-mode'. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ab1fb8b90f..28e971044e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2667,7 +2667,9 @@ package-menu-mode-map (define-key map "i" 'package-menu-mark-install) (define-key map "U" 'package-menu-mark-upgrades) (define-key map "r" 'package-menu-refresh) - (define-key map "f" 'package-menu-filter) + (define-key map (kbd "/ k") 'package-menu-filter-by-keyword) + (define-key map (kbd "/ n") 'package-menu-filter-by-name) + (define-key map (kbd "/ /") 'package-menu-clear-filter) (define-key map "~" 'package-menu-mark-obsolete-for-deletion) (define-key map "x" 'package-menu-execute) (define-key map "h" 'package-menu-quick-help) @@ -2699,7 +2701,11 @@ package-menu-mode-map ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"] "--" - ["Filter Package List" package-menu-filter :help "Filter package selection (q to go back)"] + ("Filter Packages" + ["Filter by Keyword" package-menu-filter-by-keyword :help "Filter packages by keyword"] + ["Filter by Name" package-menu-filter-by-name :help "Filter packages by name"] + ["Clear Filter" package-menu-clear-filter :help "Clear package list filter"]) + ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] ["Display Older Versions" package-menu-toggle-hiding :style toggle :selected (not package-menu--hide-packages) @@ -3010,9 +3016,6 @@ package-menu--generate (let ((filters (mapconcat #'identity keywords ","))) (concat "Package[" filters "]")) "Package")) - (if keywords - (define-key package-menu-mode-map "q" 'package-show-package-list) - (define-key package-menu-mode-map "q" 'quit-window)) (tabulated-list-init-header) (tabulated-list-print remember-pos)) @@ -3640,9 +3643,7 @@ package-show-package-list (select-window win) (switch-to-buffer buf)))) -;; package-menu--generate rebinds "q" on the fly, so we have to -;; hard-code the binding in the doc-string here. -(defun package-menu-filter (keyword) +(defun package-menu-filter-by-keyword (keyword) "Filter the *Packages* buffer. Show only those items that relate to the specified KEYWORD. @@ -3653,9 +3654,7 @@ package-menu-filter KEYWORD can also be used to filter by status or archive name by using keywords like \"arc:gnu\" and \"status:available\". Statuses available include \"incompat\", \"available\", -\"built-in\" and \"installed\". - -To restore the full package list, type `q'." +\"built-in\" and \"installed\"." (interactive (list (completing-read-multiple "Keywords (comma separated): " (package-all-keywords)))) @@ -3663,6 +3662,30 @@ package-menu-filter (list keyword) keyword))) +(defun package-menu-filter-by-name (name) + "Filter the *Packages* buffer by NAME. +Show only those items whose name matches the regular expression +NAME. If NAME is nil or the empty string, show all packages." + (interactive (list (read-from-minibuffer "Filter by name (regexp): "))) + (if (or (not name) (string-empty-p name)) + (package-show-package-list t nil) + ;; Update `tabulated-list-entries' so that it contains all + ;; packages before searching. + (package-menu--refresh t nil) + (let (matched) + (dolist (entry tabulated-list-entries) + (let* ((pkg-name (package-desc-name (car entry)))) + (when (string-match name (symbol-name pkg-name)) + (push pkg-name matched)))) + (if matched + (package-show-package-list matched nil) + (user-error "No packages found"))))) + +(defun package-menu-clear-filter () + "Clear any filter currently applied to the *Packages* buffer." + (interactive) + (package-menu--generate t t)) + (defun package-list-packages-no-fetch () "Display a list of packages. Does not fetch the updated list of packages before displaying. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c757bccf67..a2ee9f06b1 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -28,7 +28,7 @@ ;; Run this in a clean Emacs session using: ;; -;; $ emacs -Q --batch -L . -l package-test.el -l ert -f ert-run-tests-batch-and-exit +;; $ emacs -Q --batch -L . -l package-tests.el -l ert -f ert-run-tests-batch-and-exit ;;; Code: @@ -360,6 +360,28 @@ package-test--compatible-p (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) +(ert-deftest package-test-list-filter-by-name () + "Ensure package list is filtered correctly by package name." + (with-package-test () + (let ((buf (package-list-packages))) + (package-menu-filter-by-name "tetris") + (goto-char (point-min)) + (should (re-search-forward "^\\s-+tetris" nil t)) + (should (= (count-lines (point-min) (point-max)) 1)) + (kill-buffer buf)))) + +(ert-deftest package-test-list-clear-filter () + "Ensure package list filter is cleared correctly." + (with-package-test () + (let ((buf (package-list-packages))) + (let ((num-packages (count-lines (point-min) (point-max)))) + (should (> num-packages 1)) + (package-menu-filter-by-name "tetris") + (should (= (count-lines (point-min) (point-max)) 1)) + (package-menu-clear-filter) + (should (= (count-lines (point-min) (point-max)) num-packages))) + (kill-buffer buf)))) + (ert-deftest package-test-update-archives () "Test updating package archives." (with-package-test () -- 2.17.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 30 17:59:48 2019 Received: (at 36981) by debbugs.gnu.org; 30 Sep 2019 21:59:49 +0000 Received: from localhost ([127.0.0.1]:60679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF3hs-0003Rp-M1 for submit@debbugs.gnu.org; Mon, 30 Sep 2019 17:59:48 -0400 Received: from mail-pg1-f180.google.com ([209.85.215.180]:36345) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF3hq-0003Rb-F4 for 36981@debbugs.gnu.org; Mon, 30 Sep 2019 17:59:46 -0400 Received: by mail-pg1-f180.google.com with SMTP id t14so8130909pgs.3 for <36981@debbugs.gnu.org>; Mon, 30 Sep 2019 14:59:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZqBS2tU3rNYbAj2kQkliwtKAsnZUwOd5D62uKcp45PY=; b=BJwju8tK/GzHcmKu9WFrD7Vgr8valCej+P18Z8mSwJgjQHxUDy0oFqnIp4muvLYPIw tpkdSonC7kSH16lX4/tU/DzXFCovwETf4x7+KmIWZP2W/yzv/eIbBKXNKYXP5ZmNzkbC n1hwru+3SrGmVHOKo67TQosGQFGWU5F5PTcAriC4aUrZjRoQj+IqxP55kP66JZWWVxiL JtGE1cslvWugwEYixNZgLQu3X/HWFLUvnd/aoNo59VAdkaDI3fMTd6rHEWWrAWn6giIG 55xGI5FEhRIXZvSpkHcc0OFqbKJn1rv4yPLl9PpLy4oXuvyeRRkXc/kI3q4XWZ8fd/y+ tq9Q== X-Gm-Message-State: APjAAAVEwg587ZGXxhKeniGIrz+LzdN1Qh7A5GXbcidkhY1wMk1W5O2G hXXWWGHVZ7w+fjejxyp6waPYJz20M3g9u2gAWfk= X-Google-Smtp-Source: APXvYqwvLlUfVW6eSrClQ/YXYVDGXcB8zsd3ZQ3MS94TnC3aueCPKST9HRE71vFmL3kAEJumH+yqhofxry81B8dRSwA= X-Received: by 2002:a63:1310:: with SMTP id i16mr24638261pgl.200.1569880780660; Mon, 30 Sep 2019 14:59:40 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> <87ef0aajli.fsf@gmail.com> <875zle9akd.fsf@gmail.com> <874l0t8oh2.fsf@gmail.com> In-Reply-To: <874l0t8oh2.fsf@gmail.com> From: Stefan Kangas Date: Mon, 30 Sep 2019 23:59:29 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Federico Tedin writes: > I'm attaching the new patch. Looks good to me. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 30 18:00:36 2019 Received: (at control) by debbugs.gnu.org; 30 Sep 2019 22:00:36 +0000 Received: from localhost ([127.0.0.1]:60683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF3ie-0003Un-2h for submit@debbugs.gnu.org; Mon, 30 Sep 2019 18:00:36 -0400 Received: from mail-pg1-f173.google.com ([209.85.215.173]:40558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF3id-0003UZ-7M for control@debbugs.gnu.org; Mon, 30 Sep 2019 18:00:35 -0400 Received: by mail-pg1-f173.google.com with SMTP id d26so2656312pgl.7 for ; Mon, 30 Sep 2019 15:00:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=P8o8NsLz0EXUWK77MFP8dBUS0f6GQ2eonyIeh8pEVHc=; b=syG/QMyPBCzB3P/LKx8h5dMEKEmaaAocui4AUpCp3lFd6EmLUrFm3jVSDT84y/5tT7 JJV6CizTMNUXY8fbGrQcRLF0jJr0uadLd5m8xjRs15H6iPNFi3aV5nRACMtWX13gPXkc bJ/9BhzdX8IxqpwxPIQ/E/fFQcgpZJgRLKaBgDisbiCoTGMD+nArEdElvskNd5jlt7VO aKZhhfWx7rUgqbYUISAtnFtkX81s3rJor47kdaucvBdxsCbYerJQNA8MtAJ6xUX5OBsP 6OUGoKfMmuPFU8hQnAxZgWQizdIfOU7kYYZIQJGKEju7r9bEutVujFWRHIEVlj5LkEkE Xc0g== X-Gm-Message-State: APjAAAXe77Pt8VPCHQ5guaURHHpwdYc3sVfdp02Q7a9oODE/KnAJW8Xc GqrfeUzKOL5tZ0FGcGSe4YNaj1asgWzq3wPMJlxb4p4gknA= X-Google-Smtp-Source: APXvYqwUYi0FWa1bj4rNhtBSoTKigRh5odAaDAs2yHzXqeG0RVLmvYq5lZ7Q1AVnLceTcS3rLEkzDwaCo6pym5ymYD4= X-Received: by 2002:a63:1310:: with SMTP id i16mr24641629pgl.200.1569880829090; Mon, 30 Sep 2019 15:00:29 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Tue, 1 Oct 2019 00:00:17 +0200 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.2 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 36981 + patch quit Content analysis details: (2.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.215.173 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.215.173 listed in wl.mailspike.net] 2.0 BLANK_SUBJECT Subject is present but empty 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 36981 + patch quit Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.215.173 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.215.173 listed in wl.mailspike.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 2.0 BLANK_SUBJECT Subject is present but empty 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager tags 36981 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 08 13:28:56 2019 Received: (at 36981) by debbugs.gnu.org; 8 Oct 2019 17:28:56 +0000 Received: from localhost ([127.0.0.1]:51434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHtI8-00041q-Fq for submit@debbugs.gnu.org; Tue, 08 Oct 2019 13:28:56 -0400 Received: from mail-pg1-f181.google.com ([209.85.215.181]:38268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHtI6-00041U-Du for 36981@debbugs.gnu.org; Tue, 08 Oct 2019 13:28:54 -0400 Received: by mail-pg1-f181.google.com with SMTP id x10so10627124pgi.5 for <36981@debbugs.gnu.org>; Tue, 08 Oct 2019 10:28:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vvp/za5TeIU54OSyEMG9XodOQ9fOVxC9EXFPKBQ29tg=; b=reE1JaZoVVzPbpRbbWi1uggL9Ej1b2VTmjIGRi2i9uKsH9Hc0i1Oseur3QnZACyegQ oW/KSr+RlGs9HUFx1svU7cWdhf9uO78AzlRKU3cB5SOvqQ34imqWXESU89+Dvi8f3OxD YzI34A+nr5vp5pN3xp2oWgdZt4cTCJU6iHMlp6NatV4CNBDC0/NPNRb8xFGhOR39ODNc vNCC0ot8Wu+2JcI6lr+LQ9/oGFQ17WoqqKgx4GP4MopASLA2svkzJ3/9oJRRAdWSLaCP etRdaGj+TTshn8jyV5uV+wJumQMUiQcPFCPaerRSFMuityXYpEFu1yGWw86LhOznrzgV qt0A== X-Gm-Message-State: APjAAAWCPazr+EiMDoT2FBNQJ1uEvvCy9Yhef0iQ2qQtPQ4BNSt/Eaz9 ZMo36cfVjzn+cb3BxgOHuPkZ/vYFPANHKJYu2DoRy+FW X-Google-Smtp-Source: APXvYqw18MUnYUHmJARJSYud3oKRAyz5UkLqgt1VyeAoS5QO7Z+I1TYIOFuy9zR8EZeO5QX7IzjHO58IbIPPfDhwWX0= X-Received: by 2002:a17:90a:f491:: with SMTP id bx17mr7229397pjb.106.1570555728493; Tue, 08 Oct 2019 10:28:48 -0700 (PDT) MIME-Version: 1.0 References: <87ef0r396q.fsf@gmail.com> <87tv995zlc.fsf@gmail.com> <87h858ryot.fsf@mail.linkov.net> <87ef0aajli.fsf@gmail.com> <875zle9akd.fsf@gmail.com> <874l0t8oh2.fsf@gmail.com> In-Reply-To: From: Stefan Kangas Date: Tue, 8 Oct 2019 19:28:37 +0200 Message-ID: Subject: Re: bug#36981: 26.2; request: add searching by package name to list-packages To: Federico Tedin Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 36981 Cc: 36981@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) close 36981 27.1 thanks Stefan Kangas writes: > Federico Tedin writes: > > > I'm attaching the new patch. > > Looks good to me. No one has had any further comments, so I've now pushed your patch to master as commit f96b8fd27c. Note that I made some minor copy-edits to the documentation before pushing. Thanks again for your contribution; I'm closing this bug. Best regards, Stefan Kangas From unknown Sat Jun 21 03:23:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 06 Nov 2019 12:24:14 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator