unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Monaco <andrea.monaco@autistici.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: [PATCH] Re: Value of rmail-total-messages in the summary buffer
Date: Tue, 07 May 2024 11:00:25 +0200	[thread overview]
Message-ID: <87a5l20zfa.fsf@autistici.org> (raw)
In-Reply-To: <861q6fci9w.fsf@gnu.org> (message from Eli Zaretskii on Mon, 06 May 2024 14:05:31 +0300)


  > 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)



  reply	other threads:[~2024-05-07  9:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Andrea Monaco [this message]
2024-05-11  9:18     ` [PATCH] " 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87a5l20zfa.fsf@autistici.org \
    --to=andrea.monaco@autistici.org \
    --cc=eliz@gnu.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).