all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30356: [PATCH] Add below option to gnus-summary-limit-to-score
@ 2018-02-05 12:50 Oleg Pykhalov
  2018-02-05 12:58 ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Oleg Pykhalov @ 2018-02-05 12:50 UTC (permalink / raw)
  To: 30356; +Cc: Oleg Pykhalov

* 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.
 \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..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






^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-04-12 19:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.