[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7304cc8a9ca: Simplify gnus-group-search-forward
From: |
Eric Abrahamsen |
Subject: |
master 7304cc8a9ca: Simplify gnus-group-search-forward |
Date: |
Sat, 25 Nov 2023 20:49:18 -0500 (EST) |
branch: master
commit 7304cc8a9ca8a7d19baaa24f0a72c7ad9a6a9716
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Simplify gnus-group-search-forward
Bug#67445
* lisp/gnus/gnus-group.el (gnus-group-search-forward): The
special-case check for backwards-and-bobp is odd and unnecessary, just
perform an equivalent search from point depending on direction.
---
lisp/gnus/gnus-group.el | 68 ++++++++++++++++++++++++-------------------------
1 file changed, 33 insertions(+), 35 deletions(-)
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 01e6a8f317f..9a1a6f9b27d 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1745,45 +1745,43 @@ already. If INFO-UNCHANGED is non-nil, dribble buffer
is not updated."
gnus-level-killed))
(defun gnus-group-search-forward (&optional backward all level first-too)
- "Find the next newsgroup with unread articles.
-If BACKWARD is non-nil, find the previous newsgroup instead.
-If ALL is non-nil, just find any newsgroup.
-If LEVEL is non-nil, find group with level LEVEL, or higher if no such
-group exists.
-If FIRST-TOO, the current line is also eligible as a target."
+ "Move point to the next newsgroup with unread articles.
+If BACKWARD is non-nil, move to the previous newsgroup instead.
+If ALL is non-nil, consider any newsgroup, not only those with
+unread articles. If LEVEL is non-nil, find group with level
+LEVEL, or higher if no such group exists. If FIRST-TOO, the
+current line is also eligible as a target."
(let ((way (if backward -1 1))
(low gnus-level-killed)
(beg (point))
pos found lev)
- (if (and backward (progn (beginning-of-line)) (bobp))
- nil
- (unless first-too
- (forward-line way))
- (while (and
- (not (eobp))
- (not (setq
- found
- (and
- (get-text-property (point) 'gnus-group)
- (or all
- (and
- (let ((unread
- (get-text-property (point) 'gnus-unread)))
- (and (numberp unread) (> unread 0)))
- (setq lev (get-text-property (point)
- 'gnus-level))
- (<= lev gnus-level-subscribed)))
- (or (not level)
- (and (setq lev (get-text-property (point)
- 'gnus-level))
- (or (= lev level)
- (and (< lev low)
- (< level lev)
- (progn
- (setq low lev)
- (setq pos (point))
- nil))))))))
- (zerop (forward-line way)))))
+ (unless first-too
+ (forward-line way))
+ (while (and
+ (not (if backward (bobp) (eobp)))
+ (not (setq
+ found
+ (and
+ (get-text-property (point) 'gnus-group)
+ (or all
+ (and
+ (let ((unread
+ (get-text-property (point) 'gnus-unread)))
+ (and (numberp unread) (> unread 0)))
+ (setq lev (get-text-property (point)
+ 'gnus-level))
+ (<= lev gnus-level-subscribed)))
+ (or (not level)
+ (and (setq lev (get-text-property (point)
+ 'gnus-level))
+ (or (= lev level)
+ (and (< lev low)
+ (< level lev)
+ (progn
+ (setq low lev)
+ (setq pos (point))
+ nil))))))))
+ (zerop (forward-line way))))
(if found
(progn (gnus-group-position-point) t)
(goto-char (or pos beg))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7304cc8a9ca: Simplify gnus-group-search-forward,
Eric Abrahamsen <=