all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nix <nix@esperi.org.uk>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: split-window-{right, below} not interchangeable with split-window-sensibly
Date: Mon, 23 Jul 2012 11:52:18 +0100	[thread overview]
Message-ID: <87liiavjfh.fsf@spindle.srvr.nix> (raw)
In-Reply-To: <87eho9e4bu.fsf@thinkpad.tsdh.de> (Tassilo Horn's message of "Wed, 18 Jul 2012 12:44:37 +0200")

On 18 Jul 2012, Tassilo Horn said:

> Tassilo Horn <tassilo@member.fsf.org> 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	other threads:[~2012-07-23 10:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18  6:52 split-window-{right, below} not interchangeable with split-window-sensibly Tassilo Horn
2012-07-18  8:22 ` Stefan Monnier
2012-07-18 10:16   ` Tassilo Horn
2012-07-18 10:44     ` Tassilo Horn
2012-07-23 10:52       ` Nix [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87liiavjfh.fsf@spindle.srvr.nix \
    --to=nix@esperi.org.uk \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.