help-gnu-emacs
[Top][All Lists]
Advanced

[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:32:28 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Argh,

never fiddle with code in an email message.  It can only be wrong.  So
here's a corrected version:

--8<---------------cut here---------------start------------->8---
(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
windows."
  (let ((window (or (and window (not (window-dedicated-p window)) window)
                    (selected-window))))
    (or (and (window-splittable-p window t)
             ;; Split window horizontally.
             (with-selected-window window
               (split-window-right)))
        (and (window-splittable-p window)
             ;; Split window vertically.
             (with-selected-window window
               (split-window-below)))
        (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
                   (split-window-below))))))))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



reply via email to

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