Mercurial > dotfiles
comparison .elisp/textmate.el @ 473:f86c1048a46d
emacs: hack up my textmate.el some more to add searching config
This gives up and use a bonus grep for extension filtering because I can't
quite make the rg flags work like the grep one, and this gets the job done
with minimal fuss.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 01 Feb 2019 16:25:05 -0500 |
parents | 13c11127a79e |
children |
comparison
equal
deleted
inserted
replaced
472:79110d94a0c2 | 473:f86c1048a46d |
---|---|
154 | 154 |
155 (defvar *textmate-vcs-exclude* nil | 155 (defvar *textmate-vcs-exclude* nil |
156 "string to give to grep -V to exclude some VCS paths from being grepped." | 156 "string to give to grep -V to exclude some VCS paths from being grepped." |
157 ) | 157 ) |
158 | 158 |
159 (defvar *textmate-grep-command* "egrep --color=never -n" "Base grep command.") | |
160 | |
159 (defvar *textmate-find-in-project-default* nil) | 161 (defvar *textmate-find-in-project-default* nil) |
160 | 162 |
161 (defvar *textmate-find-in-project-type-default* nil) | 163 (defvar *textmate-find-in-project-type-default* nil) |
162 | 164 |
163 (defvar *textmate-compile-default* nil) | 165 (defvar *textmate-compile-default* nil) |
278 (format " [\"%s\"]" *textmate-find-in-project-type-default*) | 280 (format " [\"%s\"]" *textmate-find-in-project-type-default*) |
279 "") | 281 "") |
280 ": " | 282 ": " |
281 ) nil nil *textmate-find-in-project-type-default*))) | 283 ) nil nil *textmate-find-in-project-type-default*))) |
282 (setq *textmate-find-in-project-type-default* pat) | 284 (setq *textmate-find-in-project-type-default* pat) |
283 (textmate-find-in-project (concat "*." pat)))) | 285 (textmate-find-in-project (concat ".*\\." pat "$")))) |
284 | 286 |
285 (defun textmate-start-compile-in-root (command &optional mode | 287 (defun textmate-start-compile-in-root (command &optional mode |
286 name-function | 288 name-function |
287 highlight-regexp) | 289 highlight-regexp) |
288 "Idential to compilation-start, except it automatically changes to the | 290 "Idential to compilation-start, except it automatically changes to the |
314 (let* ((default *textmate-find-in-project-default*) | 316 (let* ((default *textmate-find-in-project-default*) |
315 (re (read-string (concat "Search for " | 317 (re (read-string (concat "Search for " |
316 (if (and default (> (length default) 0)) | 318 (if (and default (> (length default) 0)) |
317 (format "[\"%s\"]" default)) ": ") | 319 (format "[\"%s\"]" default)) ": ") |
318 nil 'textmate-find-in-project-history default)) | 320 nil 'textmate-find-in-project-history default)) |
319 (incpat (if pattern pattern "*")) | |
320 (type (textmate-project-root-type (textmate-project-root))) | 321 (type (textmate-project-root-type (textmate-project-root))) |
321 (command | 322 (command |
322 (cond ((not (string= type "unknown")) | 323 (cond ((not (string= type "unknown")) |
323 (concat (cond ((string= type "git") "git ls-files") | 324 (concat (cond ((string= type "git") "git ls-files") |
324 ((string= type "hg") "hg locate 'set:added() or modified() or clean()'")) | 325 ((string= type "hg") "hg locate 'set:added() or modified() or clean()'")) |
325 (if *textmate-vcs-exclude* | 326 (if *textmate-vcs-exclude* |
326 (concat " | egrep --color=never -v " | 327 (concat " | egrep --color=never -v " |
327 (shell-quote-argument *textmate-vcs-exclude*)) | 328 (shell-quote-argument *textmate-vcs-exclude*)) |
328 "") | 329 "") |
329 " | xargs egrep --color=never -n " | 330 (if pattern (concat " | egrep '" pattern "' ")) |
330 (if pattern (concat " --include='" pattern "' ") "") | 331 " | xargs " *textmate-grep-command* " " |
331 " -- " | 332 " -- " |
332 (shell-quote-argument re))) | 333 (shell-quote-argument re))) |
333 (t (concat "egrep --color=never -nR --exclude='" | 334 (t (concat "egrep --color=never -nR --exclude='" |
334 *textmate-gf-exclude* | 335 *textmate-gf-exclude* |
335 "' --include='" | 336 "' --include='" |