emacs-devel
[Top][All Lists]
Advanced

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

Re: split-window-{right, below} not interchangeable with split-window-se


From: Nix
Subject: Re: split-window-{right, below} not interchangeable with split-window-sensibly
Date: Mon, 23 Jul 2012 11:52:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

On 18 Jul 2012, Tassilo Horn said:

> Tassilo Horn <address@hidden> writes:
>
>> This large value basically forbids "sensible" vertical splits for
>> almost everybody.
>
> No, that's not completely wrong.  `split-window-sensibly' has a final
> special case for "there's only one window" where it simply splits
> vertically.
>
> But anyway, the result is that on any customary display the first
> invocation of `split-window-sensibly' either creates two windows below
> or next to each other, and any further invocation does nothing.

Quite. I'm afraid I noticed this a year and a half ago in my switch from
XEmacs, which didn't have this problem... but my fix was hardly
acceptable for trunk, since it just retains the same problem but shifts
it by ninety degrees:

(defun split-window-sensibly-preferring-horizontal (window)
  "Like `split-window-sensibly', but preferring horizontal splits."
  (or (and (window-splittable-p window t)
           ;; Split window horizontally.
           (with-selected-window window
             (split-window-horizontally)))
      (and (window-splittable-p window)
           ;; Split window vertically.
           (with-selected-window window
             (split-window-vertically)))
      (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-vertically)))))))

(setq split-height-threshold 50
      split-window-preferred-function 
'split-window-sensibly-preferring-horizontal)

-- 
NULL && (void)



reply via email to

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