From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Oleg Pykhalov Newsgroups: gmane.emacs.bugs Subject: bug#30356: [PATCH] Add below option to gnus-summary-limit-to-score Date: Mon, 5 Feb 2018 15:50:42 +0300 Message-ID: <20180205125042.15151-1-go.wigust@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1517835069 22040 195.159.176.226 (5 Feb 2018 12:51:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Feb 2018 12:51:09 +0000 (UTC) Cc: Oleg Pykhalov To: 30356@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 05 13:51:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eigEH-0003rS-9A for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Feb 2018 13:50:37 +0100 Original-Received: from localhost ([::1]:39504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eigGI-0004tT-9k for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Feb 2018 07:52:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eigFj-0004YX-Dx for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:52:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eigFe-0002VU-GX for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:52:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49862) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eigFe-0002Us-Cv for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eigFd-0006kv-Tq for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:52:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Feb 2018 12:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30356 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151783509325933 (code B ref -1); Mon, 05 Feb 2018 12:52:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Feb 2018 12:51:33 +0000 Original-Received: from localhost ([127.0.0.1]:57759 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eigFB-0006kD-7j for submit@debbugs.gnu.org; Mon, 05 Feb 2018 07:51:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eigF9-0006k0-49 for submit@debbugs.gnu.org; Mon, 05 Feb 2018 07:51:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eigF2-0000d0-Ug for submit@debbugs.gnu.org; Mon, 05 Feb 2018 07:51:25 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49263) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eigF2-0000cZ-Rf for submit@debbugs.gnu.org; Mon, 05 Feb 2018 07:51:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eigF1-0003zX-Dk for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:51:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eigEw-0000Gp-Ij for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:51:23 -0500 Original-Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:37566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eigEw-0000FR-BM for bug-gnu-emacs@gnu.org; Mon, 05 Feb 2018 07:51:18 -0500 Original-Received: by mail-lf0-x22e.google.com with SMTP id 63so41552343lfv.4 for ; Mon, 05 Feb 2018 04:51:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=jbVHt1JcZD4mOc6atwHSMMQCJAxWqzbdlLagWKa1Urg=; b=HwJEKLDGz4pVIthyveh2jcO7SG8xQILKio5cDH00inwwETMandQL38iZlubP8smazr DbWr0SucUNFaHnMdXo2JXn+BKd+RSNrxaFuspffxcVH4LAIma9jgjouXkfVMWzAyq9l0 mNMUGG/lXf7qWSSH0LRu9OrWlREvEBSc+0c3KprGwDuKI1jphhpJ7x7Tg66zP4xUJIjI PHS4vxSIJ6wF0yJOeo3TX383YtjQK0FdwGYh2dk+2kdVhYWRg1Dan77bpwy0C3Pp1c+E AukR4LCwlZODcMuMvSD8pjlJx+TG54qxyhKyli31+5RFAB8ZcRTJ5N/pGBc6zJrutgiD MwDQ== 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:date:message-id; bh=jbVHt1JcZD4mOc6atwHSMMQCJAxWqzbdlLagWKa1Urg=; b=peUr80opfcpkI+j0tzj/p5H6lPcFj+RKqxwyrBt0Y3AtUg8dWYFXr1B0De9VoLb8XF P+kk7h0JxkOUa9DtaSmqlkXa0We0Ictu53xMdEOMLY1CTbusHhgWpXPj1w3VpImxSG8c y8wM43bjP9x9hHuG/k7pphzanHaMKcji8CCkgefYzn5oqQVnhGKtQ6WDoUdLov/oYlqR GRn3EDyLQ/D7TnuiQTu+XM6YljArIq+aORqipnXdSvxDTmnonEpSbZJVTpVB4VII8zdp 4FgzvsfrZgX90CcWhnSgieWGoWb+iVJ6zBxsm4FhIguj3vXKVPcuprbqtn/tIIDFh0zH Wk7A== X-Gm-Message-State: AKwxyterAo9HVG4nf/Ve1wyGwj+xflU8h4xDiNYhN7hxiQ84ES20UGBb zpQLCthmko6jbmkrmAUcf6R60g== X-Google-Smtp-Source: AH8x225fg2YRi5NUfh4phh5RJB9sXwyYCkMYh0Telxk80JdSBhg/x7GW74F1T/GKmYZgsK53OWUpmw== X-Received: by 10.25.141.148 with SMTP id p142mr12273532lfd.24.1517835076595; Mon, 05 Feb 2018 04:51:16 -0800 (PST) Original-Received: from localhost.localdomain (92-100-138-76.dynamic.avangarddsl.ru. [92.100.138.76]) by smtp.gmail.com with ESMTPSA id q62sm1795079ljq.17.2018.02.05.04.51.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 04:51:15 -0800 (PST) X-Mailer: git-send-email 2.15.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:142932 Archived-At: * lisp/gnus/gnus-sum.el (gnus-summary-limit-to-score): Add below option. --- doc/misc/gnus.texi | 3 ++- etc/NEWS | 5 +++++ lisp/gnus/gnus-sum.el | 20 +++++++++++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 8c2fc56dd6..27baf6b11c 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -6663,7 +6663,8 @@ Limiting @kindex / v (Summary) @findex gnus-summary-limit-to-score Limit the summary buffer to articles that have a score at or above some -score (@code{gnus-summary-limit-to-score}). +score (@code{gnus-summary-limit-to-score}). If given a prefix, below +some score. @item / p @kindex / p (Summary) diff --git a/etc/NEWS b/etc/NEWS index 8fed15af5b..33b5073ad3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -106,6 +106,11 @@ non-text modes. * Changes in Specialized Modes and Packages in Emacs 27.1 +** Gnus + +*** A prefix argument to 'gnus-summary-limit-to-score' will limit reverse +Limit to articles with score at below. + ** Ecomplete *** The ecomplete sorting has changed to a decay-based algorithm. This can be controlled by the new `ecomplete-sort-predicate' variable. diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index b6e9ea91b6..00aefa1d19 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -8559,14 +8559,20 @@ gnus-summary-limit-to-marks (gnus-summary-limit articles)) (gnus-summary-position-point))) -(defun gnus-summary-limit-to-score (score) - "Limit to articles with score at or above SCORE." - (interactive "NLimit to articles with score of at least: ") - (let ((data gnus-newsgroup-data) - articles) +(defun gnus-summary-limit-to-score (score &optional below) + "Limit to articles with score at or above SCORE if BELOW is nil, +below otherwise." + (interactive (list (string-to-number + (read-string + (format "Limit to articles with score of at %s: " + (if current-prefix-arg "most" "least")))))) + (let* ((data gnus-newsgroup-data) + (compare (if (or below current-prefix-arg) #'<= #'>=)) + articles) (while data - (when (>= (gnus-summary-article-score (gnus-data-number (car data))) - score) + (when (funcall compare (gnus-summary-article-score + (gnus-data-number (car data))) + score) (push (gnus-data-number (car data)) articles)) (setq data (cdr data))) (prog1 -- 2.15.1