I wrote about switching buffers a couple of times. Switching buffers is one of
the things I do a lot when using emacs – switching between e-mail, IRC and
some blog entry. Or simply between a couple of source files in a project.
With some of the tricks mentioned, switching buffers can be made pretty
easy.
However, what about programs that consist of multiple buffers? For example,
my e-mail program (Wanderlust) splits the screen in separate buffers with mail
headers, mail folders and the contents of one message. The same for fancy debugging with gdb, or simply when I have split my screen in two (C-x 2
) to
view two files at the same time. When I then try to switch buffers, only one
of the related buffers will be switched – which is usually not what I want.
I'd like to treat a set of related buffers plus their screen layout as a
logical unit.
There are different ways to do that in emacs. One obvious way is to use
multiple frames (windows). But I prefer to keep everything in one - and I
found the that the easiest solution is elscreen.
Installation is simple; download from here, and follow the instructions in the
package. I've set up some easy key-bindings in my .emacs
:
(load "elscreen" "ElScreen" )
;; F9 creates a new elscreen, shift-F9 kills it
(global-set-key (kbd "<f9>" ) 'elscreen-create)
(global-set-key (kbd "S-<f9>" ) 'elscreen-kill)
;; Windowskey+PgUP/PgDown switches between elscreens
(global-set-key (kbd "<s-prior>") 'elscreen-previous)
(global-set-key (kbd "<s-next>") 'elscreen-next)
Now, whenever I want to switch to a new task, say, read e-mail, I press F9
,
and a new elscreen will appear (it's visible as a sort-of 'tab' at the top of
your screen), and start e-mail there. I can then switch to other elscreens,
and all of them maintain their buffers and window layout. I have found this
very useful. There are some more tricks, and some add-on packages, but this
should give you a good start.
There is one small item on my todo-list. Example: when I push M-x wl
, emacs
automatically switches to the Wanderlust-buffer – or starts it. Now, when
using elscreen, I'd like to automatically switch to the correct screen instead
of switching the current buffer.
No comments:
Post a Comment