unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* swaping buffers
@ 2006-03-16 19:09 dydimustk
  2006-03-16 21:35 ` Kevin Rodgers
       [not found] ` <mailman.147.1142545046.9686.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: dydimustk @ 2006-03-16 19:09 UTC (permalink / raw)


I want to be able to quickly swap between the two open buffers I am
working on, while keeping the screen dimensions. I usually keep a
little buffer open at the bottom of the screen with erc running, and
I'm working in the top part.

____________
|                          |
|                          |
|                          |
|===========|
|-------------------|

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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: swaping buffers
  2006-03-16 19:09 swaping buffers dydimustk
@ 2006-03-16 21:35 ` Kevin Rodgers
       [not found] ` <mailman.147.1142545046.9686.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2006-03-16 21:35 UTC (permalink / raw)


dydimustk wrote:
> I want to be able to quickly swap between the two open buffers I am
> working on, while keeping the screen dimensions. I usually keep a
> little buffer open at the bottom of the screen with erc running, and
> I'm working in the top part.
> 
> ____________
> |                          |
> |                          |
> |                          |
> |===========|
> |-------------------|
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: swaping buffers
       [not found] ` <mailman.147.1142545046.9686.help-gnu-emacs@gnu.org>
@ 2006-03-16 22:45   ` pookiebearbottom
  2006-03-17  7:12     ` dydimustk
  0 siblings, 1 reply; 6+ messages in thread
From: pookiebearbottom @ 2006-03-16 22:45 UTC (permalink / raw)


How about recording a little macro

C-x b RET
C-x o
C-x b RET
C-x o
C-x b RET

Does that do what you want?

Kevin Rodgers wrote:
> dydimustk wrote:
> > I want to be able to quickly swap between the two open buffers I am
> > working on, while keeping the screen dimensions. I usually keep a
> > little buffer open at the bottom of the screen with erc running, and
> > I'm working in the top part.
> >
> > ____________
> > |                          |
> > |                          |
> > |                          |
> > |===========|
> > |-------------------|
> >
> > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: swaping buffers
  2006-03-16 22:45   ` pookiebearbottom
@ 2006-03-17  7:12     ` dydimustk
  2006-03-17 11:05       ` Mathias Dahl
  2006-03-17 12:32       ` Floyd L. Davidson
  0 siblings, 2 replies; 6+ messages in thread
From: dydimustk @ 2006-03-17  7:12 UTC (permalink / raw)


It doesn't quite do what I want.
I'm using different buffers in top half than I am in the bottom half.
And I want to specifically swap out the top and bottom half without
losing the buffer sizes.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: swaping buffers
  2006-03-17  7:12     ` dydimustk
@ 2006-03-17 11:05       ` Mathias Dahl
  2006-03-17 12:32       ` Floyd L. Davidson
  1 sibling, 0 replies; 6+ messages in thread
From: Mathias Dahl @ 2006-03-17 11:05 UTC (permalink / raw)


"dydimustk" <dydimustk@gmail.com> writes:

> It doesn't quite do what I want.
> I'm using different buffers in top half than I am in the bottom half.
> And I want to specifically swap out the top and bottom half without
> losing the buffer sizes.

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        |
+----------------+

?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: swaping buffers
  2006-03-17  7:12     ` dydimustk
  2006-03-17 11:05       ` Mathias Dahl
@ 2006-03-17 12:32       ` Floyd L. Davidson
  1 sibling, 0 replies; 6+ messages in thread
From: Floyd L. Davidson @ 2006-03-17 12:32 UTC (permalink / raw)


"dydimustk" <dydimustk@gmail.com> wrote:
>It doesn't quite do what I want.
>I'm using different buffers in top half than I am in the bottom half.
>And I want to specifically swap out the top and bottom half without
>losing the buffer sizes.

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)                         floyd@apaflo.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-17 12:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-16 19:09 swaping buffers dydimustk
2006-03-16 21:35 ` Kevin Rodgers
     [not found] ` <mailman.147.1142545046.9686.help-gnu-emacs@gnu.org>
2006-03-16 22:45   ` pookiebearbottom
2006-03-17  7:12     ` dydimustk
2006-03-17 11:05       ` Mathias Dahl
2006-03-17 12:32       ` Floyd L. Davidson

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).