completion/selectrum -> completion/vertico, part 3

- Rename all functions and variables in the module to reflect the
  namechange (and the irc jump function)
This commit is contained in:
Itai Y. Efrat 2021-07-09 20:28:40 +03:00
parent 24eaa1317c
commit a0eb4e9b65
13 changed files with 55 additions and 55 deletions

View file

@ -226,8 +226,8 @@ will be automatically appended to the result."
#'+ivy-file-search) #'+ivy-file-search)
((fboundp '+helm-file-search) ((fboundp '+helm-file-search)
#'+helm-file-search) #'+helm-file-search)
((fboundp '+selectrum-file-search) ((fboundp '+vertico-file-search)
#'+selectrum-file-search) #'+vertico-file-search)
((rgrep ((rgrep
(read-regexp (read-regexp
"Search for" (or initial-input 'grep-tag-default) "Search for" (or initial-input 'grep-tag-default)

View file

@ -69,7 +69,7 @@ argument) is non-nil only show channels in current server."
(interactive "P") (interactive "P")
(call-interactively (call-interactively
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel) (cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
((featurep! :completion vertico) #'+irc/selectrum-jump-to-channel) ((featurep! :completion vertico) #'+irc/vertico-jump-to-channel)
((user-error "No jump-to-channel backend is enabled. Enable vertico or ivy!"))))) ((user-error "No jump-to-channel backend is enabled. Enable vertico or ivy!")))))
;;;###autoload ;;;###autoload

View file

@ -2,7 +2,7 @@
;;;###if (featurep! :completion vertico) ;;;###if (featurep! :completion vertico)
;;;###autoload ;;;###autoload
(defun +irc/selectrum-jump-to-channel () (defun +irc/vertico-jump-to-channel ()
"Jump to an open channel or server buffer with vertico." "Jump to an open channel or server buffer with vertico."
(interactive) (interactive)
(require 'consult) (require 'consult)

View file

@ -110,7 +110,7 @@ https://assets.doomemacs.org/completion/vertico/search-replace.png
This module provides some in buffer searching bindings: This module provides some in buffer searching bindings:
+ =SPC s s= (~isearch~) + =SPC s s= (~isearch~)
+ =SPC s S= (~+selectrum/search-symbol-at-point~ via ~consult-line~) + =SPC s S= (~+vertico/search-symbol-at-point~ via ~consult-line~)
+ =SPC s b= (~consult-line~) + =SPC s b= (~consult-line~)
https://assets.doomemacs.org/completion/vertico/buffer-search.png https://assets.doomemacs.org/completion/vertico/buffer-search.png

View file

@ -1,14 +1,14 @@
;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*- ;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil) ;;;###if (featurep! :editor evil)
;;;###autoload (autoload '+selectrum:project-search "completion/vertico/autoload/evil" nil t) ;;;###autoload (autoload '+vertico:project-search "completion/vertico/autoload/evil" nil t)
(evil-define-command +selectrum:project-search (query &optional all-files-p) (evil-define-command +vertico:project-search (query &optional all-files-p)
"Ex interface for `+selectrum/project-search'." "Ex interface for `+vertico/project-search'."
(interactive "<a><!>") (interactive "<a><!>")
(+selectrum/project-search all-files-p query)) (+vertico/project-search all-files-p query))
;;;###autoload (autoload '+selectrum:project-search-from-cwd "completion/vertico/autoload/evil" nil t) ;;;###autoload (autoload '+vertico:project-search-from-cwd "completion/vertico/autoload/evil" nil t)
(evil-define-command +selectrum:project-search-from-cwd (query &optional recurse-p) (evil-define-command +vertico:project-search-from-cwd (query &optional recurse-p)
"Ex interface for `+selectrum/project-search-from-cwd'." "Ex interface for `+vertico/project-search-from-cwd'."
(interactive "<a><!>") (interactive "<a><!>")
(+selectrum/project-search-from-cwd (not recurse-p) query)) (+vertico/project-search-from-cwd (not recurse-p) query))

View file

@ -1,7 +1,7 @@
;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*- ;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*-
;;;###autoload ;;;###autoload
(defadvice! +selectrum--company-capf--candidates-a (fn &rest args) (defadvice! +vertico--company-capf--candidates-a (fn &rest args)
"Highlight company matches correctly, and try default completion styles before "Highlight company matches correctly, and try default completion styles before
orderless." orderless."
:around 'company-capf--candidates :around 'company-capf--candidates
@ -10,7 +10,7 @@ orderless."
(apply fn args))) (apply fn args)))
;;;###autoload ;;;###autoload
(cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args) (cl-defun +vertico-file-search (&key query in all-files (recursive t) prompt args)
"Conduct a file search using ripgrep. "Conduct a file search using ripgrep.
:query STRING :query STRING
@ -56,27 +56,27 @@ orderless."
(consult--grep prompt ripgrep-command directory query))) (consult--grep prompt ripgrep-command directory query)))
;;;###autoload ;;;###autoload
(defun +selectrum/project-search (&optional arg initial-query directory) (defun +vertico/project-search (&optional arg initial-query directory)
"Peforms a live project search from the project root using ripgrep. "Peforms a live project search from the project root using ripgrep.
If ARG (universal argument), include all files, even hidden or compressed ones, If ARG (universal argument), include all files, even hidden or compressed ones,
in the search." in the search."
(interactive "P") (interactive "P")
(+selectrum-file-search :query initial-query :in directory :all-files arg)) (+vertico-file-search :query initial-query :in directory :all-files arg))
;;;###autoload ;;;###autoload
(defun +selectrum/project-search-from-cwd (&optional arg initial-query) (defun +vertico/project-search-from-cwd (&optional arg initial-query)
"Performs a live project search from the current directory. "Performs a live project search from the current directory.
If ARG (universal argument), include all files, even hidden or compressed ones." If ARG (universal argument), include all files, even hidden or compressed ones."
(interactive "P") (interactive "P")
(+selectrum/project-search arg initial-query default-directory)) (+vertico/project-search arg initial-query default-directory))
;;;###autoload ;;;###autoload
(defun +selectrum/search-symbol-at-point () (defun +vertico/search-symbol-at-point ()
(interactive) (interactive)
(consult-line (thing-at-point 'symbol))) (consult-line (thing-at-point 'symbol)))
;;;###autoload ;;;###autoload
(defun +selectrum/backward-updir () (defun +vertico/backward-updir ()
"Delete char before or go up directory for file cagetory vertico buffers." "Delete char before or go up directory for file cagetory vertico buffers."
(interactive) (interactive)
(let ((metadata (completion-metadata (minibuffer-contents) (let ((metadata (completion-metadata (minibuffer-contents)
@ -94,7 +94,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
;;;###autoload ;;;###autoload
(defun +selectrum/embark-export-write () (defun +vertico/embark-export-write ()
"Export the current vertico results to a writable buffer if possible. "Export the current vertico results to a writable buffer if possible.
Supports exporting consult-grep to wgrep, file to wdeired, and consult-location to occur-edit" Supports exporting consult-grep to wgrep, file to wdeired, and consult-location to occur-edit"
@ -112,7 +112,7 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location
(x (user-error "embark category %S doesn't support writable export" x))))) (x (user-error "embark category %S doesn't support writable export" x)))))
;;;###autoload ;;;###autoload
(defun +selectrum/embark-preview () (defun +vertico/embark-preview ()
"Previews candidate in vertico buffer, unless it's a consult command" "Previews candidate in vertico buffer, unless it's a consult command"
(interactive) (interactive)
(unless (bound-and-true-p consult--preview-function) (unless (bound-and-true-p consult--preview-function)
@ -121,15 +121,15 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location
(embark-default-action))))) (embark-default-action)))))
;;;###autoload ;;;###autoload
(defun +selectrum/next-candidate-preview () (defun +vertico/next-candidate-preview ()
"Move to next candidate and preivew it" "Move to next candidate and preivew it"
(interactive) (interactive)
(vertico-next) (vertico-next)
(+selectrum/embark-preview)) (+vertico/embark-preview))
;;;###autoload ;;;###autoload
(defun +selectrum/previous-candidate-preview () (defun +vertico/previous-candidate-preview ()
"Move to previous candidate and preview it" "Move to previous candidate and preview it"
(interactive) (interactive)
(vertico-previous) (vertico-previous)
(+selectrum/embark-preview)) (+vertico/embark-preview))

View file

@ -2,7 +2,7 @@
;;;###if (featurep! :ui workspaces) ;;;###if (featurep! :ui workspaces)
;;;###autoload ;;;###autoload
(defun +selectrum--workspace-nth-source (n) (defun +vertico--workspace-nth-source (n)
"Generate a consult buffer source for buffers in the NTH workspace" "Generate a consult buffer source for buffers in the NTH workspace"
(cond ((numberp n) (cond ((numberp n)
`(:name ,(nth n (+workspace-list-names)) `(:name ,(nth n (+workspace-list-names))
@ -22,19 +22,19 @@
(user-error "invalid workspace source %s" n)))) (user-error "invalid workspace source %s" n))))
;;;###autoload ;;;###autoload
(defun +selectrum--workspace-generate-sources () (defun +vertico--workspace-generate-sources ()
"Generate list of consult buffer sources for all workspaces" "Generate list of consult buffer sources for all workspaces"
(mapcar #'+selectrum--workspace-nth-source '(0 1 2 3 4 5 6 7 8 final))) (mapcar #'+vertico--workspace-nth-source '(0 1 2 3 4 5 6 7 8 final)))
(autoload 'consult--multi "consult") (autoload 'consult--multi "consult")
;;;###autoload ;;;###autoload
(defun +selectrum/switch-workspace-buffer () (defun +vertico/switch-workspace-buffer ()
"Switch to another buffer in the same workspace. "Switch to another buffer in the same workspace.
Use consult narrowing with another workspace number to open a buffer from that workspace Use consult narrowing with another workspace number to open a buffer from that workspace
BUG but it opens it in the current workspace (ivy also does this, but who cares)" BUG but it opens it in the current workspace (ivy also does this, but who cares)"
(interactive) (interactive)
(when-let (buffer (consult--multi (+selectrum--workspace-generate-sources) (when-let (buffer (consult--multi (+vertico--workspace-generate-sources)
:require-match :require-match
(confirm-nonexistent-file-or-buffer) (confirm-nonexistent-file-or-buffer)
:prompt (format "Switch to buffer (%s): " :prompt (format "Switch to buffer (%s): "
@ -47,7 +47,7 @@ Use consult narrowing with another workspace number to open a buffer from that w
(funcall consult--buffer-display (car buffer))))) (funcall consult--buffer-display (car buffer)))))
;;;###autoload ;;;###autoload
(defun +selectrum-embark-open-in-new-workspace (x) (defun +vertico-embark-open-in-new-workspace (x)
"Open X (a file) in a new workspace." "Open X (a file) in a new workspace."
(+workspace/new) (+workspace/new)
(find-file x)) (find-file x))

View file

@ -13,12 +13,12 @@
#'completion--in-region)))) #'completion--in-region))))
:config :config
(map! :map vertico-map (map! :map vertico-map
[backspace] #'+selectrum/backward-updir)) [backspace] #'+vertico/backward-updir))
(use-package! orderless (use-package! orderless
:demand t :demand t
:config :config
(defun +selectrum-orderless-dispatch (pattern _index _total) (defun +vertico-orderless-dispatch (pattern _index _total)
(cond (cond
;; Ensure that $ works with Consult commands, which add disambiguation suffixes ;; Ensure that $ works with Consult commands, which add disambiguation suffixes
((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$"))) ((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$")))
@ -39,7 +39,7 @@
completion-category-defaults nil completion-category-defaults nil
;; note that despite override in the name orderless can still be used in find-file etc. ;; note that despite override in the name orderless can still be used in find-file etc.
completion-category-overrides '((file (styles . (orderless partial-completion)))) completion-category-overrides '((file (styles . (orderless partial-completion))))
orderless-style-dispatchers '(+selectrum-orderless-dispatch) orderless-style-dispatchers '(+vertico-orderless-dispatch)
orderless-component-separator "[ &]") orderless-component-separator "[ &]")
;; otherwise find-file gets different highlighting than other commands ;; otherwise find-file gets different highlighting than other commands
(set-face-attribute 'completions-first-difference nil :inherit nil)) (set-face-attribute 'completions-first-difference nil :inherit nil))
@ -62,7 +62,7 @@
[remap switch-to-buffer-other-window] #'consult-buffer-other-window [remap switch-to-buffer-other-window] #'consult-buffer-other-window
[remap switch-to-buffer-other-frame] #'consult-buffer-other-frame [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame
[remap yank-pop] #'consult-yank-pop [remap yank-pop] #'consult-yank-pop
[remap persp-switch-to-buffer] #'+selectrum/switch-workspace-buffer) [remap persp-switch-to-buffer] #'+vertico/switch-workspace-buffer)
(advice-add #'completing-read-multiple :override #'consult-completing-read-multiple) (advice-add #'completing-read-multiple :override #'consult-completing-read-multiple)
:config :config
(recentf-mode) (recentf-mode)
@ -73,7 +73,7 @@
consult-ripgrep consult-git-grep consult-grep consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-bookmark consult-recent-file
+default/search-project +default/search-project-for-symbol-at-point +default/search-project +default/search-project-for-symbol-at-point
+default/search-other-project +selectrum/search-symbol-at-point +default/search-other-project +vertico/search-symbol-at-point
+default/search-cwd +default/search-other-cwd +default/search-cwd +default/search-other-cwd
+default/search-notes-for-symbol-at-point +default/search-notes-for-symbol-at-point
consult--source-file consult--source-project-file consult--source-bookmark consult--source-file consult--source-project-file consult--source-bookmark
@ -102,10 +102,10 @@
"C-;" #'embark-act "C-;" #'embark-act
"C-c C-;" #'embark-export "C-c C-;" #'embark-export
:desc "Export to writable buffer" :desc "Export to writable buffer"
"C-c C-e" #'+selectrum/embark-export-write) "C-c C-e" #'+vertico/embark-export-write)
(define-key! (define-key!
[remap describe-bindings] #'embark-bindings) [remap describe-bindings] #'embark-bindings)
(defun +selectrum--embark-target-package! () (defun +vertico--embark-target-package! ()
"Targets Doom's package! statements and returns the package name" "Targets Doom's package! statements and returns the package name"
(when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode)) (when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode))
(save-excursion (save-excursion
@ -123,12 +123,12 @@
(length embark-target-finders)))) (length embark-target-finders))))
(cl-callf2 (cl-callf2
cons cons
'+selectrum--embark-target-package! '+vertico--embark-target-package!
(nthcdr pos embark-target-finders))) (nthcdr pos embark-target-finders)))
(map! (map!
:map embark-file-map :map embark-file-map
:desc "Open target with sudo" "s" #'doom/sudo-find-file :desc "Open target with sudo" "s" #'doom/sudo-find-file
:desc "Open in new workspace" "TAB" #'+selectrum-embark-open-in-new-workspace) :desc "Open in new workspace" "TAB" #'+vertico-embark-open-in-new-workspace)
(setq embark-package-map (make-sparse-keymap)) (setq embark-package-map (make-sparse-keymap))
(map! :map embark-package-map (map! :map embark-package-map
"h" #'doom/help-packages "h" #'doom/help-packages

View file

@ -137,7 +137,7 @@
:desc "Search buffer for thing at point" "S" :desc "Search buffer for thing at point" "S"
(cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point) (cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point)
((featurep! :completion ivy) #'swiper-isearch-thing-at-point) ((featurep! :completion ivy) #'swiper-isearch-thing-at-point)
((featurep! :completion vertico) #'+selectrum/search-symbol-at-point)) ((featurep! :completion vertico) #'+vertico/search-symbol-at-point))
:desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Dictionary" "t" #'+lookup/dictionary-definition
:desc "Thesaurus" "T" #'+lookup/synonyms) :desc "Thesaurus" "T" #'+lookup/synonyms)
@ -435,7 +435,7 @@
(:when (featurep! :completion ivy) (:when (featurep! :completion ivy)
:desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel) :desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel)
(:when (featurep! :completion vertico) (:when (featurep! :completion vertico)
:desc "Jump to channel" "j" #'+irc/selectrum-jump-to-channel))) :desc "Jump to channel" "j" #'+irc/vertico-jump-to-channel)))
;;; <leader> T --- twitter ;;; <leader> T --- twitter
(:when (featurep! :app twitter) (:when (featurep! :app twitter)

View file

@ -207,12 +207,12 @@
(:after vertico (:after vertico
:map vertico-map :map vertico-map
"M-RET" #'vertico-exit-input "M-RET" #'vertico-exit-input
"C-SPC" #'+selectrum/embark-preview "C-SPC" #'+vertico/embark-preview
"C-j" #'vertico-next "C-j" #'vertico-next
"C-M-j" #'+selectrum/next-candidate-preview "C-M-j" #'+vertico/next-candidate-preview
"C-S-j" #'vertico-next-group "C-S-j" #'vertico-next-group
"C-k" #'vertico-previous "C-k" #'vertico-previous
"C-M-k" #'+selectrum/previous-candidate-preview "C-M-k" #'+vertico/previous-candidate-preview
"C-S-k" #'vertico-previous-group))) "C-S-k" #'vertico-previous-group)))
@ -703,7 +703,7 @@
:desc "Search buffer for thing at point" "S" :desc "Search buffer for thing at point" "S"
(cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point) (cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point)
((featurep! :completion ivy) #'swiper-isearch-thing-at-point) ((featurep! :completion ivy) #'swiper-isearch-thing-at-point)
((featurep! :completion vertico) #'+selectrum/search-symbol-at-point)) ((featurep! :completion vertico) #'+vertico/search-symbol-at-point))
:desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Dictionary" "t" #'+lookup/dictionary-definition
:desc "Thesaurus" "T" #'+lookup/synonyms) :desc "Thesaurus" "T" #'+lookup/synonyms)

View file

@ -12,7 +12,7 @@ If prefix ARG is set, prompt for a directory to search from."
(call-interactively (call-interactively
(cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd) (cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd)
((featurep! :completion helm) #'+helm/project-search-from-cwd) ((featurep! :completion helm) #'+helm/project-search-from-cwd)
((featurep! :completion vertico) #'+selectrum/project-search-from-cwd) ((featurep! :completion vertico) #'+vertico/project-search-from-cwd)
(#'rgrep))))) (#'rgrep)))))
;;;###autoload ;;;###autoload
@ -50,7 +50,7 @@ If prefix ARG is set, include ignored/hidden files."
(call-interactively (call-interactively
(cond ((featurep! :completion ivy) #'+ivy/project-search) (cond ((featurep! :completion ivy) #'+ivy/project-search)
((featurep! :completion helm) #'+helm/project-search) ((featurep! :completion helm) #'+helm/project-search)
((featurep! :completion vertico) #'+selectrum/project-search) ((featurep! :completion vertico) #'+vertico/project-search)
(#'projectile-ripgrep))))) (#'projectile-ripgrep)))))
;;;###autoload ;;;###autoload
@ -78,7 +78,7 @@ If prefix ARG is set, prompt for a known project to search from."
((featurep! :completion helm) ((featurep! :completion helm)
(+helm/project-search nil symbol)) (+helm/project-search nil symbol))
((featurep! :completion vertico) ((featurep! :completion vertico)
(+selectrum/project-search nil symbol)) (+vertico/project-search nil symbol))
((rgrep (regexp-quote symbol)))))) ((rgrep (regexp-quote symbol))))))
;;;###autoload ;;;###autoload

View file

@ -70,8 +70,8 @@
(evil-ex-define-cmd "pg[rep]" #'+helm:project-search) (evil-ex-define-cmd "pg[rep]" #'+helm:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd)) (evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd))
((featurep! :completion vertico) ((featurep! :completion vertico)
(evil-ex-define-cmd "pg[rep]" #'+selectrum:project-search) (evil-ex-define-cmd "pg[rep]" #'+vertico:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+selectrum:project-search-from-cwd))) (evil-ex-define-cmd "pg[grep]d" #'+vertico:project-search-from-cwd)))
;;; Project tools ;;; Project tools
(evil-ex-define-cmd "com[pile]" #'+evil:compile) (evil-ex-define-cmd "com[pile]" #'+evil:compile)

View file

@ -234,7 +234,7 @@ This backend prefers \"just working\" over accuracy."
(defun +lookup-project-search-backend-fn (identifier) (defun +lookup-project-search-backend-fn (identifier)
"Conducts a simple project text search for IDENTIFIER. "Conducts a simple project text search for IDENTIFIER.
Uses and requires `+ivy-file-search', `+helm-file-search', or `+selectrum-file-search'. Uses and requires `+ivy-file-search', `+helm-file-search', or `+vertico-file-search'.
Will return nil if neither is available. These require ripgrep to be installed." Will return nil if neither is available. These require ripgrep to be installed."
(unless identifier (unless identifier
(let ((query (rxt-quote-pcre identifier))) (let ((query (rxt-quote-pcre identifier)))
@ -246,7 +246,7 @@ Will return nil if neither is available. These require ripgrep to be installed."
(+helm-file-search :query query) (+helm-file-search :query query)
t) t)
((featurep! :completion vertico) ((featurep! :completion vertico)
(+selectrum-file-search :query query) (+vertico-file-search :query query)
t)))))) t))))))
(defun +lookup-evil-goto-definition-backend-fn (_identifier) (defun +lookup-evil-goto-definition-backend-fn (_identifier)