unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: "Göktuğ Kayaalp" <self@gkayaalp.com>
Cc: eliz@gnu.org, emacs-devel@gnu.org
Subject: Re: Potential bug in the logic of rmail-select-summary
Date: Wed, 20 Jan 2021 17:51:22 +0100	[thread overview]
Message-ID: <d41a0f55-917f-4a2e-bc64-1b12db069a7c@gmx.at> (raw)
In-Reply-To: <87zh13wvh3.fsf@gkayaalp.com>

 > A
 > more sophisticated config which is what I’d actually like to have
 > behaves a bit more weirdly:
 >
 > (setq
 >   display-buffer-alist
 >   '(((lambda (b _) (eq (with-current-buffer b major-mode) 'rmail-summary-mode))
 >      .
 >      (gk-display-buffer-for-rmail))))
 >
 > (defun gk-display-buffer-for-rmail (buffer _)
 >    (if (= (length (window-list)) 1)
 >        (display-buffer-in-direction buffer '((direction . left)))
 >      ;; If there are 1+ windows, use the top quarter of selected
 >      ;; window.
 >      (split-window-vertically (/ (window-height) 4))
 >      (switch-to-buffer buffer)))

While the 'switch-to-buffer' is not entirely kosher in this context
('display-buffer-in-direction' returns a window, 'switch-to-buffer' a
buffer) this function should do what you want when applied to some
arbitrary buffer.

However, it misses one important aspect of the original 'pop-to-buffer':
When a non-selected window showing the buffer already exists, it reuses
that window.  Your function doesn't do that and that causes the problems
you see when it is called multiple times in a row (as rmailsum.el does)
because it always tries to make a new window.

So I suggest you put a 'display-buffer-reuse-window' at the beginning of
'gk-display-buffer-for-rmail' and test how it behaves then.

martin




  reply	other threads:[~2021-01-20 16:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 12:23 Potential bug in the logic of rmail-select-summary Göktuğ Kayaalp
2021-01-19 14:50 ` 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 [this message]
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=d41a0f55-917f-4a2e-bc64-1b12db069a7c@gmx.at \
    --to=rudalics@gmx.at \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=self@gkayaalp.com \
    /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).