What the .emacs.d!?

I use Phil Hagelbergs' find-file-in-project, but fuzzy matching with LOTS of files can be suboptimal.


;; Function to create new functions that look for a specific pattern
(defun ffip-create-pattern-file-finder (&rest patterns)
  (lexical-let ((patterns patterns))
    (lambda ()
      (interactive)
      (let ((ffip-patterns patterns))
        (find-file-in-project)))))

;; Find file in project, with specific patterns
(global-unset-key (kbd "C-x C-o"))
(global-set-key (kbd "C-x C-o ja")
                (ffip-create-pattern-file-finder "*.java"))
(global-set-key (kbd "C-x C-o js")
                (ffip-create-pattern-file-finder "*.js"))
(global-set-key (kbd "C-x C-o jp")
                (ffip-create-pattern-file-finder "*.jsp"))

This function limits the search to files of a specific file type. I've got loads more of these keybindings, all of them with the two-letter mnemonic shortcut.

It really speeds up finding files. Both because ido-completing-read has less matches to worry about, because there are fewer similarly named files, and especially when the .java, the .js and the .jsp share a name.

blog comments powered by Disqus