Xah Lee has an interesting post on defining keys to open frequently used files (search for
2012-11-21). The idea is that you add lines like
(global-set-key (kbd "<kp-7> <kp-3>") (lambda () "" (interactive) (find-file "~/web/ergoemacs_org/emacs/blog.html")))
for each of the files that you access frequently. That way, you can open the file quickly by pressing just 2 keys.
It's a cute idea but not one I'd use. That's because Lee and I have slightly different Emacs work flows. Lee says he likes to close files when he's finished with them. I, on the other hand, tend to leave files open and occasionally cull files that I'm no longer using. Lee's idea makes sense for him because he is always opening those files. I rarely have to open the files I use all the time because I keep them open—even across Emacs invocations—so I don't really need a super efficient way to open them.
Still, I found the post useful because it reminded me that using the keypad is a way to get access to about 15 unused keys for binding to commands. I've never thought too much about that because I'm almost always on one of my Macs and their keyboards don't have a separate keypad. What they do have is a virtual keypad on the regular keyboard that is accessed by the function key. Thus,
<kp-2> is accessed by pressing 【fn+k】 and that's not much harder than, say, 【Ctrl+k】 other than for a slightly longer reach for the 【fn】 key.
So, there are two takeaways from Lee's post:
- If you have a work flow like Lee's, you might find it useful to add a list of keybindings to open frequently accessed files to your
- Don't forget about the keypad (even if you're on a Mac) as a source of keys suitable for binding to frequently used commands.