From: "Göktuğ Kayaalp" <self@gkayaalp.com>
To: Emacs devel <emacs-devel@gnu.org>
Subject: Potential bug in the logic of rmail-select-summary
Date: Tue, 19 Jan 2021 15:23:02 +0300 [thread overview]
Message-ID: <87a6t5jeu1.fsf@gkayaalp.com> (raw)
Hello,
When both an Rmail buffer and it’s summary buffer are displayed
simultaneously, when something triggers rmail-show-message when
navigating inside the Rmail buffer, the Rmail buffer is replaced with
the summary buffer. E.g., assume we have an mbox called ‘current’, and
‘X’ is the active cursor:
1. window setup: [ current-summary ] [ current X ]
2. hit ‘n’, i.e. rmail-next-undeleted-message
3. resulting window setup: [ current-summary ] [ current-summary X ]
This is not the case when ‘current’ is the sole buffer, when I navigate
messages the window keeps on displaying ‘current’ as expected.
rmail-next-undeleted-message calls rmail-show-message which triggers
rmail-select-summary, which has the following logic in it:
- if rmail-summary-displayed
- rmail-pop-to-buffer rmail-summary-buffer ...
- else
- with-current-buffer rmail-summary-buffer ...
Which IMHO is the opposite of what needs to happen. If the summary
buffer is already displayed, why pop to it again?
When I flip the then and else clauses around like below, it behaves like
I expect it to. Tho I’m not sure if the original behaviour is actually
wrong or not. Am I not understanding what it’s supposed to do, or is
this a bug?
One caveat of my little ‘fix’ is the point is not updated in the summary
buffer, which results in the annoying behaviour where when I switch to
the summary buffer highlighted msg is not the one in the rmail buffer
but the last one I moved to in the summary buffer.
FWIW the exact thing I want to do in terms of usage is to just see the
rmail buffer and the associated summary buffer simultaneously.
Best,
-Göktuğ.
(defmacro rmail-select-summary (&rest body)
`(let ((total rmail-total-messages))
(if (rmail-summary-displayed)
(with-current-buffer rmail-summary-buffer
(let ((rmail-total-messages total))
,@body))
(let ((window (selected-window)))
(save-excursion
(unwind-protect
(progn
(rmail-pop-to-buffer rmail-summary-buffer)
;; rmail-total-messages is a buffer-local var
;; in the rmail buffer.
;; This way we make it available for the body
;; even tho the rmail buffer is not current.
(let ((rmail-total-messages total))
,@body))
(select-window window)))))
(rmail-maybe-display-summary)))
--
İ. Göktuğ Kayaalp / @cadadr / <https://www.gkayaalp.com/>
pgp: 024C 30DD 597D 142B 49AC 40EB 465C D949 B101 2427
next reply other threads:[~2021-01-19 12:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 12:23 Göktuğ Kayaalp [this message]
2021-01-19 14:50 ` Potential bug in the logic of rmail-select-summary Eli Zaretskii
2021-01-19 17:14 ` Göktuğ Kayaalp
2021-01-19 18:33 ` Eli Zaretskii
2021-01-19 19:04 ` martin rudalics
2021-01-20 14:09 ` Göktuğ Kayaalp
2021-01-20 16:51 ` martin rudalics
2021-01-27 23:23 ` Göktuğ Kayaalp
2021-01-28 9:42 ` martin rudalics
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=87a6t5jeu1.fsf@gkayaalp.com \
--to=self@gkayaalp.com \
--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).