From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: rmail-total-messages has two different values, one is wrong Date: Sat, 24 Jun 2023 15:30:07 +0300 Message-ID: <83ilbdyre8.fsf@gnu.org> References: <87mt0xexx8.fsf@autistici.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3064"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Andrea Monaco Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 24 14:30:48 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qD2Pg-0000Za-Hl for ged-emacs-devel@m.gmane-mx.org; Sat, 24 Jun 2023 14:30:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qD2Ow-0004aK-5S; Sat, 24 Jun 2023 08:30:02 -0400 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 1qD2Oo-0004ZP-Ng for emacs-devel@gnu.org; Sat, 24 Jun 2023 08:29:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qD2On-00079e-2u; Sat, 24 Jun 2023 08:29:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jA/0aHHGtLtnbo1y58XEG7uGTdFdYwMQ4nR2w9Nvq4E=; b=WN7Gs5AfpfOl 8IwKHbuF7rWbIVnnxek01w/yLMSx/XMJvq+jw/Yvxxfswx545BUczurv/k62WM8SPAktftEm/U1EG 5pzavkLKP38/mlRIl12eqC1KsILjl2FUmzB9gpGoIBNJHpwdvKgqLHHt05AnGDwTif4KLwcOqtq3F anl878QwgwEB6CzkpkmeQo8JkuEMSW0x9PTf2zYmMve+XWYJ+9joWLp2KVOdPm2gd92S1K0Hp1l1x ALAwU2YHCBd4chv44GHgEn1vPmHTnGYLLEkcb9KMq9mRxXoS2FW1doDqB3Y3eo/jPthC2o+eWrwmK dzqANbBiAfuX2JlCKSTQcw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qD2Ol-0006NT-W4; Sat, 24 Jun 2023 08:29:52 -0400 In-Reply-To: <87mt0xexx8.fsf@autistici.org> (message from Andrea Monaco on Sun, 18 Jun 2023 14:51:15 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:307178 Archived-At: > From: Andrea Monaco > Cc: emacs-devel@gnu.org > Date: Sun, 18 Jun 2023 14:51:15 +0200 > > > I think the problem is in rmail-count-new-messages. The function runs > in the main buffer, so this assignment > > > (setq rmail-total-messages > (+ rmail-total-messages total-messages)) > > > should be duplicated for the summary buffer (maybe the same goes for > other assignments in that function, I don't know). > > But this bug is not nasty, so we could just document the current > behavior. What do you think? I think it's a bug: the value in the summary buffer should tell how many messages are shown in the summary. Does the patch below give good results? Please try it both with "normal" summaries and with various filtering alternatives. diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 21dec2b..e3a6c16 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -742,13 +742,14 @@ rmail-new-summary-1 (setq rmail-summary-buffer nil))) (save-excursion (let ((rbuf (current-buffer)) - (total rmail-total-messages)) + (total 0)) (set-buffer sumbuf) ;; Set up the summary buffer's contents. (let ((buffer-read-only nil)) (erase-buffer) (while summary-msgs (princ (cdr (car summary-msgs)) sumbuf) + (setq total (1+ total)) (setq summary-msgs (cdr summary-msgs))) (goto-char (point-min))) ;; Set up the rest of its state and local variables.