~/Emacs

Let’s kick this blog off with a simple yet handy isearch hack that I’m pretty sure I originally lifted from prot’s Emacs configuration:

(defun my/isearch-fuzzy-forward (&optional regexp-p)
  "Fuzzy version of `isearch-forward'."
  (interactive "P")
  (let ((search-whitespace-regexp ".*?"))
    (isearch-forward regexp-p)))

(defun my/isearch-fuzzy-backward (&optional regexp-p)
  "Fuzzy version of `isearch-backward'."
  (interactive "P")
  (let ((search-whitespace-regexp ".*?"))
    (isearch-backward regexp-p)))

The idea is simple: set search-whitespace-regexp such that any sequence of characters can count as whitespace. This means as long as the individual search terms in your query are found on the same line, it doesn’t matter what’s between them.

Read more...