Frame Peek

As part of his Emacs mini manual series, tuhdo introduces an interesting idea for quickly looking at, say, a function definition. There are lots of ways of doing that, of course, and tuhdo isn’t advocating any particular one or eve a new one. Rather, you can think of his suggestion as providing a framework for quick-look systems.

To understand what that means, you first have to understand what tuhdo sees as the problem with the way current systems work. Some of them pop up a little subwindow with the required definition but the space is delimited and there’s probably no font locking or other amenities that we’re used to having with buffers. Others open a new buffer either in the same or another window. That can also be annoying even if it opens the new buffer in a different window because that window may also hold useful information that you want to see. Finally, a long string of nested such lookups can mean that you lose your place and have to search for your original buffer.

Tuhdo’s idea is to pop up a new frame positioned right under the symbol at point, use whatever quick-look mechanism you prefer—his demo uses the rtags-find-symbol-at-point function—and display that definition in a buffer in the new frame. That means the “popup” has all the capabilities of a normal buffer and it’s easy to nest calls without losing your way. You merely delete the frames to unwind the calls in a natural way.

Take a look his demo at the link. It makes all this clear and shows how natural and easy it is to use. It doesn’t take much code to do this. Tuhdo shows the code for using rtags, which you can just cut and paste into your init.el. If you use some other system, it should be easy to adapt.

This entry was posted in General and tagged . Bookmark the permalink.
  • NoonianAtall

    Helm's "persistent" feature deserves to be mentioned here. I use it constantly, and it solves this problem for me. For example, to view the contents of a variable, I do "C-h v", which opens Helm to the list of variables, I find the variable by typing in parts of its name, and then display the describe-variable for it by pressing C-j. When I'm done, I press C-g to close that buffer, or I can keep it visible by pressing RET.

    • jcs

      I don't use Helm (mostly because I stumbled into Avy/Swiper/Console and never left) but that sounds very nice.