Remove the_platinum_searcher support

I'm reducing the scope of our project search so we can eventually focus
on ripgrep. By specializing I can extend Doom's features for project
searching.
This commit is contained in:
Henrik Lissner 2019-10-10 22:02:18 -04:00
parent 7654764713
commit 6ba7c97501
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
9 changed files with 9 additions and 65 deletions

View file

@ -4,12 +4,6 @@
;; ;;
;; Project searching ;; Project searching
;;;###autoload (autoload '+helm:pt "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:pt (all-files-p query)
"Ex interface for `+helm/pt'"
(interactive "<!><a>")
(+helm/pt all-files-p query))
;;;###autoload (autoload '+helm:grep "completion/helm/autoload/evil" nil t) ;;;###autoload (autoload '+helm:grep "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:grep (all-files-p query) (evil-define-command +helm:grep (all-files-p query)
"Ex interface for `+helm/grep'" "Ex interface for `+helm/grep'"
@ -29,12 +23,6 @@
(+helm/rg all-files-p query)) (+helm/rg all-files-p query))
;;;###autoload (autoload '+helm:pt-from-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:pt-from-cwd (query &optional recurse-p)
"Ex interface for `+helm/pt-from-cwd'."
(interactive "<a><!>")
(+helm/pt-from-cwd (not recurse-p) query))
;;;###autoload (autoload '+helm:grep-from-cwd "completion/helm/autoload/evil" nil t) ;;;###autoload (autoload '+helm:grep-from-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:grep-from-cwd (query &optional recurse-p) (evil-define-command +helm:grep-from-cwd (query &optional recurse-p)
"Ex interface for `+helm/grep-from-cwd'." "Ex interface for `+helm/grep-from-cwd'."

View file

@ -55,12 +55,6 @@ workspace."
(when all-files-p "-z -uu") (when all-files-p "-z -uu")
(unless recursive-p "--maxdepth 1"))) (unless recursive-p "--maxdepth 1")))
(defun +helm-pt-search-args (all-files-p recursive-p)
(list "pt --nocolor --nogroup -e"
"-S"
(if all-files-p "-z -a")
(unless recursive-p "--depth 1")))
;; ;;
(defun +helm--grep-source () (defun +helm--grep-source ()
(require 'helm-projectile) (require 'helm-projectile)
@ -133,7 +127,7 @@ order.
(and (or (executable-find "grep") (and (or (executable-find "grep")
(executable-find "git")) (executable-find "git"))
'grep) 'grep)
(user-error "No search engine specified (is ag, rg, pt or git installed?)"))) (user-error "No search engine specified (is ag, rg, or git installed?)")))
(query (or query (query (or query
(when (use-region-p) (when (use-region-p)
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning))) (let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
@ -152,7 +146,6 @@ order.
(pcase engine (pcase engine
(`ag (+helm-ag-search-args all-files recursive)) (`ag (+helm-ag-search-args all-files recursive))
(`rg (+helm-rg-search-args all-files recursive)) (`rg (+helm-rg-search-args all-files recursive))
(`pt (+helm-pt-search-args all-files recursive))
('grep (+helm--grep-search directory query prompt all-files recursive) ('grep (+helm--grep-search directory query prompt all-files recursive)
(cl-return t)))) (cl-return t))))
(helm-ag-base-command (string-join command " "))) (helm-ag-base-command (string-join command " ")))
@ -208,8 +201,6 @@ ARG (universal argument), include all files, even hidden or compressed ones."
;;;###autoload (autoload '+helm/rg-from-cwd "completion/helm/autoload/helm" nil t) ;;;###autoload (autoload '+helm/rg-from-cwd "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/ag "completion/helm/autoload/helm" nil t) ;;;###autoload (autoload '+helm/ag "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/ag-from-cwd "completion/helm/autoload/helm" nil t) ;;;###autoload (autoload '+helm/ag-from-cwd "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/pt "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/pt-from-cwd "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/grep "completion/helm/autoload/helm" nil t) ;;;###autoload (autoload '+helm/grep "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/grep-from-cwd "completion/helm/autoload/helm" nil t) ;;;###autoload (autoload '+helm/grep-from-cwd "completion/helm/autoload/helm" nil t)

View file

@ -1,6 +1,6 @@
;;; completion/helm/config.el -*- lexical-binding: t; -*- ;;; completion/helm/config.el -*- lexical-binding: t; -*-
(defvar +helm-project-search-engines '(rg ag pt) (defvar +helm-project-search-engines '(rg ag)
"What search tools for `+helm/project-search' (and `+helm-file-search' when no "What search tools for `+helm/project-search' (and `+helm-file-search' when no
ENGINE is specified) to try, and in what order. ENGINE is specified) to try, and in what order.

View file

@ -29,7 +29,7 @@
* Description * Description
This module provides Ivy integration for a variety of Emacs commands, as well as This module provides Ivy integration for a variety of Emacs commands, as well as
a unified interface for project search and replace, powered by ag, rg, pt, a unified interface for project search and replace, powered by ag, rg,
git-grep & grep (whichever is available). git-grep & grep (whichever is available).
#+begin_quote #+begin_quote
@ -71,7 +71,6 @@ This module optionally depends on one of:
+ [[https://github.com/BurntSushi/ripgrep][ripgrep]] (rg) + [[https://github.com/BurntSushi/ripgrep][ripgrep]] (rg)
+ [[https://github.com/ggreer/the_silver_searcher][the_silver_searcher]] (ag) + [[https://github.com/ggreer/the_silver_searcher][the_silver_searcher]] (ag)
+ [[https://github.com/monochromegane/the_platinum_searcher][the_platinum_searcher]] (pt)
Ripgrep is recommended, but the order of its results aren't deterministic and it Ripgrep is recommended, but the order of its results aren't deterministic and it
doesn't support full PCRE (at the time of writing). The_silver_searcher is a doesn't support full PCRE (at the time of writing). The_silver_searcher is a
@ -114,7 +113,7 @@ https://assets.doomemacs.org/completion/ivy/projectile.png
** Project search & replace ** Project search & replace
This module provides interactive text search and replace using the first search This module provides interactive text search and replace using the first search
program available on your system (rg, ag, pt, git-grep or grep). program available on your system (rg, ag, git-grep or grep).
| Keybind | Description | | Keybind | Description |
|-----------+---------------------------------| |-----------+---------------------------------|
@ -136,7 +135,6 @@ current directory (recursively), respectively:
+ ~+ivy/ag~ / ~+ivy/ag-from-cwd~ + ~+ivy/ag~ / ~+ivy/ag-from-cwd~
+ ~+ivy/rg~ / ~+ivy/rg-from-cwd~ + ~+ivy/rg~ / ~+ivy/rg-from-cwd~
+ ~+ivy/pt~ / ~+ivy/pt-from-cwd~
+ ~+ivy/grep~ / ~+ivy/grep-from-cwd~ + ~+ivy/grep~ / ~+ivy/grep-from-cwd~
The universal argument (=SPC u= for evil users; =C-u= otherwise) changes the The universal argument (=SPC u= for evil users; =C-u= otherwise) changes the
@ -149,11 +147,9 @@ This module also provides Ex Commands for evil users:
|-----------------------+------------------------------------------------| |-----------------------+------------------------------------------------|
| ~:ag[!] [QUERY]~ | Search project w/ ag[fn:1] | | ~:ag[!] [QUERY]~ | Search project w/ ag[fn:1] |
| ~:rg[!] [QUERY]~ | Search project w/ rg[fn:1] | | ~:rg[!] [QUERY]~ | Search project w/ rg[fn:1] |
| ~:pt[!] [QUERY]~ | Search project w/ pt[fn:1] |
| ~:grep[!] [QUERY]~ | Search project w/ git-grep/grep[fn:1] | | ~:grep[!] [QUERY]~ | Search project w/ git-grep/grep[fn:1] |
| ~:agcwd[!] [QUERY]~ | Search this directory w/ the_silver_searcher | | ~:agcwd[!] [QUERY]~ | Search this directory w/ the_silver_searcher |
| ~:rgcwd[!] [QUERY]~ | Search this directory w/ ripgrep | | ~:rgcwd[!] [QUERY]~ | Search this directory w/ ripgrep |
| ~:ptcwd[!] [QUERY]~ | Search this directory w/ the_platinum_searcher |
| ~:grepcwd[!] [QUERY]~ | Search this directory w/ git-grep/grep | | ~:grepcwd[!] [QUERY]~ | Search this directory w/ git-grep/grep |
The optional BANG functions is equivalent to the universal argument for the The optional BANG functions is equivalent to the universal argument for the

View file

@ -17,12 +17,6 @@
;; ;;
;; Project searching ;; Project searching
;;;###autoload (autoload '+ivy:pt "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:pt (all-files-p query)
"Ex interface for `+ivy/pt'"
(interactive "<!><a>")
(+ivy/pt all-files-p query))
;;;###autoload (autoload '+ivy:grep "completion/ivy/autoload/evil" nil t) ;;;###autoload (autoload '+ivy:grep "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:grep (all-files-p query) (evil-define-command +ivy:grep (all-files-p query)
"Ex interface for `+ivy/grep'" "Ex interface for `+ivy/grep'"
@ -42,12 +36,6 @@
(+ivy/rg all-files-p query)) (+ivy/rg all-files-p query))
;;;###autoload (autoload '+ivy:pt-from-cwd "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:pt-from-cwd (query &optional recurse-p)
"Ex interface for `+ivy/pt-from-cwd'."
(interactive "<a><!>")
(+ivy/pt-from-cwd (not recurse-p) query))
;;;###autoload (autoload '+ivy:grep-from-cwd "completion/ivy/autoload/evil" nil t) ;;;###autoload (autoload '+ivy:grep-from-cwd "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:grep-from-cwd (query &optional recurse-p) (evil-define-command +ivy:grep-from-cwd (query &optional recurse-p)
"Ex interface for `+ivy/grep-from-cwd'." "Ex interface for `+ivy/grep-from-cwd'."

View file

@ -399,20 +399,13 @@ order.
(counsel-projectile-grep)) (counsel-projectile-grep))
(counsel-projectile-grep))))) (counsel-projectile-grep)))))
(`ag (`ag
(let ((args (concat (if all-files " -a") (let ((args (concat " -S" (if all-files " -a")
(unless recursive " --depth 1")))) (unless recursive " --depth 1"))))
(counsel-ag query directory args (format prompt args)))) (counsel-ag query directory args (format prompt args))))
(`rg (`rg
(let ((args (concat (if all-files " -uu") (let ((args (concat " -S" (if all-files " -uu")
(unless recursive " --maxdepth 1")))) (unless recursive " --maxdepth 1"))))
(counsel-rg query directory args (format prompt args)))) (counsel-rg query directory args (format prompt args))))
(`pt
(let ((counsel-pt-base-command
(concat counsel-pt-base-command
(if all-files " -U")
(unless recursive " --depth=1")))
(default-directory directory))
(counsel-pt query)))
(_ (error "No search engine specified")))))) (_ (error "No search engine specified"))))))
(defun +ivy--get-command (format) (defun +ivy--get-command (format)
@ -451,8 +444,6 @@ ARG (universal argument), include all files, even hidden or compressed ones."
;;;###autoload (autoload '+ivy/rg-from-cwd "completion/ivy/autoload/ivy" nil t) ;;;###autoload (autoload '+ivy/rg-from-cwd "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/ag "completion/ivy/autoload/ivy" nil t) ;;;###autoload (autoload '+ivy/ag "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/ag-from-cwd "completion/ivy/autoload/ivy" nil t) ;;;###autoload (autoload '+ivy/ag-from-cwd "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/pt "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/pt-from-cwd "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/grep "completion/ivy/autoload/ivy" nil t) ;;;###autoload (autoload '+ivy/grep "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/grep-from-cwd "completion/ivy/autoload/ivy" nil t) ;;;###autoload (autoload '+ivy/grep-from-cwd "completion/ivy/autoload/ivy" nil t)

View file

@ -13,7 +13,7 @@ When 'everything, also preview virtual buffers")
"An alist of tags for `+ivy/tasks' to include in its search, whose CDR is the "An alist of tags for `+ivy/tasks' to include in its search, whose CDR is the
face to render it with.") face to render it with.")
(defvar +ivy-project-search-engines '(rg ag pt) (defvar +ivy-project-search-engines '(rg ag)
"What search tools for `+ivy/project-search' (and `+ivy-file-search' when no "What search tools for `+ivy/project-search' (and `+ivy-file-search' when no
ENGINE is specified) to try, and in what order. ENGINE is specified) to try, and in what order.
@ -230,11 +230,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(setq counsel-locate-cmd #'counsel-locate-cmd-mdfind)) (setq counsel-locate-cmd #'counsel-locate-cmd-mdfind))
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)" (setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)"
counsel-describe-function-function #'helpful-callable counsel-describe-function-function #'helpful-callable
counsel-describe-variable-function #'helpful-variable counsel-describe-variable-function #'helpful-variable)
;; Add smart-casing (-S) to default command arguments:
counsel-rg-base-command "rg -S --no-heading --line-number --color never %s ."
counsel-ag-base-command "ag -S --nocolor --nogroup %s"
counsel-pt-base-command "pt -S --nocolor --nogroup -e %s")
(add-to-list 'swiper-font-lock-exclude #'+doom-dashboard-mode nil #'eq) (add-to-list 'swiper-font-lock-exclude #'+doom-dashboard-mode nil #'eq)
@ -273,7 +269,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(with-ivy-window (insert (format "[[%s]]" path)))) "insert org-link (abs. path)"))) (with-ivy-window (insert (format "[[%s]]" path)))) "insert org-link (abs. path)")))
(ivy-add-actions (ivy-add-actions
'counsel-ag ; also applies to `counsel-rg' & `counsel-pt' 'counsel-ag ; also applies to `counsel-rg'
'(("O" +ivy-git-grep-other-window-action "open in other window")))) '(("O" +ivy-git-grep-other-window-action "open in other window"))))

View file

@ -61,8 +61,6 @@
(evil-ex-define-cmd "agc[wd]" #'+ivy:ag-from-cwd) (evil-ex-define-cmd "agc[wd]" #'+ivy:ag-from-cwd)
(evil-ex-define-cmd "rg" #'+ivy:rg) (evil-ex-define-cmd "rg" #'+ivy:rg)
(evil-ex-define-cmd "rgc[wd]" #'+ivy:rg-from-cwd) (evil-ex-define-cmd "rgc[wd]" #'+ivy:rg-from-cwd)
(evil-ex-define-cmd "pt" #'+ivy:pt)
(evil-ex-define-cmd "ptc[wd]" #'+ivy:pt-from-cwd)
(evil-ex-define-cmd "grep" #'+ivy:grep) (evil-ex-define-cmd "grep" #'+ivy:grep)
(evil-ex-define-cmd "grepc[wd]" #'+ivy:grep-from-cwd) (evil-ex-define-cmd "grepc[wd]" #'+ivy:grep-from-cwd)
(evil-ex-define-cmd "sw[iper]" #'+ivy:swiper) (evil-ex-define-cmd "sw[iper]" #'+ivy:swiper)
@ -73,8 +71,6 @@
(evil-ex-define-cmd "agc[wd]" #'+helm:ag-from-cwd) (evil-ex-define-cmd "agc[wd]" #'+helm:ag-from-cwd)
(evil-ex-define-cmd "rg" #'+helm:rg) (evil-ex-define-cmd "rg" #'+helm:rg)
(evil-ex-define-cmd "rgc[wd]" #'+helm:rg-from-cwd) (evil-ex-define-cmd "rgc[wd]" #'+helm:rg-from-cwd)
(evil-ex-define-cmd "pt" #'+helm:pt)
(evil-ex-define-cmd "ptc[wd]" #'+helm:pt-from-cwd)
(evil-ex-define-cmd "grep" #'+helm:grep) (evil-ex-define-cmd "grep" #'+helm:grep)
(evil-ex-define-cmd "grepc[wd]" #'+helm:grep-from-cwd) (evil-ex-define-cmd "grepc[wd]" #'+helm:grep-from-cwd)
;; (evil-ex-define-cmd "todo" #'+helm:todo) TODO implement `+helm:todo' ;; (evil-ex-define-cmd "todo" #'+helm:todo) TODO implement `+helm:todo'

View file

@ -122,8 +122,6 @@ And these are text objects added by this module:
| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH | | ~:mv[!] NEWPATH~ | Move the current file to NEWPATH |
| ~:na[rrow]~ | Narrow the buffer to the selection | | ~:na[rrow]~ | Narrow the buffer to the selection |
| ~:pad~ | Open a scratch pad for running code quickly | | ~:pad~ | Open a scratch pad for running code quickly |
| ~:pt[!]~ | Perform a project search with pt |
| ~:ptcwd[!]~ | Perform a project search with pt from the current directory |
| ~:ral[ign][!] REGEXP~ | Right-Align text that matches REGEXP. If BANG, align all matches on each line | | ~:ral[ign][!] REGEXP~ | Right-Align text that matches REGEXP. If BANG, align all matches on each line |
| ~:repl~ | Open a REPL and/or copy the current selection to it | | ~:repl~ | Open a REPL and/or copy the current selection to it |
| ~:retab~ | Convert indentation to the default within the selection | | ~:retab~ | Convert indentation to the default within the selection |