From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#67445: Likely Gnus bracketing mistake Date: Sat, 25 Nov 2023 13:19:56 -0800 Message-ID: <87o7fhr0n7.fsf@ericabrahamsen.net> References: <83wmu5bzjl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39368"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 67445@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 25 22:21:12 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r705Q-000A1e-6n for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Nov 2023 22:21:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r705C-0002Ds-D6; Sat, 25 Nov 2023 16:20:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r705B-0002DV-2w for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 16:20:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r705A-0001ZJ-RD for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 16:20:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r705G-0004DO-2O for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 16:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Nov 2023 21:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67445 X-GNU-PR-Package: emacs Original-Received: via spool by 67445-submit@debbugs.gnu.org id=B67445.170094721116127 (code B ref 67445); Sat, 25 Nov 2023 21:21:02 +0000 Original-Received: (at 67445) by debbugs.gnu.org; 25 Nov 2023 21:20:11 +0000 Original-Received: from localhost ([127.0.0.1]:40370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r704Q-0004C2-UB for submit@debbugs.gnu.org; Sat, 25 Nov 2023 16:20:11 -0500 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:35198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r704P-0004Bm-BZ for 67445@debbugs.gnu.org; Sat, 25 Nov 2023 16:20:09 -0500 Original-Received: from localhost (71-212-21-65.tukw.qwest.net [71.212.21.65]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 92FDFFA396; Sat, 25 Nov 2023 21:19:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1700947197; bh=JDY8eAT58cFLTTjxTNMAONKwlMbVcravO1DpNFNe7yU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=tHFztTW5fn+3l3CXloN6ZV9HE0xh7fIpekvaxwKZMpeLfh6YQCBXC59vk8EEA/Ui/ slzrlnUm5nMB7kkXdUMPzimAbl12A1sUHYLRgR5dExID8yv0YeDvId3xGW1f383hMh vWr+PbSwhDXbdjhXPPHMghZtRPjkNX646eN1bi2s= In-Reply-To: <83wmu5bzjl.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Nov 2023 17:52:46 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275020 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Mattias Engdeg=C3=A5rd >> Date: Sat, 25 Nov 2023 15:50:59 +0100 >>=20 >> This looks like a bracketing mistake (gnus-group.el line 1758): >>=20 >> > (if (and backward (progn (beginning-of-line)) (bobp)) >>=20 >> especially considering `beginning-of-line` always returns nil. That whole special-case test doesn't seem necessary, I think the attached patch is sufficient. I've tested it lightly, does it look okay? >> (Is there a Gnus maintainer these days?) > > Yes, Eric (CC'ed). Hey, I've been promoted! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus-search-articles.diff diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 01e6a8f317f..41d92e715ee 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -1745,45 +1745,43 @@ gnus-group-level 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 (> 0 way) (eobp) (bobp))) + (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)) --=-=-=--