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)
((fboundp '+helm-file-search)
#'+helm-file-search)
((fboundp '+selectrum-file-search)
#'+selectrum-file-search)
((fboundp '+vertico-file-search)
#'+vertico-file-search)
((rgrep
(read-regexp
"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")
(call-interactively
(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!")))))
;;;###autoload

View file

@ -2,7 +2,7 @@
;;;###if (featurep! :completion vertico)
;;;###autoload
(defun +irc/selectrum-jump-to-channel ()
(defun +irc/vertico-jump-to-channel ()
"Jump to an open channel or server buffer with vertico."
(interactive)
(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:
+ =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~)
https://assets.doomemacs.org/completion/vertico/buffer-search.png

View file

@ -1,14 +1,14 @@
;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)
;;;###autoload (autoload '+selectrum:project-search "completion/vertico/autoload/evil" nil t)
(evil-define-command +selectrum:project-search (query &optional all-files-p)
"Ex interface for `+selectrum/project-search'."
;;;###autoload (autoload '+vertico:project-search "completion/vertico/autoload/evil" nil t)
(evil-define-command +vertico:project-search (query &optional all-files-p)
"Ex interface for `+vertico/project-search'."
(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)
(evil-define-command +selectrum:project-search-from-cwd (query &optional recurse-p)
"Ex interface for `+selectrum/project-search-from-cwd'."
;;;###autoload (autoload '+vertico:project-search-from-cwd "completion/vertico/autoload/evil" nil t)
(evil-define-command +vertico:project-search-from-cwd (query &optional recurse-p)
"Ex interface for `+vertico/project-search-from-cwd'."
(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; -*-
;;;###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
orderless."
:around 'company-capf--candidates
@ -10,7 +10,7 @@ orderless."
(apply fn args)))
;;;###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.
:query STRING
@ -56,27 +56,27 @@ orderless."
(consult--grep prompt ripgrep-command directory query)))
;;;###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.
If ARG (universal argument), include all files, even hidden or compressed ones,
in the search."
(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
(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.
If ARG (universal argument), include all files, even hidden or compressed ones."
(interactive "P")
(+selectrum/project-search arg initial-query default-directory))
(+vertico/project-search arg initial-query default-directory))
;;;###autoload
(defun +selectrum/search-symbol-at-point ()
(defun +vertico/search-symbol-at-point ()
(interactive)
(consult-line (thing-at-point 'symbol)))
;;;###autoload
(defun +selectrum/backward-updir ()
(defun +vertico/backward-updir ()
"Delete char before or go up directory for file cagetory vertico buffers."
(interactive)
(let ((metadata (completion-metadata (minibuffer-contents)
@ -94,7 +94,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
;;;###autoload
(defun +selectrum/embark-export-write ()
(defun +vertico/embark-export-write ()
"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"
@ -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)))))
;;;###autoload
(defun +selectrum/embark-preview ()
(defun +vertico/embark-preview ()
"Previews candidate in vertico buffer, unless it's a consult command"
(interactive)
(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)))))
;;;###autoload
(defun +selectrum/next-candidate-preview ()
(defun +vertico/next-candidate-preview ()
"Move to next candidate and preivew it"
(interactive)
(vertico-next)
(+selectrum/embark-preview))
(+vertico/embark-preview))
;;;###autoload
(defun +selectrum/previous-candidate-preview ()
(defun +vertico/previous-candidate-preview ()
"Move to previous candidate and preview it"
(interactive)
(vertico-previous)
(+selectrum/embark-preview))
(+vertico/embark-preview))

View file

@ -2,7 +2,7 @@
;;;###if (featurep! :ui workspaces)
;;;###autoload
(defun +selectrum--workspace-nth-source (n)
(defun +vertico--workspace-nth-source (n)
"Generate a consult buffer source for buffers in the NTH workspace"
(cond ((numberp n)
`(:name ,(nth n (+workspace-list-names))
@ -22,19 +22,19 @@
(user-error "invalid workspace source %s" n))))
;;;###autoload
(defun +selectrum--workspace-generate-sources ()
(defun +vertico--workspace-generate-sources ()
"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
(defun +selectrum/switch-workspace-buffer ()
(defun +vertico/switch-workspace-buffer ()
"Switch to another buffer in the same 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)"
(interactive)
(when-let (buffer (consult--multi (+selectrum--workspace-generate-sources)
(when-let (buffer (consult--multi (+vertico--workspace-generate-sources)
:require-match
(confirm-nonexistent-file-or-buffer)
: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)))))
;;;###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."
(+workspace/new)
(find-file x))

View file

@ -13,12 +13,12 @@
#'completion--in-region))))
:config
(map! :map vertico-map
[backspace] #'+selectrum/backward-updir))
[backspace] #'+vertico/backward-updir))
(use-package! orderless
:demand t
:config
(defun +selectrum-orderless-dispatch (pattern _index _total)
(defun +vertico-orderless-dispatch (pattern _index _total)
(cond
;; Ensure that $ works with Consult commands, which add disambiguation suffixes
((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$")))
@ -39,7 +39,7 @@
completion-category-defaults nil
;; note that despite override in the name orderless can still be used in find-file etc.
completion-category-overrides '((file (styles . (orderless partial-completion))))
orderless-style-dispatchers '(+selectrum-orderless-dispatch)
orderless-style-dispatchers '(+vertico-orderless-dispatch)
orderless-component-separator "[ &]")
;; otherwise find-file gets different highlighting than other commands
(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-frame] #'consult-buffer-other-frame
[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)
:config
(recentf-mode)
@ -73,7 +73,7 @@
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file
+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-notes-for-symbol-at-point
consult--source-file consult--source-project-file consult--source-bookmark
@ -102,10 +102,10 @@
"C-;" #'embark-act
"C-c C-;" #'embark-export
:desc "Export to writable buffer"
"C-c C-e" #'+selectrum/embark-export-write)
"C-c C-e" #'+vertico/embark-export-write)
(define-key!
[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"
(when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode))
(save-excursion
@ -123,12 +123,12 @@
(length embark-target-finders))))
(cl-callf2
cons
'+selectrum--embark-target-package!
'+vertico--embark-target-package!
(nthcdr pos embark-target-finders)))
(map!
:map embark-file-map
: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))
(map! :map embark-package-map
"h" #'doom/help-packages

View file

@ -137,7 +137,7 @@
:desc "Search buffer for thing at point" "S"
(cond ((featurep! :completion helm) #'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 "Thesaurus" "T" #'+lookup/synonyms)
@ -435,7 +435,7 @@
(:when (featurep! :completion ivy)
:desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel)
(: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
(:when (featurep! :app twitter)

View file

@ -207,12 +207,12 @@
(:after vertico
:map vertico-map
"M-RET" #'vertico-exit-input
"C-SPC" #'+selectrum/embark-preview
"C-SPC" #'+vertico/embark-preview
"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-k" #'vertico-previous
"C-M-k" #'+selectrum/previous-candidate-preview
"C-M-k" #'+vertico/previous-candidate-preview
"C-S-k" #'vertico-previous-group)))
@ -703,7 +703,7 @@
:desc "Search buffer for thing at point" "S"
(cond ((featurep! :completion helm) #'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 "Thesaurus" "T" #'+lookup/synonyms)

View file

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

View file

@ -70,8 +70,8 @@
(evil-ex-define-cmd "pg[rep]" #'+helm:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd))
((featurep! :completion vertico)
(evil-ex-define-cmd "pg[rep]" #'+selectrum:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+selectrum:project-search-from-cwd)))
(evil-ex-define-cmd "pg[rep]" #'+vertico:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+vertico:project-search-from-cwd)))
;;; Project tools
(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)
"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."
(unless 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)
t)
((featurep! :completion vertico)
(+selectrum-file-search :query query)
(+vertico-file-search :query query)
t))))))
(defun +lookup-evil-goto-definition-backend-fn (_identifier)