Rushing headlong06 Jan 2015
And you're rushing headlong out of control...
-- Brian May
I've finally wrapped a piece of config that I was using for a while in a package called headlong.
What does it do?
It provides a macro called
headlong-with that modifies minibuffer
completion for the forms within it, making it faster in some
situations. For instance:
(completing-read "Jump to bookmark: "
bookmark-alist nil t))
But more importantly, it provides two commands that can use it
headlong-bookmark-jump-other. The second one is basically the same
as the first one, except it opens the bookmark with
i.e. in other window.
How does this completion work?
It's nothing fancy, you will just exit the minibuffer automatically as soon as there is only one completion candidate left. So it saves you one keystroke, namely RET. How much is one keystroke worth? It depends.
If you arrange your bookmarks in a way that I do, with each one starting with a different letter, it saves you 33% of the total keystrokes. For example, suppose I have:
(global-set-key (kbd "M-p") 'bookmark-jump)
(global-set-key (kbd "M-o") 'headlong-bookmark-jump)
Then I can jump to my bookmarked directory named
"s: sources" with
The second method looks like it's 33% shorter, but it feels like it's even more, since pressing RET is harder than it should be on most keyboards.
Why is this cool?
This is cool because you can implement your bookmarks as efficiently
as you would with just wrapping stuff with a
lambda and using
global-set-key, except that you can view and edit the bindings with
bookmark-bmenu-list, and quickly the update bookmark positions with
Here's what I get when I call M-x
In the list above:
- black bookmarks are files
- blue bookmarks are directories
- pink bookmarks are functions (you need
The package should be available in MELPA soon.