diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-06-13 14:18:55 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-06-13 14:18:55 +0100 |
commit | e546a66da017494e460c74a9c7fc750409749851 (patch) | |
tree | 972745a307c2edf1116c63dc94c0a21cea78cf2e | |
parent | adcd05f2b7e25d0a087e08db86d54235e27596a6 (diff) | |
download | dotfiles-e546a66da017494e460c74a9c7fc750409749851.tar.gz dotfiles-e546a66da017494e460c74a9c7fc750409749851.tar.bz2 dotfiles-e546a66da017494e460c74a9c7fc750409749851.zip |
(Emacs/elisp)~search-all cleaned up
-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 |