Search code examples
emacs

Emacs window positioning


maybe this is stupid question.. but i'm trying to get my emacs customization fine grained.. is there a direct command to change windows like this?

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

to

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

or am i going to need to start learning elisp?


Solution

  • yes you will, but toying with window layout and buffers is very good place to start. here's a solution for you, it gives you most of what you need to customise your layouts.

    add the code below to your .emacs. C-x C-e to evaluate it, then hopefully hitting F5 will do as you expect (provided you haven't killed the '*Messages*' buffer).

    global-set-key '[f5] '(lambda () (interactive)             
                            (let ((other (buffer-name (window-buffer (next-window)))))
                            (delete-other-windows)
                        (set-frame-width (selected-frame)
                        (+ (frame-width (selected-frame)) (window-width)))
                        (split-window-horizontally)
                        (split-window-vertically)
                        (with-selected-window (next-window)
                           (set-window-buffer (selected-window) other))
                        (with-selected-window (previous-window) 
                           (set-window-buffer (selected-window) "*Messages*")))))