updated textmate-find-regex-in-project (still sucks though)

need to create a mode based on grep-mode that doesn't suck
This commit is contained in:
Sami Samhuri 2010-08-29 18:40:40 -07:00
parent d78d5b6a82
commit f9d94b45fc

View file

@ -301,11 +301,15 @@ Symbols matching the text at point are put first in the completion list."
(setq *textmate-project-files* nil) (setq *textmate-project-files* nil)
(message "textmate-mode cache cleared.")) (message "textmate-mode cache cleared."))
;; FIXME:
;; - use *textmate-gf-exclude* instead of hard-coding ignored paths
;; - format results nicely (like TextMate)
(defun textmate-find-regex-in-project (regex) (defun textmate-find-regex-in-project (regex)
"Search the project for a regular expression and quickly jump "Search the project for a regular expression and quickly jump
to matches in a project. to matches in a project.
This function just finds the project root and calls `LGREP'." This function just finds the project root and calls `RGREP'."
(interactive "sRegex: ") (interactive "sRegex: ")
(let ((root (textmate-project-root))) (let ((root (textmate-project-root)))
(when (null root) (when (null root)
@ -314,7 +318,7 @@ This function just finds the project root and calls `LGREP'."
"Can't find a suitable project root (" "Can't find a suitable project root ("
(string-join " " *textmate-project-roots*) (string-join " " *textmate-project-roots*)
")"))) ")")))
(lgrep regex "*" root))) (grep (concat "grep -Hn -E '" regex "' " root "/**/{*.j,*.js,*akefile,*.sh}(N) | grep -vE '/([Bb]uild|Frameworks|.git)/?' | sed -e 's#" root "/##'"))))
;;; Utilities ;;; Utilities