emacs-devel
[Top][All Lists]
Advanced

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

Re: `split-window-preferred-horizontally'


From: martin rudalics
Subject: Re: `split-window-preferred-horizontally'
Date: Sat, 07 Jun 2008 10:21:48 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> That's how I would like it:
>
> If the *frame* is >= 160 chars wide
>
>   - if it is already (horizontally) split use the *other* window with
>     all the `*-other-window' commands and `display-buffer'

`split-window-preferred-function' should decide if and how to split the
largest (or most recently used) window offered by `display-buffer'.  It
cannot decide which window to use when _no_ window gets split.

>   - otherwise split it horizontally.
>
> If the *frame* is < 160 chars wide do above with s/horizontally/vertically/
> (as the default behavior already is).

(defun my-spf (window)
  (if (>= (frame-width (window-frame window)) 120)
      (when (window-full-width-p window)
        (let ((split-width-threshold 120))
          (split-window window nil t)))
    (split-window)))

seems to do what you want with a value of 120 - I can't test 160 here.

> I suspect that emacs thinks my already (horizontally) split frame is to
> small because the *window* is just 80 + ? chars wide.

The value of `split-width-threshold' must be set accordingly to handle
this when your frame contains more than one window.  If WINDOW is 120
columns wide, `split-width-threshold' equals 160, and you have more than
one window on your frame, `split-window' should refuse to split WINDOW.





reply via email to

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