emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Potential bug in the logic of rmail-select-summary


From: martin rudalics
Subject: Re: Potential bug in the logic of rmail-select-summary
Date: Wed, 20 Jan 2021 17:51:22 +0100

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]