From 0a7221798baa7252b9a0ceba07b4618e99d40cc4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 17 Jun 2019 15:01:00 +0200 Subject: [PATCH] Start file searchs from basic sh/dash shell Uses the most basic, uncustomized shell to a) prevent interference caused by slow shell configs and b) speed up project text searches. This comes at the cost of isolating these programs from envvars that the user may have set in their shell configs in order to change ag/rg/pt/git-grep/grep's behavior. If this bothers you, change +ivy-file-search-shell to your shell (or to the value of `shell-file-name`). Possibly relevant to an issue mentioned in #1260 --- modules/completion/ivy/autoload/ivy.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index dca6d7542..707dea79d 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -307,6 +307,20 @@ The point of this is to avoid Emacs locking up indexing massive file trees." (#'counsel-file-jump)))) +(defvar +ivy-file-search-shell + (or (executable-find "dash") + (executable-find "sh") + shell-file-name) + "The SHELL to invoke ag/rg/pt/git-grep/grep searchs from. + +This only affects `+ivy/*' search commands (e.g. `+ivy/rg' and +`+ivy/project-search'). + +By default, this the most basic, uncustomized shell, to prevent interference +caused by slow shell configs at the cost of isolating these programs from +envvars that may have been set in the user's shell config to change their +behavior. If this bothers you, change this to `shell-file-name'.") + ;;;###autoload (cl-defun +ivy-file-search (engine &key query in all-files (recursive t)) "Conduct a file search using ENGINE, which can be any of: rg, ag, pt, and @@ -359,7 +373,8 @@ order. ((file-relative-name directory project-root)))))) (require 'counsel) (let ((ivy-more-chars-alist - (if query '((t . 1)) ivy-more-chars-alist))) + (if query '((t . 1)) ivy-more-chars-alist)) + (shell-file-name +ivy-file-search-shell)) (pcase engine (`grep (let ((counsel-projectile-grep-initial-input query))