all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: Andreas Schwab <schwab@suse.de>, 30356@debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust@gmail.com>
Subject: bug#30356: [PATCH] Add below option to gnus-summary-limit-to-score
Date: Mon,  5 Feb 2018 16:31:43 +0300	[thread overview]
Message-ID: <20180205133143.16907-1-go.wigust@gmail.com> (raw)
In-Reply-To: <mvmfu6fk2zb.fsf@suse.de>

* 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 | 22 +++++++++++++++-------
 3 files changed, 22 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.
 \f
 * 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..b9996e7d93 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8559,14 +8559,22 @@ 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.
+
+With a prefix argument, limit to articles with score at or below
+SCORE."
+  (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






  reply	other threads:[~2018-02-05 13:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 12:50 bug#30356: [PATCH] Add below option to gnus-summary-limit-to-score Oleg Pykhalov
2018-02-05 12:58 ` Andreas Schwab
2018-02-05 13:31   ` Oleg Pykhalov [this message]
2018-02-06  4:34     ` Oleg Pykhalov
2018-04-11 20:57     ` Lars Ingebrigtsen
2018-04-12 18:28       ` Oleg Pykhalov
2018-04-12 18:52         ` Lars Ingebrigtsen
2018-04-12 19:05           ` Eli Zaretskii
2018-04-12 19:16             ` Lars Ingebrigtsen
2018-04-12 19:23           ` Oleg Pykhalov

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20180205133143.16907-1-go.wigust@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=30356@debbugs.gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

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