fix(selectrum): Remove unnecessary advice overrides

This commit is contained in:
Edmund Miller 2021-02-16 20:53:11 -06:00 committed by Itai Y. Efrat
parent baa5b8f307
commit b741d6a3b9
2 changed files with 2 additions and 49 deletions

View file

@ -8,54 +8,6 @@ one face."
(let ((orderless-match-faces [completions-common-part])) (let ((orderless-match-faces [completions-common-part]))
(apply fn args))) (apply fn args)))
;;;###autoload
(defadvice! +selectrum--+default/yank-pop-a (&rest _)
"Interactively select what text to insert from the kill ring."
:override '+default/yank-pop
(interactive "P")
(call-interactively
(cond ((fboundp 'counsel-yank-pop) #'counsel-yank-pop)
((fboundp 'consult-yank-pop) #'consult-yank-pop)
((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring)
((error "No kill-ring search backend available. Enable ivy or helm!")))))
;;;###autoload
(defadvice! +selectrum--+default/search-project-a (&optional arg)
"Conduct a text search in the current project root.
If prefix ARG is set, include ignored/hidden files."
:override '+default/search-project
(interactive "P")
(let* ((projectile-project-root nil)
(disabled-command-function nil)
(current-prefix-arg (unless (eq arg 'other) arg))
(default-directory
(if (eq arg 'other)
(if-let (projects (projectile-relevant-known-projects))
(completing-read "Search project: " projects nil t)
(user-error "There are no known projects"))
default-directory)))
(call-interactively
(cond ((featurep! :completion ivy) #'+ivy/project-search)
((featurep! :completion helm) #'+helm/project-search)
((fboundp 'consult--grep) #'+selectrum/project-search)
(#'projectile-ripgrep)))))
;;;###autoload
(defadvice! +selectrum--+default/search-cwd-a (&optional arg)
"Conduct a text search in files under the current folder.
If prefix ARG is set, prompt for a directory to search from."
:override '+default/search-cwd
(interactive "P")
(let ((default-directory
(if arg
(read-directory-name "Search directory: ")
default-directory)))
(call-interactively
(cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd)
((featurep! :completion helm) #'+helm/project-search-from-cwd)
((fboundp 'consult--grep) #'+selectrum/project-search-from-cwd)
(#'rgrep)))))
;;;###autoload ;;;###autoload
(cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args) (cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args)
"Conduct a file search using ripgrep. "Conduct a file search using ripgrep.

View file

@ -28,8 +28,9 @@
(interactive) (interactive)
(call-interactively (call-interactively
(cond ((fboundp 'counsel-yank-pop) #'counsel-yank-pop) (cond ((fboundp 'counsel-yank-pop) #'counsel-yank-pop)
((fboundp 'consult-yank-pop) #'consult-yank-pop)
((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring) ((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring)
((error "No kill-ring search backend available. Enable ivy or helm!"))))) ((error "No kill-ring search backend available. Enable ivy, helm or selectrum!")))))
;;;###autoload ;;;###autoload
(defun +default/yank-buffer-path (&optional root) (defun +default/yank-buffer-path (&optional root)