all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andrea Monaco <andrea.monaco@autistici.org>
Cc: emacs-devel@gnu.org
Subject: Re: rmail-total-messages has two different values, one is wrong
Date: Sat, 24 Jun 2023 15:30:07 +0300	[thread overview]
Message-ID: <83ilbdyre8.fsf@gnu.org> (raw)
In-Reply-To: <87mt0xexx8.fsf@autistici.org> (message from Andrea Monaco on Sun, 18 Jun 2023 14:51:15 +0200)

> From: Andrea Monaco <andrea.monaco@autistici.org>
> 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.



  reply	other threads:[~2023-06-24 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 21:26 rmail-total-messages has two different values, one is wrong Andrea Monaco
2022-10-27 17:04 ` Eli Zaretskii
2023-06-18 12:51   ` Andrea Monaco
2023-06-24 12:30     ` Eli Zaretskii [this message]
2023-07-01  8:35       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ilbdyre8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=andrea.monaco@autistici.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.