all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Value of rmail-total-messages in the summary buffer
@ 2024-05-05 17:38 Andrea Monaco
  2024-05-06 11:05 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Monaco @ 2024-05-05 17:38 UTC (permalink / raw)
  To: emacs-devel


Recently (commit 8c7f92f25c39137b5ddc2872597434fd5a3b38e9), the variable
rmail-total-messages was made to hold the number of summarized messages
in the summary buffer (previously it hold a buggy value in that buffer).

I think that this interacts with commit
8729a2a10d9b8d88f6ba33b5ce62f74d89e7788a and sometimes breaks
summarization by thread: if I create a small summary, say by topic, and
then call rmail-summary-by-thread, I get an error.

In my opinion, it is more intuitive if rmail-total-messages holds the
same value in both the main and summary buffers, which is the total
number of loaded messages, irrespective of what the summary shows.  The
"total" in the name also suggests so.

What do you think?



Andrea Monaco



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Value of rmail-total-messages in the summary buffer
  2024-05-05 17:38 Value of rmail-total-messages in the summary buffer Andrea Monaco
@ 2024-05-06 11:05 ` Eli Zaretskii
  2024-05-07  9:00   ` [PATCH] " Andrea Monaco
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-05-06 11:05 UTC (permalink / raw)
  To: Andrea Monaco; +Cc: emacs-devel

> From: Andrea Monaco <andrea.monaco@autistici.org>
> Date: Sun, 05 May 2024 19:38:30 +0200
> 
> 
> Recently (commit 8c7f92f25c39137b5ddc2872597434fd5a3b38e9), the variable
> rmail-total-messages was made to hold the number of summarized messages
> in the summary buffer (previously it hold a buggy value in that buffer).
> 
> I think that this interacts with commit
> 8729a2a10d9b8d88f6ba33b5ce62f74d89e7788a and sometimes breaks
> summarization by thread: if I create a small summary, say by topic, and
> then call rmail-summary-by-thread, I get an error.

Please show some simple recipe that exhibits the problem, as I'm not
sure I understand how does that get in the way.

Also, are you saying that the previous "buggy" value did not present
the same problem?  If so, can you explain why?

> In my opinion, it is more intuitive if rmail-total-messages holds the
> same value in both the main and summary buffers, which is the total
> number of loaded messages, irrespective of what the summary shows.  The
> "total" in the name also suggests so.

I don't think I agree.  I think it will be very confusing if the
number in summary buffer's mode-line didn't reflect the actual number
of messages in the summary buffer.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Re: Value of rmail-total-messages in the summary buffer
  2024-05-06 11:05 ` Eli Zaretskii
@ 2024-05-07  9:00   ` Andrea Monaco
  2024-05-11  9:18     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Monaco @ 2024-05-07  9:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


  > Please show some simple recipe that exhibits the problem, as I'm not
  > sure I understand how does that get in the way.

If I make a small summary by topic, say on this very topic, and then
from the summary buffer I call rmail-summary-by-thread, again on this
thread, I get an out-of-bounds error.  Can you replicate this?


  > Also, are you saying that the previous "buggy" value did not present
  > the same problem?  If so, can you explain why?

Thinking more about it, the problem originated in
8729a2a10d9b8d88f6ba33b5ce62f74d89e7788a and is easier to solve.  The
attached patch solves the problem for me: the reference to
rmail-total-messages now happens inside rmail-buffer, so the intended
value is taken.


  > I don't think I agree.  I think it will be very confusing if the
  > number in summary buffer's mode-line didn't reflect the actual
  > number of messages in the summary buffer.

Does rmail-total-messages get displayed somewhere?  I didn't know that.



Andrea Monaco




    * lisp/mail/rmailsum.el (rmail-summary-by-thread): Fix bug: get the
    right binding of rmail-total-messages.


diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 48c5cb70b33..2a504ca5a68 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -430,14 +430,15 @@ rmail-summary-by-thread
    (let* ((msg rmail-current-message)
          (prompt (concat "Show thread containing message number")))
      (list (read-number prompt msg))))
-  (with-current-buffer rmail-buffer
-    (unless msgnum
-      (setq msgnum rmail-current-message))
-    (unless (and rmail-summary-message-parents-vector
-                (= (length rmail-summary-message-parents-vector)
-                   (1+ rmail-total-messages)))
-      (rmail-summary-fill-message-parents-and-descs-vectors)))
-  (let ((enc-msgs (make-bool-vector (1+ rmail-total-messages) nil)))
+  (let (enc-msgs)
+    (with-current-buffer rmail-buffer
+      (setq enc-msgs (make-bool-vector (1+ rmail-total-messages) nil))
+      (unless msgnum
+       (setq msgnum rmail-current-message))
+      (unless (and rmail-summary-message-parents-vector
+                  (= (length rmail-summary-message-parents-vector)
+                     (1+ rmail-total-messages)))
+       (rmail-summary-fill-message-parents-and-descs-vectors)))
     (rmail-summary--walk-thread-message-recursively msgnum enc-msgs)
     (rmail-new-summary (format "thread containing message %d" msgnum)
                       (list 'rmail-summary-by-thread msgnum)



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Re: Value of rmail-total-messages in the summary buffer
  2024-05-07  9:00   ` [PATCH] " Andrea Monaco
@ 2024-05-11  9:18     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-05-11  9:18 UTC (permalink / raw)
  To: Andrea Monaco; +Cc: emacs-devel

> From: Andrea Monaco <andrea.monaco@autistici.org>
> Cc: emacs-devel@gnu.org
> Date: Tue, 07 May 2024 11:00:25 +0200
> 
> 
>   > Please show some simple recipe that exhibits the problem, as I'm not
>   > sure I understand how does that get in the way.
> 
> If I make a small summary by topic, say on this very topic, and then
> from the summary buffer I call rmail-summary-by-thread, again on this
> thread, I get an out-of-bounds error.  Can you replicate this?

Yes, thanks.

>   > Also, are you saying that the previous "buggy" value did not present
>   > the same problem?  If so, can you explain why?
> 
> Thinking more about it, the problem originated in
> 8729a2a10d9b8d88f6ba33b5ce62f74d89e7788a and is easier to solve.  The
> attached patch solves the problem for me: the reference to
> rmail-total-messages now happens inside rmail-buffer, so the intended
> value is taken.

Thanks.  The patch didn't apply cleanly, so I fixed that a bit
differently (on the master branch).



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-11  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-05 17:38 Value of rmail-total-messages in the summary buffer Andrea Monaco
2024-05-06 11:05 ` Eli Zaretskii
2024-05-07  9:00   ` [PATCH] " Andrea Monaco
2024-05-11  9:18     ` Eli Zaretskii

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.