2026-03-02 Lispy and Iedit

A bit over a decade ago (!) I wrote about Iedit. It’s a very cool package, a bit similar to multiple cursors, very convenient for changing variable names (especially that it has a great feature where the change is restricted to the current function).

I am also a Lispy user. Lispy requires Iedit (and has a binding for it different from the default one – M-i – while Iedit’s default I’m used to is C-;). The problem is, when I added Lispy to my Emacs, it disabled the default C-; (and only installed M-i in Elisp buffers).

Now, I admit that M-i may be a better (or at least not worse) keybinding for Iedit than C-;. It’s default binding is tab-to-tab-stop, which is one of those useless commands Emacs has had probably for decades. Personally, I’m accustomed to C-;, so I wanted Lispy not to interfere with Iedit setting that keybinding.

It turns out that all I had to do was to make sure that Iedit is loaded before Lispy. I think the reason is that Lispy says

(setq iedit-toggle-key-default nil)

and Iedit says

(defcustom iedit-toggle-key-default (kbd "C-;")
  ; ...
  )

and defcustom only sets the value when not already set. So, if you want both Iedit in non-ELisp buffers and Lispy, just use your favorite package manager to make sure that Lispy is loaded after Iedit and you’re done! And if you want M-i to be the Iedit entry point instead of C-; in all buffers, just make sure that

(keymap-global-unset "M-i")
(setq iedit-toggle-key-default (kbd "M-i"))

is evaluated before loading Iedit. (The unsetting is needed because Iedit won’t let you use a keybinding which is already taken by another command.)

That’s it for today, and if you don’t use Iedit (or Lispy), definitely check those packages out – they are both really great!

CategoryEnglish, CategoryBlog, CategoryEmacs