emacs - how to make find-file search in subdirectories

Although you might not want to keep lots of buffers open, you can hook IDO into recentf, which tracks recently-opened files:

(recentf-mode 1)
(setq recentf-max-saved-items 300)

(defun ido-choose-from-recentf ()
  "Use ido to select a recently opened file from the `recentf-list'"
  (interactive)
  (find-file (ido-completing-read "Open file: " recentf-list nil t)))

(global-set-key [(meta f11)] 'ido-choose-from-recentf)

I've been using this trick for years, and it's 99% of all the file-switching I need.

Beyond that, I use M-x rgrep, and you might also like to look at M-x find-dired and M-x find-grep-dired.

For more options still, check out the answers to this similar question.


Have you tried helm yet? You can easily choose to search files, buffers, commands, and a lot of other things.


Projectile has a function named projectile-jump-to-project-file that does more or less what you want. There is also find-file-in-project - a simpler utility, but dependent on the presence of GNU find.

Tags:

Emacs

Icicles