unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Sensible values for `display-buffer-base-action'
@ 2022-06-07  8:24 Philip Kaludercic
  2022-06-07  8:41 ` Emanuel Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2022-06-07  8:24 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,

I am wondering if anyone has a clever `display-buffer-base-action' (or
`display-buffer-alist') customisation they could share?  Even after
years of using Emacs, I often have no idea where a buffer might be
displayed?  I have tried things like

    (setq display-buffer-alist
          '(("\\`\\*.*\\*\\'"		;display *...* buffers in a new window
            (display-buffer-reuse-window
             display-buffer-pop-up-window)))
          display-buffer-base-action	;otherwise use the same
          '((display-buffer-reuse-window
             display-buffer-reuse-mode-window
             display-buffer-same-window
             display-buffer-pop-up-frame)))

but as earmuffs are usually used to display buffers without files, this
breaks systems like Gnus.

One recent annoyance I had was that if I have a window layout like this
(in combination with agda2-mode):

-------------------------------------------------
| 1                    | 2                      |
|                      |                        |
|                      |                        |
|                      |                        |
|                      |                        |
|                      |                        |
|                      |                        |
|                      |                        |
|                      |                        |
-------------------------------------------------
| 3                                             |
|                                               |
-------------------------------------------------

a new popup buffer (display-buffer-pop-up-window) is displayed by
splitting window 3 (which is just a 2-5 lines high) and displaying it
just below window 2.

It seems to me that there must be a better way, but I cannot formalise
any set of rules on how buffers should be displayed, when you have more
than two windows opened.

Any tips?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sensible values for `display-buffer-base-action'
  2022-06-07  8:24 Sensible values for `display-buffer-base-action' Philip Kaludercic
@ 2022-06-07  8:41 ` Emanuel Berg
  2022-06-07  9:26   ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2022-06-07  8:41 UTC (permalink / raw)
  To: help-gnu-emacs

Philip Kaludercic wrote:

> I am wondering if anyone has a clever
> `display-buffer-base-action' (or `display-buffer-alist')
> customisation they could share?

`display-buffer-alist' is nil (the default) and ...

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/window-incal.el

(setq display-buffer-base-action '((display-buffer-reuse-window
                                    display-buffer-same-window) ))

(defun beginning-of-line-at-top ()
  (beginning-of-line)
  (recenter 0) )

;; the two-window solution

(defun other-window-or-split ()
  (interactive)
  (when (one-window-p)
    (split-window-below) )
  (other-window 1) )

(defun swap-windows ()
  (interactive)
  (let ((buffer (current-buffer)))
    (other-window 1)
    (switch-to-buffer-other-window (current-buffer))
    (other-window 1)
    (switch-to-buffer buffer) ))

;; window size shorthands

(defun window-increase-size (lines)
  (interactive "p")
  (window-resize nil lines) ) ; the current WINDOW

(defun window-decrease-size (lines)
  (interactive "p")
  (window-resize nil (* -1 lines) ))

(provide 'window-incal)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sensible values for `display-buffer-base-action'
  2022-06-07  8:41 ` Emanuel Berg
@ 2022-06-07  9:26   ` Philip Kaludercic
  2022-06-07  9:45     ` Emanuel Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2022-06-07  9:26 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <incal@dataswamp.org> writes:

> Philip Kaludercic wrote:
>
>> I am wondering if anyone has a clever
>> `display-buffer-base-action' (or `display-buffer-alist')
>> customisation they could share?
>
> `display-buffer-alist' is nil (the default) and ...
>
> ;;; -*- lexical-binding: t -*-
> ;;
> ;; this file:
> ;;   https://dataswamp.org/~incal/emacs-init/window-incal.el
>
> (setq display-buffer-base-action '((display-buffer-reuse-window
>                                     display-buffer-same-window) ))

The annoying thing about this is that everything is displayed in the
same window by default.  If I do this, I would have to manually
whitelist every type of buffer I want to display in the other-window,
such as documentation (*Help*, *Man*, ...).



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sensible values for `display-buffer-base-action'
  2022-06-07  9:26   ` Philip Kaludercic
@ 2022-06-07  9:45     ` Emanuel Berg
  2022-06-07 10:27       ` Philip Kaludercic
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2022-06-07  9:45 UTC (permalink / raw)
  To: help-gnu-emacs

Philip Kaludercic wrote:

>> (setq display-buffer-base-action '((display-buffer-reuse-window
>>                                     display-buffer-same-window) ))
>
> The annoying thing about this is that everything is
> displayed in the same window by default. If I do this,
> I would have to manually whitelist every type of buffer
> I want to display in the other-window, such as documentation
> (*Help*, *Man*, ...).

_That's_ the annoying thing?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sensible values for `display-buffer-base-action'
  2022-06-07  9:45     ` Emanuel Berg
@ 2022-06-07 10:27       ` Philip Kaludercic
  2022-06-07 13:21         ` Emanuel Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2022-06-07 10:27 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <incal@dataswamp.org> writes:

> Philip Kaludercic wrote:
>
>>> (setq display-buffer-base-action '((display-buffer-reuse-window
>>>                                     display-buffer-same-window) ))
>>
>> The annoying thing about this is that everything is
>> displayed in the same window by default. If I do this,
>> I would have to manually whitelist every type of buffer
>> I want to display in the other-window, such as documentation
>> (*Help*, *Man*, ...).
>
> _That's_ the annoying thing?

It is one instance of it, and usually the one I notice first whenever I
try this specific customisation.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sensible values for `display-buffer-base-action'
  2022-06-07 10:27       ` Philip Kaludercic
@ 2022-06-07 13:21         ` Emanuel Berg
  0 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2022-06-07 13:21 UTC (permalink / raw)
  To: help-gnu-emacs

Philip Kaludercic wrote:

>>>> (setq display-buffer-base-action '((display-buffer-reuse-window
>>>>                                     display-buffer-same-window) ))
>>>
>>> The annoying thing about this is that everything is
>>> displayed in the same window by default. If I do this,
>>> I would have to manually whitelist every type of buffer
>>> I want to display in the other-window, such as
>>> documentation (*Help*, *Man*, ...).
>>
>> _That's_ the annoying thing?
>
> It is one instance of it, and usually the one I notice first
> whenever I try this specific customisation.

It is the purpose of it.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-07 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-07  8:24 Sensible values for `display-buffer-base-action' Philip Kaludercic
2022-06-07  8:41 ` Emanuel Berg
2022-06-07  9:26   ` Philip Kaludercic
2022-06-07  9:45     ` Emanuel Berg
2022-06-07 10:27       ` Philip Kaludercic
2022-06-07 13:21         ` Emanuel Berg

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