sábado, 2 de julio de 2011

Resize window in emacs

I use emacs as much as I can. That's not really news, is it?

One of my use cases for emacs is chatting with friends. I use erc for IRC, and emacs-jabber for everything else.

One thing that annoys me a bit is that when my screen is split in two and want to shrink a bit one of the two windows.

There's c-x - (shrink-window-if-larger-than-buffer) but it's only useful for a handful of situations (IMHO)

Here is a little function I wrote to shrink a window to selected region. I find it useful to narrow windows to functions, paragraphs, or just narrowing a chat window to just 5 or 10 lines.

Select a region, and run it. Then c-l to recenter accordingly.

I mainly use it as a more visual narrow-to region.

Have fun