diff options
-rw-r--r-- | Emacs/.config/emacs/elisp/search.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Emacs/.config/emacs/elisp/search.el b/Emacs/.config/emacs/elisp/search.el index 6336540..344d92f 100644 --- a/Emacs/.config/emacs/elisp/search.el +++ b/Emacs/.config/emacs/elisp/search.el @@ -55,14 +55,19 @@ Returns a list of files with the directory preprended to them." (if arg (swiper))))) +(defun +search/-format-grep-candidates () + (cl-reduce + #'(lambda (x y) (concat x " " y)) + (mapcar + #'(lambda (x) (concat "\"" x "\"")) + (cl-remove-if #'directory-name-p (+search/get-all-candidates))))) + (defun +search/search-all () (interactive) - (let ((term (read-string "Search for: "))) - (grep (format "grep --color=auto -nH --null -e \"%s\" -- %s" - term - (cl-reduce #'(lambda (x y) (concat x " " y)) - (mapcar #'(lambda (x) (concat "\"" x "\"")) - (cl-remove-if #'directory-name-p (+search/get-all-candidates)))))))) + (let ((format-str "grep --color=auto -nIH --null -e \"%s\" -- %s") + (term (read-string "Search for: ")) + (candidates (+search/-format-grep-candidates))) + (grep (format format-str term candidates)))) (provide 'search) ;;; search.el ends here |