Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Toggle between Vertical and Horizontal Windows Splitting
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nordlöw  
View profile  
 More options Nov 14 2008, 8:43 am
Newsgroups: gnu.emacs.help
From: Nordlöw <per.nord...@gmail.com>
Date: Fri, 14 Nov 2008 05:43:55 -0800 (PST)
Local: Fri, Nov 14 2008 8:43 am
Subject: Toggle between Vertical and Horizontal Windows Splitting
Requested: Function that toggles between vertical and horizontal split
layout of currently defined windows preferrably preserving splitting
ratio.

Thanks in advance,
Nordlöw


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fabrice Niessen  
View profile  
 More options Nov 14 2008, 8:54 am
Newsgroups: gnu.emacs.help
From: "Fabrice Niessen" <tdhkhcidi...@spammotel.com>
Date: Fri, 14 Nov 2008 14:54:46 +0100
Local: Fri, Nov 14 2008 8:54 am
Subject: Re: Toggle between Vertical and Horizontal Windows Splitting
Nordlöw,

> Requested: Function that toggles between vertical and
> horizontal split layout of currently defined windows
> preferrably preserving splitting ratio.

You can find the following:

--8<---------------cut here---------------start------------->8---
(defun my-toggle-window-split ()
  "Vertical split shows more of each line, horizontal split shows
more lines. This code toggles between them. It only works for
frames with exactly two windows."
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
             (next-win-buffer (window-buffer (next-window)))
             (this-win-edges (window-edges (selected-window)))
             (next-win-edges (window-edges (next-window)))
             (this-win-2nd (not (and (<= (car this-win-edges)
                                         (car next-win-edges))
                                     (<= (cadr this-win-edges)
                                         (cadr next-win-edges)))))
             (splitter
              (if (= (car this-win-edges)
                     (car (window-edges (next-window))))
                  'split-window-horizontally
                'split-window-vertically)))
        (delete-other-windows)
        (let ((first-win (selected-window)))
          (funcall splitter)
          (if this-win-2nd (other-window 1))
          (set-window-buffer (selected-window) this-win-buffer)
          (set-window-buffer (next-window) next-win-buffer)
          (select-window first-win)
          (if this-win-2nd (other-window 1))))))

(global-set-key [(control c) (|)] 'my-toggle-window-split)
--8<---------------cut here---------------end--------------->8---

in my `.emacs' file (on http://www.mygooglest.com/fni/dot-emacs.html).

FYI, this has been taken from the excellent EmacsWiki:

    http://www.emacswiki.org/emacs/ToggleWindowSplit

Best regards,
  Fabrice

_________________________________________________________________________
Fabrice Niessen
Search the Web with "My Google Search Tools" on http://www.MyGooglest.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nordlöw  
View profile  
 More options Nov 14 2008, 9:42 am
Newsgroups: gnu.emacs.help
From: Nordlöw <per.nord...@gmail.com>
Date: Fri, 14 Nov 2008 06:42:12 -0800 (PST)
Local: Fri, Nov 14 2008 9:42 am
Subject: Re: Toggle between Vertical and Horizontal Windows Splitting
On 14 Nov, 14:54, "Fabrice Niessen" <tdhkhcidi...@spammotel.com>
wrote:

Thanks!

/Nordlöw


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »