[Top][All Lists]

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

Re: Dedicated window troubles

From: Tassilo Horn
Subject: Re: Dedicated window troubles
Date: Thu, 19 Feb 2015 14:26:09 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Alexis <address@hidden> writes:

> TH> But since wide displays are so common nowadays, there must be an TH> easy
> way to achieve what I'm looking for, no?
> Given my own workflow and preferences, i too am very interested in how
> to achieve this!

FWIW, since nobody replied within 10 minutes, that's what I'm using now:

--8<---------------cut here---------------start------------->8---
(setq split-width-threshold 152
      split-height-threshold 60)

(defun th/split-window-sensibly (&optional window)
  "Split WINDOW in a way suitable for `display-buffer'.
Like `split-window-sensibly' but first try horizontal splits,
then vertical splits, and also try not to split dedicated
  (let ((window (or (and window (not (window-dedicated-p window)))
    (or (and (window-splittable-p window t)
             ;; Split window horizontally.
             (with-selected-window window
        (and (window-splittable-p window)
             ;; Split window vertically.
             (with-selected-window window
        (and (eq window (frame-root-window (window-frame window)))
             (not (window-minibuffer-p window))
             ;; If WINDOW is the only window on its frame and is not the
             ;; minibuffer window, try to split it vertically disregarding
             ;; the value of `split-height-threshold'.
             (let ((split-height-threshold 0))
               (when (window-splittable-p window)
                 (with-selected-window window

(setq split-window-preferred-function #'th/split-window-sensibly)
--8<---------------cut here---------------end--------------->8---

That works fine so far.  I also modified it so that it is less likely to
split dedicated windows.


reply via email to

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