index all rss twitter github linkedin email

Álvaro Ramírez

15 September 2016 Fuzzy search Emacs compile history

I wrote about searching bash history with Emacs Helm some time ago. Since then, I've learned about completing-read to generically handle simple Emacs completions (very handy for supporting Helm, Ivy, and Ido completions).

Here's a simple way to combine completing-read and the compile command to enable fuzzy searching your compile history:

fuzzy_compile.gif

(defun ar/compile-completing ()
  "Compile with completing options."
  (interactive)
  (let ((compile-command (completing-read "Compile command: " compile-history)))
    (compile compile-command)
    (add-to-list 'compile-history compile-command)))