unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Markus Triska <triska@gmx.at>
Subject: Re: rotate split windows
Date: Mon, 04 Dec 2006 20:54:37 +0100	[thread overview]
Message-ID: <87u00bl9mq.fsf@gmx.at> (raw)
In-Reply-To: mailman.1515.1165253652.2155.help-gnu-emacs@gnu.org

"wim yedema" <wim.yedema@gmail.com> writes:


> I would like to be able to "rotate" the split between windows, eg:
> from (A, B) vertical to (A, B) horizonal, to (B, A) vertical, to (B,
> A) horizontal, and the other way around. Can anyone tell me how to
> do this?


Add this to your .emacs:


(defun rotate-split ()
  (interactive)
  (let ((root (car (window-tree))))
    (if (listp root)
        (let* ((w1 (nth 2 root))
               (w2 (nth 3 root))
               (b1 (window-buffer w1))
               (b2 (window-buffer w2)))
          (cond ((car root)             ; currently vertically split
                 (delete-window w2)
                 (set-window-buffer (split-window-horizontally) b2))
                (t                      ; currently horizontally split
                 (delete-window w1)
                 (set-window-buffer (split-window-vertically) b1))))
      (message "Root window not split"))))

and invoke it with M-x rotate-split.

You can add this:

(global-set-key [f9] 'rotate-split)

to bind it to the function key F9 (for example).

The clockwise direction is analogous.


All the best,
Markus Triska

       reply	other threads:[~2006-12-04 19:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1515.1165253652.2155.help-gnu-emacs@gnu.org>
2006-12-04 19:54 ` Markus Triska [this message]
2006-12-05 10:09   ` rotate split windows Marco Wahl
2006-12-05 21:03     ` Chris Menzel
2006-12-06 18:12     ` Markus Triska
2006-12-06 21:34       ` Chris Menzel
2006-12-07  8:34       ` wim yedema
     [not found]       ` <mailman.1633.1165480499.2155.help-gnu-emacs@gnu.org>
2006-12-07 17:35         ` Markus Triska
2006-12-04 13:33 wim yedema
2006-12-04 21:22 ` Dieter Wilhelm

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87u00bl9mq.fsf@gmx.at \
    --to=triska@gmx.at \
    /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.
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).