From b4670188449996407f607c794388abb0a2f43aa6 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Tue, 28 Aug 2018 19:37:39 +0900 Subject: [PATCH] Add projectile support --- emacs.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index c8ee947..9d43856 100644 --- a/emacs.el +++ b/emacs.el @@ -1458,7 +1458,8 @@ Commands are searched from ALIST." (defun my-rgrep (command-args) "My recursive grep. Run COMMAND-ARGS. -If prefix argument is given use current symbol as default search target." +If prefix argument is given, use current symbol as default search target +and search from projectile root (if projectile is available)." (interactive (let ((cmd (my-rgrep-grep-command my-rgrep-default nil))) (if cmd @@ -1470,8 +1471,13 @@ If prefix argument is given use current symbol as default search target." 'grep-find-history)) (error "My-Rgrep: Command for rgrep not found") ))) - (compilation-start command-args - 'grep-mode)) + (if (and current-prefix-arg + (safe-require-or-eval 'projectile)) + (projectile-with-default-dir (projectile-project-root) + (compilation-start command-args + 'grep-mode)) + (compilation-start command-args + 'grep-mode))) (defmacro define-my-rgrep (name) "Define rgrep for NAME."