From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pankaj Jangid Newsgroups: gmane.emacs.bugs Subject: bug#45269: Incorrect Gnus summary line number after toggle-thread and limiting Date: Wed, 16 Dec 2020 18:54:55 +0530 Message-ID: <87v9d1289k.fsf@codeisgreat.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="17956"; mail-complaints-to="usenet@ciao.gmane.io" To: 45269@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 16 14:26:11 2020 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 1kpWol-0004XQ-EY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 14:26:11 +0100 Original-Received: from localhost ([::1]:38854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpWok-0008AB-FH for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 08:26:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpWoc-00088V-Nh for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 08:26:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpWoc-0007SS-EJ for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 08:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kpWoc-0004la-9S for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 08:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pankaj Jangid Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Dec 2020 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45269 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.160812510818246 (code B ref -1); Wed, 16 Dec 2020 13:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Dec 2020 13:25:08 +0000 Original-Received: from localhost ([127.0.0.1]:60162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpWnk-0004kD-D7 for submit@debbugs.gnu.org; Wed, 16 Dec 2020 08:25:08 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kpWnf-0004k0-Fz for submit@debbugs.gnu.org; Wed, 16 Dec 2020 08:25:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpWnf-0007Vi-99 for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 08:25:03 -0500 Original-Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:56097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpWnc-00076x-Kn for bug-gnu-emacs@gnu.org; Wed, 16 Dec 2020 08:25:03 -0500 Original-Received: by mail-pj1-x102b.google.com with SMTP id lb18so1477075pjb.5 for ; Wed, 16 Dec 2020 05:25:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeisgreat-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:mail-followup-to:date:message-id:mime-version; bh=9cxTSzbHatx7/clCLTzM7octbvK8gKxzVGPhOAmKM+E=; b=pGK0QPq0Gt9D1chNQtx+2in2u5/Uk7SIlwbdE2H+YOFdLGnxps3CRNYIAhv63DGQBw ghd2I3spDcKn/TUn9I6lGbXrFqWBS1sjEKigdLoNw0m5r/RHM2jaYoeEXK/OS1H1yYO9 DlHPfI7fASw2LYsPkhOYUO+zW9trQYbPkhR5nnLUdaZmnsmpO5H6B3Ts7DxCA50tLhBB 1vvEmcXQceaOozpLvGvytNj7gyCMXuqYCe8CVvEq7zBxQLQpbxZvSkuM9SBeBlapsQlE 7abozoXUsklaloYiyjM3ctSOOkZjOwiMy5o1qtBqcHUFgXU34KB0ZxwvpgLddwzeIAFA x4ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:mail-followup-to:date:message-id :mime-version; bh=9cxTSzbHatx7/clCLTzM7octbvK8gKxzVGPhOAmKM+E=; b=kMJpEqD3pqdosIWoCjXtTs4/qml07bjVrVUKhwmglxGdXoZBMt3BGgszbWraIS7vb6 GF/Ryq5NRkXBqHUOn9XxsBQbNzLDPvc2zcCc0Kfkh5eJM4zkav1P1T94C/gjq1+ZDaWj GtKDqfns+A9WsVEeXvlK9e2Vcs5J++kSfErbDZTURpocIq5D+jN5GOn27LkIO9kHFkPN 8+FElQmEbQvZ5Xse/cVf2B16mjD48U9YoKFmy9A2WOckAJ6vHr5EqbMKYrt45NtMKYz0 ur5HPVY4xo2oZ/T6wElyPurVJz+sETHExLKbQAy1Xbms5Jj1I8TY/wRXxgIYwDzOx79X 5+8A== X-Gm-Message-State: AOAM533dSm/AwASiihtxkzxWta5Mi45+h7N3xRG17jfWa5B0NVeS+mmE VAaWG6IKSfyl/Ob2moUig98nXrCBSXH5lQ== X-Google-Smtp-Source: ABdhPJxhPyvyeZ4PwKg8IM3kW3F2OKhrQt+z6PyBCxBmsWzLnvHxoDiwK6lngPXV2GPUB+b5UHEX6w== X-Received: by 2002:a17:90b:60b:: with SMTP id gb11mr3189865pjb.122.1608125098674; Wed, 16 Dec 2020 05:24:58 -0800 (PST) Original-Received: from lt ([2405:201:5c06:70bb:a64e:31ff:fe0c:338c]) by smtp.gmail.com with ESMTPSA id z10sm2513086pfr.204.2020.12.16.05.24.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 05:24:58 -0800 (PST) Mail-Followup-To: bug-gnu-emacs@gnu.org Received-SPF: none client-ip=2607:f8b0:4864:20::102b; envelope-from=pankaj@codeisgreat.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:196206 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Set summary line format to display line number. Something like this, (setq gnus-summary-line-format "%4P %U%R%z %-16&user-date; %(%[%4L:%*%-23,23f%]%) %B%s\n" This will display line number in the first column. Start Gnus and enter any group with few emails in it (better if there are threads in it). Invoke T-T (gnus-summary-toggle-threads) or any of the limiting functions like /-/ (gnus-summary-limit-to-subject). These calls invoke gnus-summary-prepare function. And every time gnus-summary-prepare is invoked it starts increamenting line-number from the previous max. The result is that, on each refresh the line number keep on increasing. And showing incorrect values. I have moved these two lines from gnus-summary-read-group-1 to gnus-summary-prepare function. (when (boundp 'gnus-pick-line-number) (setq gnus-pick-line-number 0)) This fixes the issue. Unless there are side-effects that I am unaware of. In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2020-12-16 built on lt Repository revision: fda9a2bbfd3adcce046c03bee72ba848c61a3e29 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Configured using: 'configure --prefix=/home/pankaj/.local' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=gnus-summary-line-number-fix.patch diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 9488b32487..16152e252a 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -4100,8 +4100,6 @@ gnus-summary-read-group-1 ;; The group was successfully selected. (t (gnus-set-global-variables) - (when (boundp 'gnus-pick-line-number) - (setq gnus-pick-line-number 0)) (when (boundp 'spam-install-hooks) (spam-initialize)) ;; Save the active value in effect when the group was entered. @@ -4226,6 +4224,8 @@ gnus-summary-prepare gnus-newsgroup-data-reverse nil) (gnus-run-hooks 'gnus-summary-generate-hook) ;; Generate the buffer, either with threads or without. + (when (boundp 'gnus-pick-line-number) + (setq gnus-pick-line-number 0)) (when gnus-newsgroup-headers (gnus-summary-prepare-threads (if gnus-show-threads --=-=-=--