all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* split-window-{right, below} not interchangeable with split-window-sensibly
@ 2012-07-18  6:52 Tassilo Horn
  2012-07-18  8:22 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2012-07-18  6:52 UTC (permalink / raw)
  To: emacs-devel

Hello,

I really like sensible window splitting, and basically I want to use it
almost everywhere.  (That's what split-window-preferred-function is for
which works just fine.)

However, there are modes like ediff that have their own
foo-split-window-fn defcustom.  There you can use both
split-window-{right,below}, but split-window-sensibly doesn't
necessarily work, because the former functions have an optional SIZE arg
while the latter has a mandatory WINDOW arg.

For example, ediff just does

    (funcall ediff-split-window-function)

and that clearly errors if its set to split-window-sensibly.
Internally, ediff somehow ignores the error and you end up with only one
buffer.

Wouldn't it make sense to have the same signatures for
split-window-sensibly and the other two functions so that they were
interchangeable?

Well, the SIZE arg is not too meaningful for split-window-sensibly as it
would mean either SIZE cols or lines...  So maybe just making its WINDOW
arg optional would suffice for almost all use-cases.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: split-window-{right, below} not interchangeable with split-window-sensibly
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2012-07-18  8:22 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: emacs-devel

> Well, the SIZE arg is not too meaningful for split-window-sensibly as it
> would mean either SIZE cols or lines...  So maybe just making its WINDOW
> arg optional would suffice for almost all use-cases.

That sounds reasonable, feel free to install such a patch,


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: split-window-{right, below} not interchangeable with split-window-sensibly
  2012-07-18  8:22 ` Stefan Monnier
@ 2012-07-18 10:16   ` Tassilo Horn
  2012-07-18 10:44     ` Tassilo Horn
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2012-07-18 10:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> Well, the SIZE arg is not too meaningful for split-window-sensibly as
>> it would mean either SIZE cols or lines...  So maybe just making its
>> WINDOW arg optional would suffice for almost all use-cases.
>
> That sounds reasonable, feel free to install such a patch,

Done so in revno 109136.

While testing I noticed that repeatedly doing

   M-: (split-window-sensibly) RET

in a fullscreen emacs on a widescreen display with just one window
didn't create something like

  +----------+-----------+
  |          |           |
  |          |           |
  +----------+           |
  |          |           |
  |          |           |
  +----------+-----------+

but it won't split any further after

  +----------+-----------+
  |          |           |
  |          |           |
  |          |           |
  |          |           |
  |          |           |
  +----------+-----------+

because `split-height-threshold' is set to 80 lines by default.  Is that
default reasonable and intended?  IMO, something like 20 lines would
make more sense...

With my quite big 24" display, a common font size, and no menu or tool
bars, I have at most 75 lines in a window in a maximized emacs.  This
large value basically forbids "sensible" vertical splits for almost
everybody.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: split-window-{right, below} not interchangeable with split-window-sensibly
  2012-07-18 10:16   ` Tassilo Horn
@ 2012-07-18 10:44     ` Tassilo Horn
  2012-07-23 10:52       ` Nix
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2012-07-18 10:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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.

That might be problematic.  With split-window-{below,right} you can be
quite sure that a new window is created, while that's not true for
split-window-sensibly.  Well, for ediff it's not because it'll delete
all but one window initially, and sensible splitting in the one-window
scenario is guaranteed to split (with the exception of
window-min-{height,width}, of course).

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: split-window-{right, below} not interchangeable with split-window-sensibly
  2012-07-18 10:44     ` Tassilo Horn
@ 2012-07-23 10:52       ` Nix
  0 siblings, 0 replies; 5+ messages in thread
From: Nix @ 2012-07-23 10:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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)



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-23 10:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.