emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rmail-total-messages has two different values, one is wrong


From: Eli Zaretskii
Subject: Re: rmail-total-messages has two different values, one is wrong
Date: Sat, 24 Jun 2023 15:30:07 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]