____________
| |
| |
| |
|===========|
|-------------------|
I want to be able to just swap the top and bottom buffer, while keeping
the screen layout the same. Does anyone know if this is possible?
Window configurations record which buffer is displayed in each window,
so I think you need to explicitly save each configuration. See the
Saving Window Configurations in Registers node of the Emacs manual,
which also describes how to restore a saved configuration.
--
Kevin Rodgers
C-x b RET
C-x o
C-x b RET
C-x o
C-x b RET
Does that do what you want?
The parent poster's solution does that, at least when I try. The
*window* sizes are the same.
This is my result:
Before:
+----------------+
| |
| Buf A |
| |
|----------------|
| Buf B |
+----------------+
+----------------+
| |
| Buf B |
| |
|----------------|
| Buf A |
+----------------+
Was this what you wanted:
+----------------+
| Buf A |
|----------------|
| |
| |
| Buf B |
+----------------+
?
Did you actually mean to say that you have two windows, top and
bottom, which you want to remain the same size while the buffers
being display in each is changed? For example, the top window is
always larger no matter which buffer is being display.
Here is a function which more or less does that, and works in
both Emacs and XEmacs. (It isn't well tested and may have a
surprise or two...) If there are three buffers displayed, it
flips between the current buffer and the one below it, or the
top buffer if the bottom buffer is current.
I've added comments to indicate what it is doing.
(defun fld-flip-buffers ()
"Flip buffers between two windows."
(interactive)
(if (not(one-window-p 't)) ; do nothing for only 1 window
(let ((w1 (selected-window)) ; save current window
(w2 (next-window)) ; save "next window"
(b1 (current-buffer))) ; save current buffer
(select-window w2) ; switch to "next window"
(set-window-buffer w1
(current-buffer)) ; display that buf in this window
(set-window-buffer w2 b1) ; display this buf in that window
(select-window w1)))) ; switch back to that window
Put that into your init file and bind it to some convenient key sequence.
For example, this binds it to the F5 function key:
(define-key global-map [f5] 'fld-flip-buffers)
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com