From 8aca01d137085a1d5099064483c802c4ac387960 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 31 Jul 2010 02:51:31 -0700 Subject: [PATCH] Cmd-Shift-F to find in project like TextMate --- emacs | 3 +++ emacs.d/textmate.el | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/emacs b/emacs index ec86e42..de8bde4 100644 --- a/emacs +++ b/emacs @@ -376,6 +376,9 @@ ;; can't seem to un-hijack cmd-`, so make it do something useful (global-set-key "\M-`" 'other-window-in-any-frame) +;; find files like textmate +(global-set-key "\M-F" 'textmate-find-in-project) + ;; run the ssa server (global-set-key [(super s)] 'ssa-run-server) diff --git a/emacs.d/textmate.el b/emacs.d/textmate.el index d4aa2d0..0837ade 100644 --- a/emacs.d/textmate.el +++ b/emacs.d/textmate.el @@ -301,6 +301,21 @@ Symbols matching the text at point are put first in the completion list." (setq *textmate-project-files* nil) (message "textmate-mode cache cleared.")) +(defun textmate-find-regex-in-project (regex) + "Search the project for a regular expression and quickly jump +to matches in a project. + +This function just finds the project root and calls `LGREP'." + (interactive "sRegex: ") + (let ((root (textmate-project-root))) + (when (null root) + (error + (concat + "Can't find a suitable project root (" + (string-join " " *textmate-project-roots* ) + ")"))) + (lgrep regex "*" root))) + ;;; Utilities (defun textmate-project-files (root)