unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Want split-window-vertically to split *vertically*
@ 2011-11-14 14:01 Ludwig, Mark
  2011-11-14 14:27 ` Tassilo Horn
  2011-11-14 15:41 ` FreeHCK
  0 siblings, 2 replies; 7+ messages in thread
From: Ludwig, Mark @ 2011-11-14 14:01 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

Greetings,

I am using Emacs 23.3.1 and want to know how to make split-window-vertically do as documented: split *vertically* no matter how wide the frame is.  There clearly is logic that decides to split *horizontally* when the frame is relatively wide.  Why does C-x 2 act this way when the other behavior is available (normally) on C-x 3?

(I frequently read very wide log files.  Besides that, I know what I'm doing, so want Emacs to "trust" me?)

Thanks,

Mark


[-- Attachment #2: Type: text/html, Size: 5120 bytes --]

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

* Re: Want split-window-vertically to split *vertically*
  2011-11-14 14:01 Want split-window-vertically to split *vertically* Ludwig, Mark
@ 2011-11-14 14:27 ` Tassilo Horn
  2011-11-14 14:51   ` Ludwig, Mark
  2011-11-14 15:41 ` FreeHCK
  1 sibling, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2011-11-14 14:27 UTC (permalink / raw)
  To: help-gnu-emacs

"Ludwig, Mark" <ludwig.mark@siemens.com> writes:

Hi Mark,

> I am using Emacs 23.3.1 and want to know how to make
> split-window-vertically do as documented: split *vertically* no matter
> how wide the frame is.  There clearly is logic that decides to split
> *horizontally* when the frame is relatively wide.  Why does C-x 2 act
> this way when the other behavior is available (normally) on C-x 3?

C-x 2 and C-x 3 should always do what their name suggests, except when
such a split would create a window that's smaller than window-min-height
/ window-min-width.  But even in that case, I don't get a different
split but a message is shown telling me that the window is too small to
be split.  (However, I'm testing with emacs 24, but I would be suprised
if emacs 23.3.1 was that much different.)

Anyway, can you give a recipe for reproducing that wrong split starting
with "emacs -Q"?

Bye,
Tassilo
-- 
(What the world needs (I think) is not
      (a Lisp (with fewer parentheses))
      but (an English (with more.)))
Brian Hayes, http://tinyurl.com/3y9l2kf




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

* RE: Want split-window-vertically to split *vertically*
  2011-11-14 14:27 ` Tassilo Horn
@ 2011-11-14 14:51   ` Ludwig, Mark
  2011-11-14 14:59     ` Tassilo Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Ludwig, Mark @ 2011-11-14 14:51 UTC (permalink / raw)
  To: Tassilo Horn, help-gnu-emacs@gnu.org

> From: Tassilo Horn
> Sent: Monday, November 14, 2011 8:27 AM
> To: help-gnu-emacs@gnu.org
> Subject: Re: Want split-window-vertically to split *vertically*
> 
> "Ludwig, Mark" <ludwig.mark@siemens.com> writes:
> 
> Hi Mark,
> 
> > I am using Emacs 23.3.1 and want to know how to make
> > split-window-vertically do as documented: split *vertically* no matter
> > how wide the frame is.  There clearly is logic that decides to split
> > *horizontally* when the frame is relatively wide.  Why does C-x 2 act
> > this way when the other behavior is available (normally) on C-x 3?
> 
> C-x 2 and C-x 3 should always do what their name suggests, except when
> such a split would create a window that's smaller than window-min-height
> / window-min-width.  But even in that case, I don't get a different
> split but a message is shown telling me that the window is too small to
> be split.  (However, I'm testing with emacs 24, but I would be suprised
> if emacs 23.3.1 was that much different.)
> 
> Anyway, can you give a recipe for reproducing that wrong split starting
> with "emacs -Q"?

Hi Tassilo,

Thanks for responding.  I don't have any .emacs file in this environment (painful for someone accustomed to lots of custom things, but so far superior to notepad or wordpad...).

I could have sworn that I tried C-x 2 and it split horizontally, but now I can't reproduce that (with or without -Q).

Anyway, it turns out that my complaint is with the behavior of list-matching-lines.  It decides to put the *Occur* buffer side-by-side on wide frames.  I reflexively fix that with C-x 0, but then pressing RET on top of an occurrence invokes occur-mode-goto-occurrence that also decides to split wide frames horizontally.  Neither function documents any way to influence this behavior.  Is there a way?

This has the feel of something someone considered an enhancement, and when I'm working with source files (usually still in the form of 80-byte-wide punch cards), I kinda like it too.  I think what I'm looking for is smarter logic that senses the width of the content versus the width of the resulting window....

Thanks,

Mark




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

* Re: Want split-window-vertically to split *vertically*
  2011-11-14 14:51   ` Ludwig, Mark
@ 2011-11-14 14:59     ` Tassilo Horn
  0 siblings, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2011-11-14 14:59 UTC (permalink / raw)
  To: help-gnu-emacs

"Ludwig, Mark" <ludwig.mark@siemens.com> writes:

Hi Mark,

> Anyway, it turns out that my complaint is with the behavior of
> list-matching-lines.  It decides to put the *Occur* buffer
> side-by-side on wide frames.  I reflexively fix that with C-x 0, but
> then pressing RET on top of an occurrence invokes
> occur-mode-goto-occurrence that also decides to split wide frames
> horizontally.  Neither function documents any way to influence this
> behavior.  Is there a way?

Ah, now I understand.  Have a look at

,----[ C-h v split-window-preferred-function RET ]
| split-window-preferred-function is a variable defined in `window.el'.
| Its value is split-window-sensibly
| 
|   This variable is potentially risky when used as a file local variable.
| 
| Documentation:
| Function called by `display-buffer' routines to split a window.
| This function is called with a window as single argument and is
| supposed to split that window and return the new window.  If the
| window can (or shall) not be split, it is supposed to return nil.
| The default is to call the function `split-window-sensibly' which
| tries to split the window in a way which seems most suitable.
| You can customize the options `split-height-threshold' and/or
| `split-width-threshold' in order to have `split-window-sensibly'
| prefer either vertical or horizontal splitting.
| 
| If you set this to any other function, bear in mind that the
| `display-buffer' routines may call this function two times.  The
| argument of the first call is the largest window on its frame.
| If that call fails to return a live window, the function is
| called again with the least recently used window as argument.  If
| that call fails too, `display-buffer' will use an existing window
| to display its buffer.
| 
| The window selected at the time `display-buffer' was invoked is
| still selected when this function is called.  Hence you can
| compare the window argument with the value of `selected-window'
| if you intend to split the selected window instead or if you do
| not want to split the selected window.
| 
| You can customize this variable.
| 
| This variable was introduced, or its default value was changed, in
| version 23.1 of Emacs.
`----

and

,----[ C-h f split-window-sensibly RET ]
| split-window-sensibly is a compiled Lisp function in `window.el'.
| 
| (split-window-sensibly WINDOW)
| 
| Split WINDOW in a way suitable for `display-buffer'.
| If `split-height-threshold' specifies an integer, WINDOW is at
| least `split-height-threshold' lines tall and can be split
| vertically, split WINDOW into two windows one above the other and
| return the lower window.  Otherwise, if `split-width-threshold'
| specifies an integer, WINDOW is at least `split-width-threshold'
| columns wide and can be split horizontally, split WINDOW into two
| windows side by side and return the window on the right.  If this
| can't be done either and WINDOW is the only window on its frame,
| try to split WINDOW vertically disregarding any value specified
| by `split-height-threshold'.  If that succeeds, return the lower
| window.  Return nil otherwise.
| 
| By default `display-buffer' routines call this function to split
| the largest or least recently used window.  To change the default
| customize the option `split-window-preferred-function'.
| 
| You can enforce this function to not split WINDOW horizontally,
| by setting (or binding) the variable `split-width-threshold' to
| nil.  If, in addition, you set `split-height-threshold' to zero,
| chances increase that this function does split WINDOW vertically.
| 
| In order to not split WINDOW vertically, set (or bind) the
| variable `split-height-threshold' to nil.  Additionally, you can
| set `split-width-threshold' to zero to make a horizontal split
| more likely to occur.
| 
| Have a look at the function `window-splittable-p' if you want to
| know how `split-window-sensibly' determines whether WINDOW can be
| split.
`----

Bye,
Tassilo
-- 
(What the world needs (I think) is not
      (a Lisp (with fewer parentheses))
      but (an English (with more.)))
Brian Hayes, http://tinyurl.com/3y9l2kf




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

* Re: Want split-window-vertically to split *vertically*
  2011-11-14 14:01 Want split-window-vertically to split *vertically* Ludwig, Mark
  2011-11-14 14:27 ` Tassilo Horn
@ 2011-11-14 15:41 ` FreeHCK
  1 sibling, 0 replies; 7+ messages in thread
From: FreeHCK @ 2011-11-14 15:41 UTC (permalink / raw)
  To: help-gnu-emacs

"Ludwig, Mark" <ludwig.mark@siemens.com> writes:
> I am using Emacs 23.3.1 and want to know how to make
> split-window-vertically do as documented: split *vertically* no matter
> how wide the frame is.  There clearly is logic that decides to split
> *horizontally* when the frame is relatively wide.  Why does C-x 2 act
> this way when the other behavior is available (normally) on C-x 3? (I
> frequently read very wide log files.  Besides that, I know what
> I&#8217;m doing, so want Emacs to &#8220;trust&#8221; me?)

------------------------------------------------------------------------
$ LANG=C apt-cache policy emacs23-nox
emacs23-nox:
  Installed: 23.2+1-7
  Candidate: 23.2+1-7
------------------------------------------------------------------------

It's certainly not 23.3.1, but there is no problems here. It won't create
window smaller than some minimum size, and there is no words in
documentation that it should split window "no matter how wide window is".

Lower I put documentation of my version of this function.

------------------------------------------------------------------------
(split-window-vertically &optional SIZE)

Split selected window into two windows, one above the other.
The upper window gets SIZE lines and the lower one gets the rest.
SIZE negative means the lower window gets -SIZE lines and the
upper one the rest.  With no argument, split windows equally or
close to it.  Both windows display the same buffer, now current.

If the variable `split-window-keep-point' is non-nil, both new
windows will get the same value of point as the selected window.
This is often more convenient for editing.  The upper window is
the selected window.

Otherwise, we choose window starts so as to minimize the amount of
redisplay; this is convenient on slow terminals.  The new selected
window is the one that the current value of point appears in.  The
value of point can change if the text around point is hidden by the
new mode line.

Regardless of the value of `split-window-keep-point', the upper
window is the original one and the return value is the new, lower
window.
------------------------------------------------------------------------

Is this documentation up-to-date for your version Emacs?



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

* Re: Want split-window-vertically to split *vertically*
       [not found] <mailman.14705.1321279291.797.help-gnu-emacs@gnu.org>
@ 2011-11-14 16:51 ` Jonathan Oddie
  2011-11-14 20:14   ` Peter Dyballa
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Oddie @ 2011-11-14 16:51 UTC (permalink / raw)
  To: help-gnu-emacs


Hi Mark,
> 
> I am using Emacs 23.3.1 and want to know how to make split-window-vertically do as documented: split *vertically* no matter how wide the frame is.  There clearly is logic that decides to split *horizontally* when the frame is relatively wide.  Why does C-x 2 act this way when the other behavior is available (normally) on C-x 3?
> 

My Emacs (also 23.3.1) seems to behave the way you would like out of
the box, so I'm not sure what causes this. (Is C-x 2 really bound to
`split-window-vertically' and not `split-window-sensibly'?) Maybe I
just don't have a wide enough screen ;-)

However, I did find myself wanting to convince Dired's `o' command
recently to always split the window vertically rather than
horizontally and I think you might want to look at the variables
`split-height-threshold' and `split-width-threshold'. Setting
`split-height-threshold' very low was the temporary fix I needed in my
case. There is also the variable `split-window-preferred-function'
which might be of interest, though I think that is used mostly by
`switch-to-buffer-other-window' and friends.

HTH,
Jonathan

> (I frequently read very wide log files.  Besides that, I know what I'm doing, so want Emacs to "trust" me?)
> 
> Thanks,
> 
> Mark
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.gnu.org/archive/html/help-gnu-emacs/attachments/20111114/b0712d26/attachment.html>
> 
> ------------------------------
> 
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-gnu-emacs
> 
> 
> End of help-gnu-emacs Digest, Vol 108, Issue 28
> ***********************************************




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

* Re: Want split-window-vertically to split *vertically*
  2011-11-14 16:51 ` Jonathan Oddie
@ 2011-11-14 20:14   ` Peter Dyballa
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2011-11-14 20:14 UTC (permalink / raw)
  To: Jonathan Oddie; +Cc: help-gnu-emacs


Am 14.11.2011 um 17:51 schrieb Jonathan Oddie:

> Maybe I just don't have a wide enough screen ;-)

Make it ten lines high! (And 80 columns, screen-wide. A new frame would be OK for testing.)

Since I am also using the self-compiled Emacsen before they are released I remember a period when window splitting was a bit unpredictable (there were bugs in the code). Code from this period was never released. The developers made the released code finally behave in GNU Emacs like before. I've found the entry from lisp/ChangeLog.14:

2009-05-07  Martin Rudalics  <rudalics@gmx.at>

	* window.el (split-window-sensibly): New function.
	(split-height-threshold, split-width-threshold): State in
	doc-string that these affect split-window-sensibly.
	Change customization subtype from number to integer.
	(window--splittable-p): Rename to window-splittable-p since it's
	referred to in doc-string of split-window-sensibly.  Update doc-string.
	(window--try-to-split-window): Unconditionally call
	split-window-preferred-function and move splitting functionality
	to split-window-sensibly (Bug#3142).
	(split-window-preferred-function): Rewrite doc-string.
	Don't allow nil as customization type.


--
Greetings

  Pete

Either this man is dead or my watch has stopped.
				- Groucho Marx




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

end of thread, other threads:[~2011-11-14 20:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-14 14:01 Want split-window-vertically to split *vertically* Ludwig, Mark
2011-11-14 14:27 ` Tassilo Horn
2011-11-14 14:51   ` Ludwig, Mark
2011-11-14 14:59     ` Tassilo Horn
2011-11-14 15:41 ` FreeHCK
     [not found] <mailman.14705.1321279291.797.help-gnu-emacs@gnu.org>
2011-11-14 16:51 ` Jonathan Oddie
2011-11-14 20:14   ` Peter Dyballa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).