home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!convex!darwin.sura.net!tulane!uflorida!travis.csd.harris.com!travis!jimbo
- From: jimbo@rcx1.ssd.csd.harris.com (Jim Winters)
- Newsgroups: gnu.emacs.help
- Subject: Re: cycling window positions
- Message-ID: <JIMBO.92Nov17134130@rcx1.ssd.csd.harris.com>
- Date: 17 Nov 92 18:41:30 GMT
- References: <LYNN.92Nov16082256@ives.urbana.mcd.mot.com>
- Distribution: gnu
- Organization: Harris Computer Systems Division
- Lines: 54
- NNTP-Posting-Host: rcx1.ssd.csd.harris.com
- In-reply-to: lynn@urbana.mcd.mot.com's message of Mon, 16 Nov 1992 13:22:56 GMT
-
- Lynn> Has anybody out there already written a function that is able to cycle
- Lynn> the position of windows in the following way? I'll use 3 windows for
- Lynn> example. I have:
-
- Lynn> And so forth, so that the contents of the second window is now in the
- Lynn> top window, the third is now second, and the top is shoved down to the
- Lynn> bottom. I'd like this to be able to work however many windows I've
- Lynn> got. Of course I'd also like to be a numeric argument, including
- Lynn> negative, to be able to cycle some number of positions.
-
- Your lucky day! :-)
-
- (But what I'd really like is to be able to put a window somewhere and
- have it STAY THERE. :-)
-
- ;;
- ;; transpose-windows
- ;;
- (defun transpose-windows (arg)
- "Move buffer displayed in the selected window to the ARG'th window.
- The other buffers slide down to make room."
- (interactive "p")
- (if (or
- (one-window-p t) ;; If there's only one window, or
- (equal (minibuffer-window) (selected-window)) ;; m.b. is selected
- )
- nil ;; then do nothing
- (let ((fun (if (> arg 0) 'next-window 'previous-window))
- )
- (while (/= arg 0)
- (let* ((this-win (selected-window))
- (oth-win (funcall fun (selected-window)))
- (this-buf (window-buffer this-win))
- (oth-buf (window-buffer oth-win))
- )
- (set-window-buffer this-win (buffer-name oth-buf))
- (set-window-buffer oth-win (buffer-name this-buf))
- (select-window oth-win)
- )
- (if (< arg 0)
- (setq arg (1+ arg))
- (setq arg (1- arg))
- )
- )
- )
- )
- )
-
- (define-key ctl-x-map "T" 'transpose-windows)
- --
-
- --
- Jim Winters jimbo@ssd.csd.harris.com
- ]O See through science part of a backdoor. A door made up of doors...
-