views:

69

answers:

2

hi.

How do I tell in emacs window orientation, e.g. if it was created by vertical or horizontal split? alternatively, how can I tell if window can be resized vertically or horizontally?

on a related note, is there a tutorial for programming emacs windows, e.g. size, buffers associated, properties, etc.?

Thank you very much.

was able to dig up current-window-configurationand set-window-configuration. I am still learning emacs, so I am not sure what to do with configuration object of how to modify.

A: 

It seems that each buffer and frame has a set of local variables. It should be possible to extract all of the geometry info that way. See the manual. There is a lot of good info in the manual about manipulating windows/frames/buffers as well.

zdav
I believe the OP wants information about the 'window' and not the 'frame' or 'buffer'.
Noufal Ibrahim
+3  A: 

I'm assuming you're using the term 'window' to mean Emacs windows and not top level application windows (which in Emacs terminology are frames). If that's what you're looking for, zdav's answer provides some useful information.

There are two functions window-height and window-width. You could trivially code up a function which tells you whether a window is taller than it is wider (implying that it was created with a vertical split) or vice-versa. Window sizes are changed using shrink-window and enlarge-window. They have arguments to be told the resize horizontally if that's what you're looking for. There are a few other functions like window-splittable-p etc. which can help you with splitting windows.

For the entire scoop on playing with windows, consult the manual.

Noufal Ibrahim