2015-03-28 window-configuration-to-register

Most often I work on a netbook with a small screen. In such a situation every line is precious. That’s why I eliminated most of unnecessary things like menu or toolbar from my Emacs. Still, sometimes I’m studying a function whose text barely fits in the limited room I have. I often use C-u something C-l so that I can fit exactly what I want onto the screen. What was quite annoying for me was the fact that if I need to move somewhere else in the buffer, I lose the precise location of point (both with respect to the buffer and with respect to the window) – of course, I can use the mark ring to come back to the same place, but it is then usually displayed in another physical location on the display.

It turned out that the solution was simple (and even built-in!). One of the things that can be saved in a register is a “window configuration”. The manual does not say precisely what that means, but window configurations store (among others) both the location of point and the exact position of it in the displayed window.

Hence, I can now just position everything exactly where I want, press C-x r w and choose the register, and then – after I go somewhere else in the buffer – come back with C-x r j. (I can imagine more uses for that, too!) How handy!

CategoryEnglish, CategoryBlog, CategoryEmacs