From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?G=C3=B6ktu=C4=9F_Kayaalp?= Newsgroups: gmane.emacs.devel Subject: Potential bug in the logic of rmail-select-summary Date: Tue, 19 Jan 2021 15:23:02 +0300 Message-ID: <87a6t5jeu1.fsf@gkayaalp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35453"; mail-complaints-to="usenet@ciao.gmane.io" To: Emacs devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 19 13:23:51 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1q34-00093C-2A for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jan 2021 13:23:50 +0100 Original-Received: from localhost ([::1]:41622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1q33-0007hC-47 for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jan 2021 07:23:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1q2O-00075f-Hp for emacs-devel@gnu.org; Tue, 19 Jan 2021 07:23:08 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:34441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1q2M-0007OV-Ey for emacs-devel@gnu.org; Tue, 19 Jan 2021 07:23:08 -0500 X-Originating-IP: 46.2.237.117 Original-Received: from localhost (unknown [46.2.237.117]) (Authenticated sender: self@gkayaalp.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 6938F1BF207 for ; Tue, 19 Jan 2021 12:23:03 +0000 (UTC) Received-SPF: none client-ip=217.70.183.201; envelope-from=self@gkayaalp.com; helo=relay8-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263167 Archived-At: Hello, When both an Rmail buffer and it=E2=80=99s 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 =E2=80=98current= =E2=80=99, and =E2=80=98X=E2=80=99 is the active cursor: 1. window setup: [ current-summary ] [ current X ] 2. hit =E2=80=98n=E2=80=99, i.e. rmail-next-undeleted-message 3. resulting window setup: [ current-summary ] [ current-summary X ] This is not the case when =E2=80=98current=E2=80=99 is the sole buffer, whe= n I navigate messages the window keeps on displaying =E2=80=98current=E2=80=99 as expect= ed. 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=E2=80=99m not sure if the original behaviour is actu= ally wrong or not. Am I not understanding what it=E2=80=99s supposed to do, or = is this a bug? One caveat of my little =E2=80=98fix=E2=80=99 is the point is not updated i= n 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=C3=B6ktu=C4=9F. (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))) --=20 =C4=B0. G=C3=B6ktu=C4=9F Kayaalp / @cadadr / pgp: 024C 30DD 597D 142B 49AC 40EB 465C D949 B101 2427