From 21a869472705be97f838196b3ef28134cc2065bd Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sat, 16 Jan 2021 03:04:18 +0800 Subject: [PATCH 001/147] add selectrum module --- modules/completion/selectrum/config.el | 43 ++++++++++++++++++++++++ modules/completion/selectrum/packages.el | 15 +++++++++ 2 files changed, 58 insertions(+) create mode 100644 modules/completion/selectrum/config.el create mode 100644 modules/completion/selectrum/packages.el diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el new file mode 100644 index 000000000..e838d3254 --- /dev/null +++ b/modules/completion/selectrum/config.el @@ -0,0 +1,43 @@ +;;; completion/selectrum/config.el -*- lexical-binding: t; -*- + +(use-package! selectrum + :hook (doom-first-input . selectrum-mode)) + +(when (featurep! +prescient) + (use-package! selectrum-prescient + :after selectrum + :hook ((doom-first-input . selectrum-prescient-mode) + (doom-first-input . prescient-persist-mode)))) + +(use-package! consult + :defer t + :init + (define-key! + [remap apropos] #'consult-apropos + [remap goto-line] #'consult-goto-line + [remap imenu] #'consult-imenu + [remap switch-to-buffer] #'consult-buffer + [remap switch-to-buffer-other-window] #'consult-buffer-other-window + [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame + [remap man] #'consult-man + [remap yank-pop] #'consult-yank-pop + [remap locate] #'consult-locate + [remap load-theme] #'consult-theme)) + +(use-package! consult-flycheck) + +(use-package! embark + :init + (define-key! + "C-S-a" #'embark-act)) + +(use-package! marginalia + :after selectrum + :hook (doom-first-input . marginalia-mode) + :init + (setq-default marginalia-annotators '(marginalia-annotators-heavy))) + +(use-package! embark-consult + :after (embark consult) + :hook + (embark-collect-mode . embark-consult-preview-minor-mode)) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el new file mode 100644 index 000000000..7b569cef7 --- /dev/null +++ b/modules/completion/selectrum/packages.el @@ -0,0 +1,15 @@ +;; -*- no-byte-compile: t; -*- +;;; completion/selectrum/packages.el + +(package! selectrum) + +(when (featurep! +prescient) + (package! selectrum-prescient)) + +(package! consult) +(package! consult-flycheck) + +(package! embark) +(package! embark-consult) + +(package! marginalia) From 65c153796e6b1f68d7283e3232dcf5d73cb09311 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sat, 16 Jan 2021 20:21:50 +0800 Subject: [PATCH 002/147] Add selectrum project search --- .../selectrum/autoload/selectrum.el | 63 +++++++++++++++++++ modules/completion/selectrum/config.el | 27 ++++++-- modules/completion/selectrum/packages.el | 6 +- modules/config/default/autoload/search.el | 10 +-- 4 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 modules/completion/selectrum/autoload/selectrum.el diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el new file mode 100644 index 000000000..d8135b4e2 --- /dev/null +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -0,0 +1,63 @@ +;;;###autoload +(cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args) + "Conduct a file search using ripgrep. + +:query STRING + Determines the initial input to search for. +:in PATH + Sets what directory to base the search out of. Defaults to the current project's root. +:recursive BOOL + Whether or not to search files recursively from the base directory." + (declare (indent defun)) + (unless (executable-find "rg") + (user-error "Couldn't find ripgrep in your PATH")) + (require 'consult) + (setq deactivate-mark t) + (let* ((this-command 'consult--grep) + (project-root (or (doom-project-root) default-directory)) + (directory (or in project-root)) + (args (split-string + (string-trim + (concat (if all-files "-uu") + (unless recursive "--maxdepth 1") + "--null --line-buffered --color=always --max-columns=500 --no-heading --line-number" + " --hidden -g!.git " + (mapconcat #'shell-quote-argument args " "))) + " ")) + (prompt (or prompt + (format "rg [%s]: " + (cond ((equal directory default-directory) + "./") + ((equal directory project-root) + (projectile-project-name)) + ((file-relative-name directory project-root)))))) + (query (or query + (when (doom-region-active-p) + (replace-regexp-in-string + "[! |]" (lambda (substr) + (cond ((and (string= substr " ") + (not (featurep! +fuzzy))) + " ") + ((string= substr "|") + "\\\\\\\\|") + ((concat "\\\\" substr)))) + (rxt-quote-pcre (doom-thing-at-point-or-region)))))) + (ripgrep-command `("rg" ,@args "." "-e"))) + (consult--grep prompt ripgrep-command directory query))) + +;;;###autoload +(defun +selectrum/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)) + +;;;###autoload +(defun +selectrum/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)) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index e838d3254..b6f1c24db 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -1,7 +1,12 @@ ;;; completion/selectrum/config.el -*- lexical-binding: t; -*- (use-package! selectrum - :hook (doom-first-input . selectrum-mode)) + :hook (doom-first-input . selectrum-mode) + :config + (setq selectrum-extend-current-candidate-highlight t + selectrum-fix-minibuffer-height t) + (unless (featurep! +orderless) + (setq completion-styles '(substring partial-completion)))) (when (featurep! +prescient) (use-package! selectrum-prescient @@ -9,9 +14,15 @@ :hook ((doom-first-input . selectrum-prescient-mode) (doom-first-input . prescient-persist-mode)))) +(use-package! orderless + :when (featurep! +orderless) + :config + (setq completion-styles '(orderless))) + (use-package! consult :defer t :init + (fset 'multi-occur #'consult-multi-occur) (define-key! [remap apropos] #'consult-apropos [remap goto-line] #'consult-goto-line @@ -22,14 +33,22 @@ [remap man] #'consult-man [remap yank-pop] #'consult-yank-pop [remap locate] #'consult-locate - [remap load-theme] #'consult-theme)) + [remap load-theme] #'consult-theme + [remap recentf-open-files] #'consult-recent-file) + :config + (setq consult-project-root-function #'projectile-project-root)) -(use-package! consult-flycheck) +(use-package! consult-flycheck + :when (featurep! :checkers syntax) + :after (consult flycheck)) (use-package! embark :init (define-key! - "C-S-a" #'embark-act)) + "C-S-a" #'embark-act) + (define-key! selectrum-minibuffer-map + "C-c C-o" #'embark-export + "C-c C-c" #'embark-act-noexit)) (use-package! marginalia :after selectrum diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 7b569cef7..7c0853154 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -6,8 +6,12 @@ (when (featurep! +prescient) (package! selectrum-prescient)) +(when (featurep! +orderless) + (package! orderless)) + (package! consult) -(package! consult-flycheck) +(when (featurep! :checkers syntax) + (package! consult-flycheck)) (package! embark) (package! embark-consult) diff --git a/modules/config/default/autoload/search.el b/modules/config/default/autoload/search.el index 41bd8489c..766d2b744 100644 --- a/modules/config/default/autoload/search.el +++ b/modules/config/default/autoload/search.el @@ -10,8 +10,9 @@ If prefix ARG is set, prompt for a directory to search from." (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) + (cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd) + ((featurep! :completion helm) #'+helm/project-search-from-cwd) + ((featurep! :completion selectrum) #'+selectrum/project-search-from-cwd) (#'rgrep))))) ;;;###autoload @@ -45,8 +46,9 @@ If prefix ARG is set, include ignored/hidden files." (user-error "There are no known projects")) default-directory))) (call-interactively - (cond ((featurep! :completion ivy) #'+ivy/project-search) - ((featurep! :completion helm) #'+helm/project-search) + (cond ((featurep! :completion ivy) #'+ivy/project-search) + ((featurep! :completion helm) #'+helm/project-search) + ((featurep! :completion selectrum) #'+selectrum/project-search) (#'projectile-ripgrep))))) ;;;###autoload From f4517d890fd0d52f7d644653b0ef21b2fcd2d1a2 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sat, 16 Jan 2021 20:28:03 +0800 Subject: [PATCH 003/147] set prescient things on selectrum-mode --- modules/completion/selectrum/config.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index b6f1c24db..658c0cd76 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -11,8 +11,8 @@ (when (featurep! +prescient) (use-package! selectrum-prescient :after selectrum - :hook ((doom-first-input . selectrum-prescient-mode) - (doom-first-input . prescient-persist-mode)))) + :hook ((selectrum-mode . selectrum-prescient-mode) + (selectrum-mode . prescient-persist-mode)))) (use-package! orderless :when (featurep! +orderless) From a0ff8d42c1702c49e0939055de7e06d7f65f1b00 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sat, 16 Jan 2021 20:29:16 +0800 Subject: [PATCH 004/147] lazy-load embark --- modules/completion/selectrum/config.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 658c0cd76..550d82dd0 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -43,9 +43,11 @@ :after (consult flycheck)) (use-package! embark + :defer t :init (define-key! "C-S-a" #'embark-act) + ;; TODO need to figure out what keybindings to put here (define-key! selectrum-minibuffer-map "C-c C-o" #'embark-export "C-c C-c" #'embark-act-noexit)) From 42b3184eaee27111378afa2e59b2bb8adf2b6f40 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 16:46:35 -0600 Subject: [PATCH 005/147] feat(selectrum): Add config from Townk's private config Co-authored-by: Townk --- .../selectrum/autoload/selectrum.el | 119 +++++++++++++----- modules/completion/selectrum/config.el | 80 +++++++++--- 2 files changed, 154 insertions(+), 45 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index d8135b4e2..04341135f 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -1,63 +1,124 @@ +;;; completion/selectrum/autoload/selectrum.el -*- lexical-binding: t; -*- + +;;;###autoload +(defadvice! +selectrum--company-capf--candidates-a (fn &rest args) + "Function to help company to highlight all candidates with just +one face." + :around 'company-capf--candidates + (let ((orderless-match-faces [completions-common-part])) + (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 (cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args) "Conduct a file search using ripgrep. - :query STRING Determines the initial input to search for. :in PATH - Sets what directory to base the search out of. Defaults to the current project's root. + Sets what directory to base the search out of. Defaults to the current + project's root. :recursive BOOL Whether or not to search files recursively from the base directory." (declare (indent defun)) (unless (executable-find "rg") (user-error "Couldn't find ripgrep in your PATH")) (require 'consult) - (setq deactivate-mark t) - (let* ((this-command 'consult--grep) + (let* ((this-command 'consult-ripgrep) (project-root (or (doom-project-root) default-directory)) (directory (or in project-root)) - (args (split-string - (string-trim - (concat (if all-files "-uu") - (unless recursive "--maxdepth 1") - "--null --line-buffered --color=always --max-columns=500 --no-heading --line-number" - " --hidden -g!.git " - (mapconcat #'shell-quote-argument args " "))) - " ")) + (ripgrep-command (seq-remove 'null + (append (butlast consult-ripgrep-command) + (list + (when all-files "-uu") + (unless recursive " --maxdepth 1") + "--hidden" + "-g!.git") + args + '("-e")))) (prompt (or prompt - (format "rg [%s]: " - (cond ((equal directory default-directory) - "./") - ((equal directory project-root) - (projectile-project-name)) + (format "%s [%s]: " + (mapconcat #'identity ripgrep-command " ") + (cond ((equal directory default-directory) "./") + ((equal directory project-root) (projectile-project-name)) ((file-relative-name directory project-root)))))) (query (or query (when (doom-region-active-p) (replace-regexp-in-string "[! |]" (lambda (substr) - (cond ((and (string= substr " ") - (not (featurep! +fuzzy))) - " ") - ((string= substr "|") - "\\\\\\\\|") + (cond ((string= substr " ") " ") + ((string= substr "|") "\\\\\\\\|") ((concat "\\\\" substr)))) - (rxt-quote-pcre (doom-thing-at-point-or-region)))))) - (ripgrep-command `("rg" ,@args "." "-e"))) + (rxt-quote-pcre (doom-thing-at-point-or-region)))) + " "))) + ;; (setq deactivate-mark t) (consult--grep prompt ripgrep-command directory query))) ;;;###autoload (defun +selectrum/project-search (&optional arg initial-query directory) - "Peforms a live project search from the project root using ripgrep. - + "Performs 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)) + (+selectrum-file-search + :prompt (format "Find text on project files \[%s\]" + (if (or (and (not directory) (doom-project-root)) + (and directory (equal directory (doom-project-root)))) + (projectile-project-name) + (file-relative-name (or directory (doom-project-root) default-directory)))) + :query initial-query + :in directory + :all-files arg)) ;;;###autoload (defun +selectrum/project-search-from-cwd (&optional arg initial-query) - "Performs a live project search from the current directory. - + "Performs a project search recursively 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)) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 550d82dd0..fef3173ea 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -2,22 +2,55 @@ (use-package! selectrum :hook (doom-first-input . selectrum-mode) - :config - (setq selectrum-extend-current-candidate-highlight t + :init + (setq selectrum-display-action nil + selectrum-num-candidates-displayed 15 + selectrum-extend-current-candidate-highlight t selectrum-fix-minibuffer-height t) - (unless (featurep! +orderless) - (setq completion-styles '(substring partial-completion)))) + (when (featurep! +orderless) -(when (featurep! +prescient) - (use-package! selectrum-prescient - :after selectrum - :hook ((selectrum-mode . selectrum-prescient-mode) - (selectrum-mode . prescient-persist-mode)))) + (setq completion-styles '(substring partial-completion) + selectrum-refine-candidates-function #'orderless-filter + selectrum-highlight-candidates-function #'orderless-highlight-matches)) + + (when (featurep! +prescient) + (use-package! selectrum-prescient + :after selectrum + :hook ((selectrum-mode . selectrum-prescient-mode) + (selectrum-mode . prescient-persist-mode)) + :config + (setq selectrum-preprocess-candidates-function #'selectrum-prescient--preprocess) + (add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember) + (add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember))) + + :config + (defadvice! +selectrum-refresh-on-cycle (&rest _) + :after 'marginalia-cycle + (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))) + + (map! + :g "C-s-r" #'selectrum-repeat + (:map selectrum-minibuffer-map + :geni "M-RET" #'selectrum-submit-exact-input + :geni "C-j" #'selectrum-next-candidate + :geni "C-S-j" #'selectrum-next-page + :geni "C-s-j" #'selectrum-goto-end + :geni "C-k" #'selectrum-previous-candidate + :geni "C-S-k" #'selectrum-previous-page + :geni "C-s-k" #'selectrum-goto-beginning))) (use-package! orderless :when (featurep! +orderless) + :defer t + :init + (setq orderless-component-separator "[ &]" + orderless-matching-styles '(orderless-prefixes + orderless-initialism + orderless-regexp)) :config - (setq completion-styles '(orderless))) + (setq completion-styles '(orderless)) + (setq orderless-skip-highlighting (lambda () selectrum-active-p)) + (setq selectrum-highlight-candidates-function #'orderless-highlight-matches)) (use-package! consult :defer t @@ -36,7 +69,12 @@ [remap load-theme] #'consult-theme [remap recentf-open-files] #'consult-recent-file) :config - (setq consult-project-root-function #'projectile-project-root)) + (setq consult-project-root-function #'doom-project-root) + (setq completion-in-region-function #'consult-completion-in-region) + (setq consult-narrow-key "<") + (setq consult-line-numbers-widen t) + (setq consult-async-input-debounce 0.5) + (setq consult-async-input-throttle 0.8)) (use-package! consult-flycheck :when (featurep! :checkers syntax) @@ -45,12 +83,22 @@ (use-package! embark :defer t :init - (define-key! - "C-S-a" #'embark-act) - ;; TODO need to figure out what keybindings to put here - (define-key! selectrum-minibuffer-map + (map! + :g "C-s-e" #'embark-act + (:map minibuffer-local-completion-map "C-c C-o" #'embark-export - "C-c C-c" #'embark-act-noexit)) + "C-c C-c" #'embark-act-noexit) + (:map embark-file-map + :desc "Open Dired on target" :g "j" #'ffap-dired + :desc "Open target with sudo" :g "s" #'sudo-edit + :desc "Open target with vlf" :g "l" #'vlf) + (:map embark-file-map + :desc "Cycle marginalia views" :g "A" #'marginalia-cycle)) + (setq embark-action-indicator + (lambda (map) + (which-key--show-keymap "Embark" map nil nil 'no-paging) + #'which-key--hide-popup-ignore-command) + embark-become-indicator embark-action-indicator)) (use-package! marginalia :after selectrum From 155f4f6bdd9b4cf6d5f3b73f98405ecc5a803ca1 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 16:51:03 -0600 Subject: [PATCH 006/147] docs(selectrum): Init README --- modules/completion/selectrum/README.org | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 modules/completion/selectrum/README.org diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org new file mode 100644 index 000000000..8c5f76a8c --- /dev/null +++ b/modules/completion/selectrum/README.org @@ -0,0 +1,35 @@ +#+TITLE: completion/selectrum +#+DATE: February 16, 2021 +#+SINCE: v3.0.0 +#+STARTUP: inlineimages + +* Table of Contents :TOC_2:noexport: +- [[#description][Description]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] +- [[#prerequisites][Prerequisites]] + +* Description +This module provides Selectrum integration for a variety of Emacs commands, as +well as a unified interface for project search and replace, powered by ripgrep. + +#+begin_quote +TODO +#+end_quote + +** Module Flags ++ ~+prescient~ Enables prescient filtering and sorting for Selectrum searches. ++ ~+orderless~ Enables orderless filtering for Selectrum searches. + +** Plugins +[[https://github.com/raxod502/selectrum][selectrum]] +[[https://github.com/minad/consult][consult]] +[[https://github.com/oantolin/embark/][embark]] +[[https://github.com/oantolin/embark/][embark-consult]] +[[https://github.com/minad/marginalia][marginalia]] +[[https://github.com/raxod502/prescient.el][prescient]]* (~+prescient~) +[[https://github.com/oantolin/orderless][orderless]]* (~+orderless~) +[[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) + +* Prerequisites +This module has no prerequisites. From a3d7e5c5124d22ef0725e3bbf4806030e8542dbe Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 16:51:45 -0600 Subject: [PATCH 007/147] docs(selectrum): Add temporary TODO file --- modules/completion/selectrum/TODO.org | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 modules/completion/selectrum/TODO.org diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org new file mode 100644 index 000000000..fc323233e --- /dev/null +++ b/modules/completion/selectrum/TODO.org @@ -0,0 +1,4 @@ +* List of things not working +** TODO SPC-s-p +** TODO SPC-s-b +** TODO Start-up with recent files From 63cd3099ce6784faa41d5a859139c137e674a397 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 17:03:54 -0600 Subject: [PATCH 008/147] Bump :completion selectrum raxod502/selectrum@HEAD -> raxod502/selectrum@ad9d9f0 raxod502/prescient.el@HEAD -> raxod502/prescient.el@42adc80 oantolin/orderless@HEAD -> oantolin/orderless@edce950 minad/consult@HEAD -> minad/consult@1b66afd oantolin/embark@HEAD -> oantolin/embark@26e7311 minad/marginalia@HEAD -> minad/marginalia@3e061a0 --- modules/completion/selectrum/packages.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 7c0853154..f92c7f599 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,19 +1,19 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum) +(package! selectrum :pin "ad9d9f02d6ac916cf4caa548c1967457bfc37c02") (when (featurep! +prescient) - (package! selectrum-prescient)) + (package! selectrum-prescient :pin "42adc802d3ba6c747bed7ea1f6e3ffbbdfc7192d")) (when (featurep! +orderless) - (package! orderless)) + (package! orderless :pin "edce950fe1353c2284516f7b01bd37bc2d7fa136")) -(package! consult) +(package! consult :pin "1b66afd8959f5ad3cf1ffbacae00d2bf0fe30008") (when (featurep! :checkers syntax) - (package! consult-flycheck)) + (package! consult-flycheck :pin "1b66afd8959f5ad3cf1ffbacae00d2bf0fe30008")) -(package! embark) -(package! embark-consult) +(package! embark :pin "26e73117910e78afa209524ecb8f07add45a9ec3") +(package! embark-consult :pin "26e73117910e78afa209524ecb8f07add45a9ec3") -(package! marginalia) +(package! marginalia :pin "3e061a0fb5305389af5b3da17092f2f09fe92c69") From 3afb712452dbc674cbc6713651e2a6e4dc449461 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 19:28:13 -0600 Subject: [PATCH 009/147] fix(selectrum): Move prescient out of nested use-package --- modules/completion/selectrum/config.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index fef3173ea..a8c5b8608 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -13,15 +13,6 @@ selectrum-refine-candidates-function #'orderless-filter selectrum-highlight-candidates-function #'orderless-highlight-matches)) - (when (featurep! +prescient) - (use-package! selectrum-prescient - :after selectrum - :hook ((selectrum-mode . selectrum-prescient-mode) - (selectrum-mode . prescient-persist-mode)) - :config - (setq selectrum-preprocess-candidates-function #'selectrum-prescient--preprocess) - (add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember) - (add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember))) :config (defadvice! +selectrum-refresh-on-cycle (&rest _) @@ -39,6 +30,15 @@ :geni "C-S-k" #'selectrum-previous-page :geni "C-s-k" #'selectrum-goto-beginning))) +(use-package! selectrum-prescient + :when (featurep! +prescient) + :hook (selectrum-mode . selectrum-prescient-mode) + :hook (selectrum-mode . prescient-persist-mode) + :config + (setq selectrum-preprocess-candidates-function #'selectrum-prescient--preprocess) + (add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember) + (add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember)) + (use-package! orderless :when (featurep! +orderless) :defer t From d760474e1d0addfadabb307c86af36158791e10c Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 19:37:40 -0600 Subject: [PATCH 010/147] fix(selectrum): Move orderless/selectrum config... to be only under `use-package! orderless` --- modules/completion/selectrum/config.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index a8c5b8608..f51312e6c 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -7,13 +7,8 @@ selectrum-num-candidates-displayed 15 selectrum-extend-current-candidate-highlight t selectrum-fix-minibuffer-height t) - (when (featurep! +orderless) - - (setq completion-styles '(substring partial-completion) - selectrum-refine-candidates-function #'orderless-filter - selectrum-highlight-candidates-function #'orderless-highlight-matches)) - - + (unless (featurep! +orderless) + (setq completion-styles '(substring partial-completion))) :config (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle @@ -50,7 +45,8 @@ :config (setq completion-styles '(orderless)) (setq orderless-skip-highlighting (lambda () selectrum-active-p)) - (setq selectrum-highlight-candidates-function #'orderless-highlight-matches)) + (setq selectrum-highlight-candidates-function #'orderless-highlight-matches + selectrum-refine-candidates-function #'orderless-filter)) (use-package! consult :defer t From b4e1b2130c7cf80f2b2ea58ddf493e6e4ffad03e Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 20:16:29 -0600 Subject: [PATCH 011/147] refactor(selectrum): Move evil bindings where they belong --- modules/completion/selectrum/TODO.org | 1 + modules/completion/selectrum/config.el | 24 +---------------------- modules/config/default/+evil-bindings.el | 25 +++++++++++++++++++++++- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index fc323233e..c132710d4 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -2,3 +2,4 @@ ** TODO SPC-s-p ** TODO SPC-s-b ** TODO Start-up with recent files +** TODO Add vanilla keybindings diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index f51312e6c..e835aaa46 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -12,18 +12,7 @@ :config (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle - (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))) - - (map! - :g "C-s-r" #'selectrum-repeat - (:map selectrum-minibuffer-map - :geni "M-RET" #'selectrum-submit-exact-input - :geni "C-j" #'selectrum-next-candidate - :geni "C-S-j" #'selectrum-next-page - :geni "C-s-j" #'selectrum-goto-end - :geni "C-k" #'selectrum-previous-candidate - :geni "C-S-k" #'selectrum-previous-page - :geni "C-s-k" #'selectrum-goto-beginning))) + (when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))) (use-package! selectrum-prescient :when (featurep! +prescient) @@ -79,17 +68,6 @@ (use-package! embark :defer t :init - (map! - :g "C-s-e" #'embark-act - (:map minibuffer-local-completion-map - "C-c C-o" #'embark-export - "C-c C-c" #'embark-act-noexit) - (:map embark-file-map - :desc "Open Dired on target" :g "j" #'ffap-dired - :desc "Open target with sudo" :g "s" #'sudo-edit - :desc "Open target with vlf" :g "l" #'vlf) - (:map embark-file-map - :desc "Cycle marginalia views" :g "A" #'marginalia-cycle)) (setq embark-action-indicator (lambda (map) (which-key--show-keymap "Embark" map nil nil 'no-paging) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index fb7dedcc4..84ae69aa8 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -200,7 +200,30 @@ (:after helm-occur :map helm-occur-map [C-return] #'helm-occur-run-goto-line-ow) (:after helm-grep :map helm-grep-map - [C-return] #'helm-grep-run-other-window-action))) + [C-return] #'helm-grep-run-other-window-action)) + + (:when (featurep! :completion selectrum) + (:after selectrum + "C-s-r" #'selectrum-repeat + :map selectrum-minibuffer-map + "M-RET" #'selectrum-submit-exact-input + "C-j" #'selectrum-next-candidate + "C-S-j" #'selectrum-next-page + "C-s-j" #'selectrum-goto-end + "C-k" #'selectrum-previous-candidate + "C-S-k" #'selectrum-previous-page + "C-s-k" #'selectrum-goto-beginning) + (:after embark + "C-o" #'embark-act + :map minibuffer-local-completion-map + "C-c C-o" #'embark-export + "C-c C-c" #'embark-act-noexit + :map embark-file-map + :desc "Open Dired on target" "j" #'ffap-dired + :desc "Open target with sudo" "s" #'sudo-edit + :desc "Open target with vlf" "l" #'vlf + :map embark-file-map + :desc "Cycle marginalia views" "A" #'marginalia-cycle))) ;;; :ui (map! (:when (featurep! :ui popup) From baa5b8f3074419708ecf9eb0cb9f83a8c54d4d66 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 20:42:41 -0600 Subject: [PATCH 012/147] fix(selectrum): Use jcf +selectrum-file-search Co-authored-by: jcf --- .../selectrum/autoload/selectrum.el | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 04341135f..8cac68b0e 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -62,63 +62,56 @@ If prefix ARG is set, prompt for a directory to search from." :query STRING Determines the initial input to search for. :in PATH - Sets what directory to base the search out of. Defaults to the current - project's root. + Sets what directory to base the search out of. Defaults to the current project's root. :recursive BOOL Whether or not to search files recursively from the base directory." (declare (indent defun)) (unless (executable-find "rg") (user-error "Couldn't find ripgrep in your PATH")) (require 'consult) - (let* ((this-command 'consult-ripgrep) + (setq deactivate-mark t) + (let* ((this-command 'consult--grep) (project-root (or (doom-project-root) default-directory)) (directory (or in project-root)) - (ripgrep-command (seq-remove 'null - (append (butlast consult-ripgrep-command) - (list - (when all-files "-uu") - (unless recursive " --maxdepth 1") - "--hidden" - "-g!.git") - args - '("-e")))) (prompt (or prompt - (format "%s [%s]: " - (mapconcat #'identity ripgrep-command " ") - (cond ((equal directory default-directory) "./") - ((equal directory project-root) (projectile-project-name)) + (format "rg [%s]: " + (cond ((equal directory default-directory) + "./") + ((equal directory project-root) + (projectile-project-name)) ((file-relative-name directory project-root)))))) (query (or query (when (doom-region-active-p) (replace-regexp-in-string "[! |]" (lambda (substr) - (cond ((string= substr " ") " ") - ((string= substr "|") "\\\\\\\\|") + (cond ((and (string= substr " ") + (not (featurep! +fuzzy))) + " ") + ((string= substr "|") + "\\\\\\\\|") ((concat "\\\\" substr)))) - (rxt-quote-pcre (doom-thing-at-point-or-region)))) - " "))) - ;; (setq deactivate-mark t) + (rxt-quote-pcre (doom-thing-at-point-or-region)))))) + (ripgrep-command (format "rg %s . -e" + (string-trim + (concat (if all-files "-uu") + (unless recursive "--maxdepth 1") + "--null --line-buffered --color=always --max-columns=500 --no-heading --line-number" + " --hidden -g!.git " + (mapconcat #'shell-quote-argument args " "))) + args))) (consult--grep prompt ripgrep-command directory query))) ;;;###autoload (defun +selectrum/project-search (&optional arg initial-query directory) - "Performs 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, in the search." (interactive "P") - (+selectrum-file-search - :prompt (format "Find text on project files \[%s\]" - (if (or (and (not directory) (doom-project-root)) - (and directory (equal directory (doom-project-root)))) - (projectile-project-name) - (file-relative-name (or directory (doom-project-root) default-directory)))) - :query initial-query - :in directory - :all-files arg)) + (+selectrum-file-search :query initial-query :in directory :all-files arg)) ;;;###autoload (defun +selectrum/project-search-from-cwd (&optional arg initial-query) - "Performs a project search recursively 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." (interactive "P") (+selectrum/project-search arg initial-query default-directory)) From b741d6a3b97286ffff041d43bfdb46db5bd5921b Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 16 Feb 2021 20:53:11 -0600 Subject: [PATCH 013/147] fix(selectrum): Remove unnecessary advice overrides --- .../selectrum/autoload/selectrum.el | 48 ------------------- modules/config/default/autoload/text.el | 3 +- 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 8cac68b0e..051319ace 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -8,54 +8,6 @@ one face." (let ((orderless-match-faces [completions-common-part])) (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 (cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args) "Conduct a file search using ripgrep. diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index 056d3defd..b70848c3a 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -28,8 +28,9 @@ (interactive) (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!"))))) + ((error "No kill-ring search backend available. Enable ivy, helm or selectrum!"))))) ;;;###autoload (defun +default/yank-buffer-path (&optional root) From a23a96633bfd33388fa0a62ad714a740bf12e679 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Wed, 17 Feb 2021 16:58:08 -0600 Subject: [PATCH 014/147] Update modules/completion/selectrum/TODO.org Co-authored-by: Bruce D'Arcus --- modules/completion/selectrum/TODO.org | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index c132710d4..0b4cdeba4 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -3,3 +3,4 @@ ** TODO SPC-s-b ** TODO Start-up with recent files ** TODO Add vanilla keybindings +*** TODO Add keybinding for embark-act From 5b70b888b8a08bad977cafd98b07eb7442e19ee2 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Wed, 17 Feb 2021 11:18:15 -0600 Subject: [PATCH 015/147] feat(selectrum): Add selectrum-repeat binding --- modules/config/default/+evil-bindings.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 84ae69aa8..7d6d19211 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -313,8 +313,9 @@ :desc "Switch buffer" "<" #'switch-to-buffer) :desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer :desc "Resume last search" "'" - (cond ((featurep! :completion ivy) #'ivy-resume) - ((featurep! :completion helm) #'helm-resume)) + (cond ((featurep! :completion ivy) #'ivy-resume) + ((featurep! :completion helm) #'helm-resume) + ((featurep! :completion selectrum) #'selectrum-repeat)) :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point :desc "Search project" "/" #'+default/search-project From d47f0d6ab60825dd86b87011dfdd916f32bf0847 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Wed, 17 Feb 2021 19:41:09 -0600 Subject: [PATCH 016/147] feat(selectrum): Set window height to match ivy --- modules/completion/selectrum/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index e835aaa46..3f4b64c71 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -10,6 +10,7 @@ (unless (featurep! +orderless) (setq completion-styles '(substring partial-completion))) :config + (setq selectrum-fix-vertical-window-height 17) (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle (when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))) From 09845be083d3745cd6d3c0673ff3b82975e3604a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Apr 2021 22:11:19 +0300 Subject: [PATCH 017/147] feat(selectrum): Add Search buffer binding --- modules/config/default/+evil-bindings.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 7d6d19211..bc73462fb 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -682,7 +682,9 @@ ;;; s --- search (:prefix-map ("s" . "search") - :desc "Search buffer" "b" #'swiper + :desc "Search buffer" "b" + (cond ((featurep! :completion ivy) #'swiper) + ((featurep! :completion selectrum) #'consult-line)) :desc "Search all open buffers" "B" #'swiper-all :desc "Search current directory" "d" #'+default/search-cwd :desc "Search other directory" "D" #'+default/search-other-cwd From bc13b4a5c22b322b29c8709efb55054e2a638d96 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 18 Feb 2021 21:42:30 -0600 Subject: [PATCH 018/147] feat(selectrum): Add bookmark command --- modules/completion/selectrum/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 3f4b64c71..901640ec3 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -44,6 +44,7 @@ (fset 'multi-occur #'consult-multi-occur) (define-key! [remap apropos] #'consult-apropos + [remap bookmark-jump] #'consult-bookmark [remap goto-line] #'consult-goto-line [remap imenu] #'consult-imenu [remap switch-to-buffer] #'consult-buffer From a1293a076b1bba7111b4c03a1e54d47edde0af5d Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 18 Feb 2021 22:04:24 -0600 Subject: [PATCH 019/147] feat(selectrum): Add consult-mark --- modules/completion/selectrum/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 901640ec3..01caa3418 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -45,6 +45,7 @@ (define-key! [remap apropos] #'consult-apropos [remap bookmark-jump] #'consult-bookmark + [remap evil-show-marks] #'consult-mark [remap goto-line] #'consult-goto-line [remap imenu] #'consult-imenu [remap switch-to-buffer] #'consult-buffer From 5216ba411fa9bfb7920740ec9adfef04c677cb36 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 18 Feb 2021 22:06:00 -0600 Subject: [PATCH 020/147] style(selectrum): Alphabetize and align binds --- modules/completion/selectrum/config.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 01caa3418..3ed5133a1 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -43,19 +43,19 @@ :init (fset 'multi-occur #'consult-multi-occur) (define-key! - [remap apropos] #'consult-apropos - [remap bookmark-jump] #'consult-bookmark - [remap evil-show-marks] #'consult-mark - [remap goto-line] #'consult-goto-line - [remap imenu] #'consult-imenu - [remap switch-to-buffer] #'consult-buffer + [remap apropos] #'consult-apropos + [remap bookmark-jump] #'consult-bookmark + [remap evil-show-marks] #'consult-mark + [remap goto-line] #'consult-goto-line + [remap imenu] #'consult-imenu + [remap locate] #'consult-locate + [remap load-theme] #'consult-theme + [remap man] #'consult-man + [remap recentf-open-files] #'consult-recent-file + [remap switch-to-buffer] #'consult-buffer [remap switch-to-buffer-other-window] #'consult-buffer-other-window - [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame - [remap man] #'consult-man - [remap yank-pop] #'consult-yank-pop - [remap locate] #'consult-locate - [remap load-theme] #'consult-theme - [remap recentf-open-files] #'consult-recent-file) + [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame + [remap yank-pop] #'consult-yank-pop) :config (setq consult-project-root-function #'doom-project-root) (setq completion-in-region-function #'consult-completion-in-region) From dfce5ddb17de1cc979129d0b9b11de2ae1bce340 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 19 Feb 2021 20:48:34 -0600 Subject: [PATCH 021/147] feat(selectrum): Add +selectrum/search-symbol-at-point --- modules/completion/selectrum/autoload/selectrum.el | 5 +++++ modules/config/default/+evil-bindings.el | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 051319ace..3212f75ff 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -67,3 +67,8 @@ in the search." If ARG (universal argument), include all files, even hidden or compressed ones." (interactive "P") (+selectrum/project-search arg initial-query default-directory)) + +;;;###autoload +(defun +selectrum/search-symbol-at-point () + (interactive) + (consult-line (thing-at-point 'symbol))) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index bc73462fb..a6b33c761 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -702,7 +702,9 @@ :desc "Search other project" "P" #'+default/search-other-project :desc "Jump to mark" "r" #'evil-show-marks :desc "Search buffer" "s" #'+default/search-buffer - :desc "Search buffer for thing at point" "S" #'swiper-isearch-thing-at-point + :desc "Search buffer for thing at point" "S" + (cond ((featurep! :completion ivy) #'swiper-isearch-thing-at-point) + ((featurep! :completion selectrum) #'+selectrum/search-symbol-at-point)) :desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Thesaurus" "T" #'+lookup/synonyms) From 74b100cd547aee5c3e0b56f2597e59f580b25c27 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Sun, 21 Feb 2021 14:40:26 -0600 Subject: [PATCH 022/147] fix(selectrum): Apply changes from minad's review selectrum-fix-minibuffer-height has been deprecated. The selectrum-refine-candidates-function should not be set. Only selectrum-highlight-candidates-function is necessary in order to get highlighting, when orderless-skip-highlighting is set. Co-authored-by: minad --- modules/completion/selectrum/config.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 3ed5133a1..94494d764 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -5,8 +5,7 @@ :init (setq selectrum-display-action nil selectrum-num-candidates-displayed 15 - selectrum-extend-current-candidate-highlight t - selectrum-fix-minibuffer-height t) + selectrum-extend-current-candidate-highlight t) (unless (featurep! +orderless) (setq completion-styles '(substring partial-completion))) :config @@ -35,8 +34,7 @@ :config (setq completion-styles '(orderless)) (setq orderless-skip-highlighting (lambda () selectrum-active-p)) - (setq selectrum-highlight-candidates-function #'orderless-highlight-matches - selectrum-refine-candidates-function #'orderless-filter)) + (setq selectrum-highlight-candidates-function #'orderless-highlight-matches)) (use-package! consult :defer t From 4fb1b7ed2387e221b746e6f7f465fdda8de57de3 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Mon, 22 Feb 2021 15:47:06 -0600 Subject: [PATCH 023/147] fix(selectrum): Tear +selectrum-file-search down to consult-ripgrep --- .../selectrum/autoload/selectrum.el | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 3212f75ff..d6e1f6066 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -11,6 +11,7 @@ one face." ;;;###autoload (cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args) "Conduct a file search using ripgrep. + :query STRING Determines the initial input to search for. :in PATH @@ -22,36 +23,7 @@ one face." (user-error "Couldn't find ripgrep in your PATH")) (require 'consult) (setq deactivate-mark t) - (let* ((this-command 'consult--grep) - (project-root (or (doom-project-root) default-directory)) - (directory (or in project-root)) - (prompt (or prompt - (format "rg [%s]: " - (cond ((equal directory default-directory) - "./") - ((equal directory project-root) - (projectile-project-name)) - ((file-relative-name directory project-root)))))) - (query (or query - (when (doom-region-active-p) - (replace-regexp-in-string - "[! |]" (lambda (substr) - (cond ((and (string= substr " ") - (not (featurep! +fuzzy))) - " ") - ((string= substr "|") - "\\\\\\\\|") - ((concat "\\\\" substr)))) - (rxt-quote-pcre (doom-thing-at-point-or-region)))))) - (ripgrep-command (format "rg %s . -e" - (string-trim - (concat (if all-files "-uu") - (unless recursive "--maxdepth 1") - "--null --line-buffered --color=always --max-columns=500 --no-heading --line-number" - " --hidden -g!.git " - (mapconcat #'shell-quote-argument args " "))) - args))) - (consult--grep prompt ripgrep-command directory query))) + (consult-ripgrep)) ;;;###autoload (defun +selectrum/project-search (&optional arg initial-query directory) From da75da3ab5bfde179eba01283108c99c3622b092 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 23 Feb 2021 22:12:10 -0600 Subject: [PATCH 024/147] fix(selectrum): Revert to jethro's version of file-search Co-authored-by: jethrokuan --- .../selectrum/autoload/selectrum.el | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index d6e1f6066..d0b437e85 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -23,7 +23,37 @@ one face." (user-error "Couldn't find ripgrep in your PATH")) (require 'consult) (setq deactivate-mark t) - (consult-ripgrep)) + (let* ((this-command 'consult--grep) + (project-root (or (doom-project-root) default-directory)) + (directory (or in project-root)) + (args (split-string + (string-trim + (concat (if all-files "-uu") + (unless recursive "--maxdepth 1") + "--null --line-buffered --color=always --max-columns=500 --no-heading --line-number" + " --hidden -g!.git " + (mapconcat #'shell-quote-argument args " "))) + " ")) + (prompt (or prompt + (format "rg [%s]: " + (cond ((equal directory default-directory) + "./") + ((equal directory project-root) + (projectile-project-name)) + ((file-relative-name directory project-root)))))) + (query (or query + (when (doom-region-active-p) + (replace-regexp-in-string + "[! |]" (lambda (substr) + (cond ((and (string= substr " ") + (not (featurep! +fuzzy))) + " ") + ((string= substr "|") + "\\\\\\\\|") + ((concat "\\\\" substr)))) + (rxt-quote-pcre (doom-thing-at-point-or-region)))))) + (ripgrep-command `("rg" ,@args "." "-e"))) + (consult--grep prompt ripgrep-command directory query))) ;;;###autoload (defun +selectrum/project-search (&optional arg initial-query directory) From deed316283fe64c80468c06828e30dd5a5487f95 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Sun, 7 Mar 2021 11:41:33 -0600 Subject: [PATCH 025/147] fix(selectrum): Set max window height to 17 This mimics ivy now --- modules/completion/selectrum/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 94494d764..740a61f56 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -9,7 +9,8 @@ (unless (featurep! +orderless) (setq completion-styles '(substring partial-completion))) :config - (setq selectrum-fix-vertical-window-height 17) + (setq selectrum-fix-vertical-window-height 17 + selectrum-max-window-height 17) (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle (when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))) From 261927e9fbd0b6e8fec1d63cba12e3dc7ed53f76 Mon Sep 17 00:00:00 2001 From: Bruce D'Arcus Date: Thu, 1 Apr 2021 20:17:30 -0400 Subject: [PATCH 026/147] add orderless style dispatchers Adds style dispatchers, with the examples on the orderless README. https://github.com/oantolin/orderless#style-dispatchers --- modules/completion/selectrum/config.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 740a61f56..83ef198ba 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -24,6 +24,18 @@ (add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember) (add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember)) +(defun flex-if-twiddle (pattern _index _total) + (when (string-suffix-p "~" pattern) + `(orderless-flex . ,(substring pattern 0 -1)))) + +(defun first-initialism (pattern index _total) + (if (= index 0) 'orderless-initialism)) + +(defun without-if-bang (pattern _index _total) + "Define a '!not' exclusion prefix for literal strings." + (when (string-prefix-p "!" pattern) + `(orderless-without-literal . ,(substring pattern 1)))) + (use-package! orderless :when (featurep! +orderless) :defer t @@ -35,7 +47,10 @@ :config (setq completion-styles '(orderless)) (setq orderless-skip-highlighting (lambda () selectrum-active-p)) - (setq selectrum-highlight-candidates-function #'orderless-highlight-matches)) + (setq selectrum-highlight-candidates-function #'orderless-highlight-matches) + (setq orderless-matching-styles '(orderless-regexp) + orderless-style-dispatchers '(flex-if-twiddle + without-if-bang))) (use-package! consult :defer t From 54cf600cf559e03f5ebe1a236c9225cfbc0fabf6 Mon Sep 17 00:00:00 2001 From: Bruce D'Arcus Date: Fri, 2 Apr 2021 18:33:47 -0400 Subject: [PATCH 027/147] Bump :completion selectrum raxod502/selectrum@ad9d9f02d6 -> raxod502/selectrum@52b1129 raxod502/prescient.el@42adc802d3 -> raxod502/prescient.el@8573df9 oantolin/orderless@edce950fe1 -> oantolin/orderless@44935d8 minad/consult@1b66afd895 -> minad/consult@63f0a89 oantolin/embark@26e7311791 -> oantolin/embark@33e9af8 minad/marginalia@3e061a0fb5 -> minad/marginalia@f263745 --- modules/completion/selectrum/packages.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index f92c7f599..789b489c8 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,19 +1,19 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "ad9d9f02d6ac916cf4caa548c1967457bfc37c02") +(package! selectrum :pin "52b112954958808b064cb141b40ee9a48d14226b") (when (featurep! +prescient) - (package! selectrum-prescient :pin "42adc802d3ba6c747bed7ea1f6e3ffbbdfc7192d")) + (package! selectrum-prescient :pin "8573df977eaceffc6607b7242ff8c0dab02aad65")) (when (featurep! +orderless) - (package! orderless :pin "edce950fe1353c2284516f7b01bd37bc2d7fa136")) + (package! orderless :pin "44935d8962be5724d8a3a4358ce0a4222450ee26")) -(package! consult :pin "1b66afd8959f5ad3cf1ffbacae00d2bf0fe30008") +(package! consult :pin "63f0a893b5502c938eec87b778feb3edd380546d") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "1b66afd8959f5ad3cf1ffbacae00d2bf0fe30008")) + (package! consult-flycheck :pin "63f0a893b5502c938eec87b778feb3edd380546d")) -(package! embark :pin "26e73117910e78afa209524ecb8f07add45a9ec3") -(package! embark-consult :pin "26e73117910e78afa209524ecb8f07add45a9ec3") +(package! embark :pin "33e9af8403b22f75c01db96f39aee344de6ffaa8") +(package! embark-consult :pin "33e9af8403b22f75c01db96f39aee344de6ffaa8") -(package! marginalia :pin "3e061a0fb5305389af5b3da17092f2f09fe92c69") +(package! marginalia :pin "f26374545275cdde96d67576a43f3a919b6927cd") From 7ba1cc65ff07317dbca8fe51c2d788852decb1e2 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 5 Apr 2021 20:08:54 +0300 Subject: [PATCH 028/147] selectrum: add init.el witticism --- init.example.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.example.el b/init.example.el index 21381a1cd..74170f0f0 100644 --- a/init.example.el +++ b/init.example.el @@ -24,6 +24,7 @@ ;;helm ; the *other* search engine for love and life ;;ido ; the other *other* search engine... ivy ; a search engine for love and life + ;;selectrum ; the search engine of the future :ui ;;deft ; notational velocity for Emacs From 02d4b7d1ec60657802c202f9493606c4001eac9d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 10 Apr 2021 14:44:27 +0300 Subject: [PATCH 029/147] selectrum: add features section to README Shamelessly stolen from Ivy, still a WIP --- modules/completion/selectrum/README.org | 110 ++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 8c5f76a8c..56e7cec2e 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -8,6 +8,11 @@ - [[#module-flags][Module Flags]] - [[#plugins][Plugins]] - [[#prerequisites][Prerequisites]] +- [[#features][Features]] + - [[#jump-to-navigation][Jump-to navigation]] + - [[#project-search--replace][Project search & replace]] + - [[#in-buffer-searching][In-buffer searching]] + - [[#selectrum-integration-for-various-completing-commands][Selectrum integration for various completing commands]] * Description This module provides Selectrum integration for a variety of Emacs commands, as @@ -33,3 +38,108 @@ TODO * Prerequisites This module has no prerequisites. + +* Features + +Selectrum and friends modify and use the built-in ~completing-read~ function, +used by any function that requires completion. Due to this the full scope of +these packages is too large to cover here, so we will detail Doom-specific +additions: + +** Jump-to navigation +This module provides an interface to navigate within a project using +=projectile=: + +https://assets.doomemacs.org/completion/selectrum/projectile.png + +| Keybind | Description | +|----------------------+-------------------------------------| +| =SPC p f=, =SPC SPC= | Jump to file in project | +| =SPC f f=, =SPC .= | Jump to file from current directory | +| =SPC s i= | Jump to symbol in file | + +** Project search & replace +This module provides interactive text search and replace using ripgrep. + +| Keybind | Description | +|-----------+--------------------------| +| =SPC s p= | Search project | +| =SPC s P= | Search another project | +| =SPC s d= | Search this directory | +| =SPC s D= | Search another directory | + +https://assets.doomemacs.org/completion/selectrum/search.png + +Prefixing these keys with the universal argument (=SPC u= for evil users; =C-u= +otherwise) changes the behavior of these commands, instructing the underlying +search engine to include ignored files. + +This module also provides Ex Commands for evil users: + +| Ex command | Description | +|------------------------+------------------------------------------------------------------| +| ~:pg[rep][!] [QUERY]~ | Search project (if ~!~, include hidden files) | +| ~:pg[rep]d[!] [QUERY]~ | Search from current directory (if ~!~, don't search recursively) | + +The optional `!` is equivalent to the universal argument for the previous +commands. + +----- + +These keybindings are available while a search is active: + +| Keybind | Description | +|-----------+-----------------------------------------------| +| =C-c C-o= | Open a buffer with your search results | +| =C-c C-e= | Open a writable buffer of your search results | +| =C-SPC= | Preview the current candidate | +| =C-RET= | Open the selected candidate in other-window | + +Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed +with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil +users). + +https://assets.doomemacs.org/completion/selectrum/search-replace.png + +** TODO In-buffer searching +The =swiper= package provides an interactive buffer search powered by ivy. It +can be invoked with: + ++ =SPC s s= (~swiper-isearch~) ++ =SPC s S= (~swiper-isearch-thing-at-point~) ++ =SPC s b= (~consult-line~) ++ ~:sw[iper] [QUERY]~ + +https://assets.doomemacs.org/completion/selectrum/buffer-search.png + +A wgrep buffer can be opened from swiper with =C-c C-e=. + +** Selectrum integration for various completing commands +*** General +| Keybind | Description | +|----------------+-------------------------------| +| =M-x=, =SPC := | Enhanced M-x | +| =SPC '= | Resume last Selectrum session | + +*** Jump to files, buffers or projects +| Keybind | Description | +|----------------------+---------------------------------------| +| =SPC RET= | Find bookmark | +| =SPC f f=, =SPC .= | Browse from current directory | +| =SPC p f=, =SPC SPC= | Find file in project | +| =SPC f r= | Find recently opened file | +| =SPC p p= | Open another project | +| =SPC b b=, =SPC ,= | Switch to buffer in current workspace | +| =SPC b B=, =SPC <= | Switch to buffer | + +*** Search +| Keybind | Description | +|-----------+-------------------------------------------| +| =SPC p t= | List all TODO/FIXMEs in project | +| =SPC s b= | Search the current buffer | +| =SPC s d= | Search this directory | +| =SPC s D= | Search another directory | +| =SPC s i= | Search for symbol in current buffer | +| =SPC s p= | Search project | +| =SPC s P= | Search another project | +| =SPC s s= | Search the current buffer (incrementally) | From 8eec594ebc162a3f35ff2a448ad0191df20f75b3 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 10 Apr 2021 14:59:16 +0300 Subject: [PATCH 030/147] selectrum: update TODO.org --- modules/completion/selectrum/TODO.org | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 0b4cdeba4..f1b0c7086 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,6 +1,16 @@ -* List of things not working -** TODO SPC-s-p -** TODO SPC-s-b +* PROJ List of things not working +** TODO =SPC s p= ** TODO Start-up with recent files ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act +** TODO ~+orderless~ doesn't work +** TODO ~+prescient~ causes marginalia to not be loaded automatically. +** TODO ~+selectrum-file-search~ +* PROJ List of things needed for Ivy parity +** TODO Icons +https://github.com/minad/marginalia/issues/59 +** TODO display extra information in =SPC b b= +** TODO make backspace work in filepath searching +In ivy, backspace on =/foo/bar/!= (where =!= is the cursor) leads to =/foo/!= +In selectrum, it leads to =/foo/bar!= +** TODO =SPC s B= From d1f241479ca6b078af4173a9d4c9aa0cd74726de Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 10 Apr 2021 15:48:37 +0300 Subject: [PATCH 031/147] Bump :completion selectrum raxod502/selectrum@52b1129 -> raxod502/selectrum@9c5f142 raxod502/prescient.el@8573df9 -> raxod502/prescient.el@bf0ddeb oantolin/orderless@44935d8 -> oantolin/orderless@87ab7e4 minad/consult@63f0a89 -> minad/consult@846c715 oantolin/embark@33e9af8 -> oantolin/embark@5f30978 minad/marginalia@f263745 -> minad/marginalia@668265a --- modules/completion/selectrum/packages.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 789b489c8..25866daa6 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,19 +1,19 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "52b112954958808b064cb141b40ee9a48d14226b") +(package! selectrum :pin "9c5f142107d28868748a5801fb53ca7c5ad75fec") (when (featurep! +prescient) - (package! selectrum-prescient :pin "8573df977eaceffc6607b7242ff8c0dab02aad65")) + (package! selectrum-prescient :pin "bf0ddeb0b687e6af50ad82558bd32c17a2c0311b")) (when (featurep! +orderless) - (package! orderless :pin "44935d8962be5724d8a3a4358ce0a4222450ee26")) + (package! orderless :pin "87ab7e47e343285f7afd42779c78551332b8fd84")) -(package! consult :pin "63f0a893b5502c938eec87b778feb3edd380546d") +(package! consult :pin "846c715ee1df94292a9bb2467810bd7959ccf078") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "63f0a893b5502c938eec87b778feb3edd380546d")) + (package! consult-flycheck :pin "846c715ee1df94292a9bb2467810bd7959ccf078")) -(package! embark :pin "33e9af8403b22f75c01db96f39aee344de6ffaa8") -(package! embark-consult :pin "33e9af8403b22f75c01db96f39aee344de6ffaa8") +(package! embark :pin "5f3097824f8c3d17bcd70c4e4ce597bcfcf2196f") +(package! embark-consult :pin "5f3097824f8c3d17bcd70c4e4ce597bcfcf2196f") -(package! marginalia :pin "f26374545275cdde96d67576a43f3a919b6927cd") +(package! marginalia :pin "668265af921285c726b2239dae32459bd1064d03") From 4aaf7e571c90e001afd2f6c12aeaba50d4c562f1 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 10 Apr 2021 19:13:40 +0300 Subject: [PATCH 032/147] selectrum: fix +selectrum-file-search --- modules/completion/selectrum/TODO.org | 2 -- modules/completion/selectrum/autoload/selectrum.el | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index f1b0c7086..d7171328d 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,11 +1,9 @@ * PROJ List of things not working -** TODO =SPC s p= ** TODO Start-up with recent files ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act ** TODO ~+orderless~ doesn't work ** TODO ~+prescient~ causes marginalia to not be loaded automatically. -** TODO ~+selectrum-file-search~ * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index d0b437e85..10e04ada0 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -31,7 +31,7 @@ one face." (concat (if all-files "-uu") (unless recursive "--maxdepth 1") "--null --line-buffered --color=always --max-columns=500 --no-heading --line-number" - " --hidden -g!.git " + " --hidden -g !.git " (mapconcat #'shell-quote-argument args " "))) " ")) (prompt (or prompt @@ -52,7 +52,7 @@ one face." "\\\\\\\\|") ((concat "\\\\" substr)))) (rxt-quote-pcre (doom-thing-at-point-or-region)))))) - (ripgrep-command `("rg" ,@args "." "-e"))) + (ripgrep-command (mapconcat #'identity `("rg" ,@args "." "-e ARG OPTS" ) " "))) (consult--grep prompt ripgrep-command directory query))) ;;;###autoload From 1d43c733eaa67ff55485c47e006d1a64237b60c9 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 10 Apr 2021 19:52:38 +0300 Subject: [PATCH 033/147] selectrum: fix marginalia not loading on +prescient `:after selectrum` is unnecessary anyway --- modules/completion/selectrum/TODO.org | 1 - modules/completion/selectrum/config.el | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index d7171328d..7e9968e0c 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -3,7 +3,6 @@ ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act ** TODO ~+orderless~ doesn't work -** TODO ~+prescient~ causes marginalia to not be loaded automatically. * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 83ef198ba..01e48946d 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -92,7 +92,6 @@ embark-become-indicator embark-action-indicator)) (use-package! marginalia - :after selectrum :hook (doom-first-input . marginalia-mode) :init (setq-default marginalia-annotators '(marginalia-annotators-heavy))) From 3c551056221c59e0085ce33ab5e3a8b0e8cd6f33 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 11 Apr 2021 00:48:39 +0300 Subject: [PATCH 034/147] selectrum: annotate persp-switch-to-buffer --- modules/completion/selectrum/TODO.org | 1 - modules/completion/selectrum/config.el | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 7e9968e0c..3054bf28c 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -6,7 +6,6 @@ * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 -** TODO display extra information in =SPC b b= ** TODO make backspace work in filepath searching In ivy, backspace on =/foo/bar/!= (where =!= is the cursor) leads to =/foo/!= In selectrum, it leads to =/foo/bar!= diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 01e48946d..a22dff925 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -94,7 +94,9 @@ (use-package! marginalia :hook (doom-first-input . marginalia-mode) :init - (setq-default marginalia-annotators '(marginalia-annotators-heavy))) + (setq-default marginalia-annotators '(marginalia-annotators-heavy)) + :config + (add-to-list 'marginalia-command-categories '(persp-switch-to-buffer . buffer))) (use-package! embark-consult :after (embark consult) From 750721492c1af1ad29cbe89c8af23767cfcdb795 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 25 Apr 2021 17:10:07 +0300 Subject: [PATCH 035/147] selectrum: add consult-lsp - add `consult-lsp` to tools/lsp if the selectrum module is active - add the selectrum/consult version of workspace symbol search under `SPC c j/J` - update TODO.org --- modules/completion/selectrum/TODO.org | 2 ++ modules/completion/selectrum/packages.el | 2 ++ modules/config/default/+emacs-bindings.el | 4 +++- modules/config/default/+evil-bindings.el | 7 +++++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 3054bf28c..f0233f234 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -10,3 +10,5 @@ https://github.com/minad/marginalia/issues/59 In ivy, backspace on =/foo/bar/!= (where =!= is the cursor) leads to =/foo/!= In selectrum, it leads to =/foo/bar!= ** TODO =SPC s B= +* PROJ Other +** TODO bind =consult-lsp-diagnostics= to something? diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 25866daa6..e22ec16ad 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -12,6 +12,8 @@ (package! consult :pin "846c715ee1df94292a9bb2467810bd7959ccf078") (when (featurep! :checkers syntax) (package! consult-flycheck :pin "846c715ee1df94292a9bb2467810bd7959ccf078")) +(when (featurep! :tools lsp) + (package! consult-lsp :pin "ed3cfd2e67fc5117819c0c739814780bb4c2d716")) (package! embark :pin "5f3097824f8c3d17bcd70c4e4ce597bcfcf2196f") (package! embark-consult :pin "5f3097824f8c3d17bcd70c4e4ce597bcfcf2196f") diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index d88ca6268..39807c336 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -54,13 +54,15 @@ (:when (featurep! :completion helm) :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) + (:when (featurep! :completion selectrum) + :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols + :desc "Jump to symbol in any workspace" "J" (cmd! #'consult-lsp-symbols '(4))) (:when (featurep! :ui treemacs +lsp) :desc "Errors list" "X" #'lsp-treemacs-errors-list :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) :desc "Symbols" "S" #'lsp-treemacs-symbols)) - (:when (featurep! :tools lsp +eglot) :desc "LSP Execute code action" "a" #'eglot-code-actions :desc "LSP Rename" "r" #'eglot-rename diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index a6b33c761..3c4e85040 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -393,14 +393,17 @@ (:when (featurep! :completion helm) :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) + (:when (featurep! :completion selectrum) + :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols + :desc "Jump to symbol in any workspace" "J" (cmd! #'consult-lsp-symbols '(4))) (:when (featurep! :ui treemacs +lsp) :desc "Errors list" "X" #'lsp-treemacs-errors-list :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) :desc "Symbols" "S" #'lsp-treemacs-symbols) - :desc "LSP" "l" #'+default/lsp-command-map - :desc "LSP Rename" "r" #'lsp-rename) + :desc "LSP" "l" #'+default/lsp-command-map + :desc "LSP Rename" "r" #'lsp-rename) (:when (featurep! :tools lsp +eglot) :desc "LSP Execute code action" "a" #'eglot-code-actions :desc "LSP Rename" "r" #'eglot-rename From 93008e178491e9930de93fb6524e12ee112954c4 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 25 Apr 2021 17:46:18 +0300 Subject: [PATCH 036/147] Bump :completion selectrum raxod502/selectrum@9c5f142 -> raxod502/selectrum@093f7e9 raxod502/prescient.el@bf0ddeb -> raxod502/prescient.el@ed2b762 minad/consult@846c715 -> minad/consult@e04a404 oantolin/embark@5f30978 -> oantolin/embark@4d7e8e4 minad/marginalia@668265a -> minad/marginalia@5159256 --- modules/completion/selectrum/packages.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index e22ec16ad..690d6cb97 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,21 +1,21 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "9c5f142107d28868748a5801fb53ca7c5ad75fec") +(package! selectrum :pin "093f7e96a323179ee2a68a5a674e7fa2c5d721b8") (when (featurep! +prescient) - (package! selectrum-prescient :pin "bf0ddeb0b687e6af50ad82558bd32c17a2c0311b")) + (package! selectrum-prescient :pin "ed2b762241bbea03e374dc9dcd4fbe207c6b2ea4")) (when (featurep! +orderless) (package! orderless :pin "87ab7e47e343285f7afd42779c78551332b8fd84")) -(package! consult :pin "846c715ee1df94292a9bb2467810bd7959ccf078") +(package! consult :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "846c715ee1df94292a9bb2467810bd7959ccf078")) + (package! consult-flycheck :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31")) (when (featurep! :tools lsp) (package! consult-lsp :pin "ed3cfd2e67fc5117819c0c739814780bb4c2d716")) -(package! embark :pin "5f3097824f8c3d17bcd70c4e4ce597bcfcf2196f") -(package! embark-consult :pin "5f3097824f8c3d17bcd70c4e4ce597bcfcf2196f") +(package! embark :pin "4d7e8e4d3be7aaff56730f76a066db2acad65371") +(package! embark-consult :pin "4d7e8e4d3be7aaff56730f76a066db2acad65371") -(package! marginalia :pin "668265af921285c726b2239dae32459bd1064d03") +(package! marginalia :pin "5159256d04d123899b88ee6e7eba0c27f66d0fe2") From 1b74d822c3124b5097e7d230788142d594057c5f Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 25 Apr 2021 18:32:47 +0300 Subject: [PATCH 037/147] selectrum: orderless now works --- modules/completion/selectrum/TODO.org | 1 - modules/completion/selectrum/config.el | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index f0233f234..c3fcc8a7d 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -2,7 +2,6 @@ ** TODO Start-up with recent files ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act -** TODO ~+orderless~ doesn't work * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index a22dff925..5667faf03 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -38,7 +38,7 @@ (use-package! orderless :when (featurep! +orderless) - :defer t + :after selectrum :init (setq orderless-component-separator "[ &]" orderless-matching-styles '(orderless-prefixes @@ -47,6 +47,7 @@ :config (setq completion-styles '(orderless)) (setq orderless-skip-highlighting (lambda () selectrum-active-p)) + (setq selectrum-refine-candidates-function #'orderless-filter) (setq selectrum-highlight-candidates-function #'orderless-highlight-matches) (setq orderless-matching-styles '(orderless-regexp) orderless-style-dispatchers '(flex-if-twiddle From dc5442f78f1a940c44cd12c5124833530853764e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 25 Apr 2021 21:08:13 +0300 Subject: [PATCH 038/147] selectrum: consult-recent-files now works on startup consult doesn't turn on refentf-mode by itself, you need to do it manually. It works, but is very slow on first try. --- modules/completion/selectrum/TODO.org | 5 ++++- modules/completion/selectrum/config.el | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index c3fcc8a7d..6cd1a1036 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,5 +1,8 @@ * PROJ List of things not working -** TODO Start-up with recent files +** TODO Functions very slow on startup: +- =consult-recent-files= +- =consult-bookmark= +Probably due to live preview, but gets much faster on subsequent calls. ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act * PROJ List of things needed for Ivy parity diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 5667faf03..626a91952 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -72,6 +72,7 @@ [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame [remap yank-pop] #'consult-yank-pop) :config + (recentf-mode) (setq consult-project-root-function #'doom-project-root) (setq completion-in-region-function #'consult-completion-in-region) (setq consult-narrow-key "<") From 55e4afa77fc268595f592f267d535ca5139803c3 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 25 Apr 2021 21:36:21 +0300 Subject: [PATCH 039/147] selectrum: update TODO.org --- modules/completion/selectrum/TODO.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 6cd1a1036..a9c98ff32 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -5,6 +5,9 @@ Probably due to live preview, but gets much faster on subsequent calls. ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act +** TODO =SPC s s= and =SPC s S= ~:sw~ +There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ +does something else (give you previously used isearch search terms). * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 @@ -12,5 +15,6 @@ https://github.com/minad/marginalia/issues/59 In ivy, backspace on =/foo/bar/!= (where =!= is the cursor) leads to =/foo/!= In selectrum, it leads to =/foo/bar!= ** TODO =SPC s B= +** TODO ~:pg~ support * PROJ Other ** TODO bind =consult-lsp-diagnostics= to something? From 0cdc7ec8e1527eb8cfc5d4c70aabc7574d923a6e Mon Sep 17 00:00:00 2001 From: Sebastian Sturm Date: Tue, 27 Apr 2021 22:34:12 +0200 Subject: [PATCH 040/147] Add selectrum branch for SPC-* symbol search other +default/search-... convenience methods already support Selectrum explicitly, so perhaps there's a good reason not to do the same for +default/search-project-for-symbol-at-point? --- modules/config/default/autoload/search.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/config/default/autoload/search.el b/modules/config/default/autoload/search.el index 766d2b744..899099fda 100644 --- a/modules/config/default/autoload/search.el +++ b/modules/config/default/autoload/search.el @@ -75,6 +75,8 @@ If prefix ARG is set, prompt for a known project to search from." (+ivy/project-search nil symbol)) ((featurep! :completion helm) (+helm/project-search nil symbol)) + ((featurep! :completion selectrum) + (+selectrum/project-search nil symbol)) ((rgrep (regexp-quote symbol)))))) ;;;###autoload From a51c03900bf5e18c6649662e34d802c60f229cb0 Mon Sep 17 00:00:00 2001 From: Sebastian Sturm Date: Tue, 27 Apr 2021 22:39:36 +0200 Subject: [PATCH 041/147] Set up consult-xref if selectrum is enabled --- modules/completion/selectrum/config.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 626a91952..ded4d573d 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -80,6 +80,12 @@ (setq consult-async-input-debounce 0.5) (setq consult-async-input-throttle 0.8)) +(use-package! consult-xref + :defer t + :init + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref)) + (use-package! consult-flycheck :when (featurep! :checkers syntax) :after (consult flycheck)) From 2cae7455fda00ba645faad194edccb66740648bd Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 27 Apr 2021 02:45:07 +0300 Subject: [PATCH 042/147] selectrum: deactivate slow consult previews deactivate previews for: - consult-bookmark - consult-recentf-file --- modules/completion/selectrum/TODO.org | 2 +- modules/completion/selectrum/config.el | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index a9c98ff32..c72a42b46 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -2,7 +2,7 @@ ** TODO Functions very slow on startup: - =consult-recent-files= - =consult-bookmark= -Probably due to live preview, but gets much faster on subsequent calls. +preview deactivated for now (see consult use-package) ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act ** TODO =SPC s s= and =SPC s S= ~:sw~ diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index ded4d573d..85057034a 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -76,6 +76,8 @@ (setq consult-project-root-function #'doom-project-root) (setq completion-in-region-function #'consult-completion-in-region) (setq consult-narrow-key "<") + (setf (alist-get #'consult-bookmark consult-config) (list :preview-key nil)) + (setf (alist-get #'consult-recent-file consult-config) (list :preview-key nil)) (setq consult-line-numbers-widen t) (setq consult-async-input-debounce 0.5) (setq consult-async-input-throttle 0.8)) From 7e51f98b3f26283ee2b273c2dc1997f2fe8b5f2d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 27 Apr 2021 02:49:47 +0300 Subject: [PATCH 043/147] selectrum: add C-SPC binding (half works) --- modules/completion/selectrum/TODO.org | 4 ++++ modules/completion/selectrum/config.el | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index c72a42b46..d77362a4e 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -8,6 +8,10 @@ preview deactivated for now (see consult use-package) ** TODO =SPC s s= and =SPC s S= ~:sw~ There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). +** TODO fix C-SPC +currently after executing the action it: +- moves the cursor to the new window if created, might not be desired in all cases +- for some reason opens buffers in a new window (might be upstream bug?) * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 85057034a..a6f28bd85 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -99,7 +99,10 @@ (lambda (map) (which-key--show-keymap "Embark" map nil nil 'no-paging) #'which-key--hide-popup-ignore-command) - embark-become-indicator embark-action-indicator)) + embark-become-indicator embark-action-indicator) + :config + (let ((embark-quit-after-action nil)) + (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) (use-package! marginalia :hook (doom-first-input . marginalia-mode) From a3c978ba365103c62b9285f6b41d30fcfe378593 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 28 Apr 2021 23:07:22 +0300 Subject: [PATCH 044/147] selectrum: add bibtex-actions to tools/biblio --- modules/completion/selectrum/TODO.org | 2 ++ modules/tools/biblio/config.el | 7 +++++++ modules/tools/biblio/packages.el | 2 ++ 3 files changed, 11 insertions(+) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index d77362a4e..64b1d82a0 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -22,3 +22,5 @@ In selectrum, it leads to =/foo/bar!= ** TODO ~:pg~ support * PROJ Other ** TODO bind =consult-lsp-diagnostics= to something? +** TODO test out bibtex-actions, check if more configuration should be added +https://github.com/bdarcus/bibtex-actions diff --git a/modules/tools/biblio/config.el b/modules/tools/biblio/config.el index 936370c6d..7f1fa22b7 100644 --- a/modules/tools/biblio/config.el +++ b/modules/tools/biblio/config.el @@ -12,3 +12,10 @@ :defer t :config (add-to-list 'ivy-re-builders-alist '(ivy-bibtex . ivy--regex-plus))) + + +(use-package! bibtex-actions + :when (featurep! :completion selectrum) + :defer t + :config + (add-to-list 'embark-keymap-alist '(bibtex . bibtex-actions-map))) diff --git a/modules/tools/biblio/packages.el b/modules/tools/biblio/packages.el index a9b7165ab..223243059 100644 --- a/modules/tools/biblio/packages.el +++ b/modules/tools/biblio/packages.el @@ -6,3 +6,5 @@ (package! ivy-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) (when (featurep! :completion helm) (package! helm-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) +(when (featurep! :completion selectrum) + (package! bibtex-actions :pin "743f548c0cd46e3418a7ca4736bde8c86f97c073")) From b9e34835c71684974ad8249b1e6a4e7c7701b723 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 29 Apr 2021 12:32:04 +0300 Subject: [PATCH 045/147] selectrum: update bindings --- modules/completion/selectrum/config.el | 15 +++++++++++++-- modules/config/default/+emacs-bindings.el | 2 ++ modules/config/default/+evil-bindings.el | 14 +------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index a6f28bd85..9a027c7c5 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -13,7 +13,10 @@ selectrum-max-window-height 17) (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle - (when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))) + (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))) + (map! :map selectrum-minibuffer-map + "C-o" #'embark-act + "C-c C-o" #'embark-export)) (use-package! selectrum-prescient :when (featurep! +prescient) @@ -70,7 +73,8 @@ [remap switch-to-buffer] #'consult-buffer [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 yank-pop] #'consult-yank-pop + [remap describe-bindings] #'embark-bindings) :config (recentf-mode) (setq consult-project-root-function #'doom-project-root) @@ -101,6 +105,13 @@ #'which-key--hide-popup-ignore-command) embark-become-indicator embark-action-indicator) :config + (map! + :map embark-file-map + :desc "Open Dired on target" "j" #'ffap-dired + :desc "Open target with sudo" "s" #'sudo-edit + :desc "Open target with vlf" "l" #'vlf + :map embark-file-map + :desc "Cycle marginalia views" "A" #'marginalia-cycle ) (let ((embark-quit-after-action nil)) (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index 39807c336..1d23d90ea 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -452,6 +452,8 @@ (:when (featurep! :completion helm) "C-S-s" #'swiper-helm "C-S-r" #'helm-resume) + (:when (featurep! :completion selectrum) + "C-S-r" #'selectrum-repeat) ;;; objed (:when (featurep! :editor objed +manual) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 3c4e85040..945c5b8c1 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -204,7 +204,6 @@ (:when (featurep! :completion selectrum) (:after selectrum - "C-s-r" #'selectrum-repeat :map selectrum-minibuffer-map "M-RET" #'selectrum-submit-exact-input "C-j" #'selectrum-next-candidate @@ -212,18 +211,7 @@ "C-s-j" #'selectrum-goto-end "C-k" #'selectrum-previous-candidate "C-S-k" #'selectrum-previous-page - "C-s-k" #'selectrum-goto-beginning) - (:after embark - "C-o" #'embark-act - :map minibuffer-local-completion-map - "C-c C-o" #'embark-export - "C-c C-c" #'embark-act-noexit - :map embark-file-map - :desc "Open Dired on target" "j" #'ffap-dired - :desc "Open target with sudo" "s" #'sudo-edit - :desc "Open target with vlf" "l" #'vlf - :map embark-file-map - :desc "Cycle marginalia views" "A" #'marginalia-cycle))) + "C-s-k" #'selectrum-goto-beginning))) ;;; :ui (map! (:when (featurep! :ui popup) From 8e6371760a32726fb7056eaa421e178631d1bb0b Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 29 Apr 2021 12:43:16 +0300 Subject: [PATCH 046/147] selectrum: add spellcheck support --- modules/checkers/spell/README.org | 2 +- modules/checkers/spell/autoload/+spell-fu.el | 3 ++- modules/checkers/spell/config.el | 3 ++- modules/checkers/spell/packages.el | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/checkers/spell/README.org b/modules/checkers/spell/README.org index 5312c8d59..f8eea996f 100644 --- a/modules/checkers/spell/README.org +++ b/modules/checkers/spell/README.org @@ -46,7 +46,7 @@ This module has no dedicated maintainers. + [[https://github.com/d12frosted/flyspell-correct][flyspell-correct]] + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-ivy-interface][flyspell-correct-ivy]] (=completion/ivy=) + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-helm-interface][flyspell-correct-helm]] (=completion/helm=) - + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy= or =completion/helm=) + + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy=, =completion/helm= or =completion/selectrum=) + [[https://github.com/rolandwalker/flyspell-lazy][flyspell-lazy]] + else + [[https://gitlab.com/ideasman42/emacs-spell-fu][spell-fu]] diff --git a/modules/checkers/spell/autoload/+spell-fu.el b/modules/checkers/spell/autoload/+spell-fu.el index d90eeeebe..4bddacf8e 100644 --- a/modules/checkers/spell/autoload/+spell-fu.el +++ b/modules/checkers/spell/autoload/+spell-fu.el @@ -62,7 +62,8 @@ (save-current-buffer (ispell-accept-buffer-local-defs)) (if (not (or (featurep! :completion ivy) - (featurep! :completion helm))) + (featurep! :completion helm) + (featurep! :completion selectrum))) (call-interactively #'ispell-word) (cl-destructuring-bind (start . end) (or (bounds-of-thing-at-point 'word) diff --git a/modules/checkers/spell/config.el b/modules/checkers/spell/config.el index aaf5cf4c1..17dc1983e 100644 --- a/modules/checkers/spell/config.el +++ b/modules/checkers/spell/config.el @@ -234,7 +234,8 @@ e.g. proselint and langtool." (require 'flyspell-correct-helm nil t))) ((and (featurep! :completion ivy) (require 'flyspell-correct-ivy nil t))) - ((require 'flyspell-correct-popup nil t) + ((featurep! :completion selectrum)) ; selectrum doesn't need any extra configuration + ((require 'flyspell-correct-popup nil t) ; only use popup if no compatible completion UI is enabled (setq flyspell-popup-correct-delay 0.8) (define-key popup-menu-keymap [escape] #'keyboard-quit)))) diff --git a/modules/checkers/spell/packages.el b/modules/checkers/spell/packages.el index 5917b8d35..359e7a710 100644 --- a/modules/checkers/spell/packages.el +++ b/modules/checkers/spell/packages.el @@ -8,5 +8,6 @@ (package! flyspell-correct-ivy)) ((featurep! :completion helm) (package! flyspell-correct-helm)) - ((package! flyspell-correct-popup))) + ((not (featurep! :completion selectrum)) + (package! flyspell-correct-popup))) (package! flyspell-lazy :pin "0fc5996bcee20b46cbd227ae948d343c3bef7339")) From 0e9864d3083f1fa72143407bd1655083508f3751 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 29 Apr 2021 14:32:02 +0300 Subject: [PATCH 047/147] selectrum: fix project switching with workspaces Replicates ivy behavior of opening file in the new workspace --- modules/ui/workspaces/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ui/workspaces/config.el b/modules/ui/workspaces/config.el index 3ecf9d6b1..2caa13b7b 100644 --- a/modules/ui/workspaces/config.el +++ b/modules/ui/workspaces/config.el @@ -185,7 +185,8 @@ stored in `persp-save-dir'.") (add-hook 'server-done-hook #'+workspaces-delete-associated-workspace-h) ;; per-project workspaces, but reuse current workspace if empty - (setq projectile-switch-project-action #'+workspaces-set-project-action-fn + ;; HACK?? needs review + (setq projectile-switch-project-action (lambda () (+workspaces-set-project-action-fn) (+workspaces-switch-to-project-h)) counsel-projectile-switch-project-action '(1 ("o" +workspaces-switch-to-project-h "open project in new workspace") ("O" counsel-projectile-switch-project-action "jump to a project buffer or file") From e8dc511c74dfa7991c929ec09c31b584a12efb30 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 29 Apr 2021 21:40:43 +0300 Subject: [PATCH 048/147] selectrum: move consult-lsp to :tools lsp where it belongs --- modules/completion/selectrum/packages.el | 2 -- modules/tools/lsp/packages.el | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 690d6cb97..aa525443e 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -12,8 +12,6 @@ (package! consult :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31") (when (featurep! :checkers syntax) (package! consult-flycheck :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31")) -(when (featurep! :tools lsp) - (package! consult-lsp :pin "ed3cfd2e67fc5117819c0c739814780bb4c2d716")) (package! embark :pin "4d7e8e4d3be7aaff56730f76a066db2acad65371") (package! embark-consult :pin "4d7e8e4d3be7aaff56730f76a066db2acad65371") diff --git a/modules/tools/lsp/packages.el b/modules/tools/lsp/packages.el index 3e6288229..500ef029f 100644 --- a/modules/tools/lsp/packages.el +++ b/modules/tools/lsp/packages.el @@ -8,4 +8,6 @@ (when (featurep! :completion ivy) (package! lsp-ivy :pin "bccd86028e669f5a1cad78364775fe7a0741ff93")) (when (featurep! :completion helm) - (package! helm-lsp :pin "c2c6974dadfac459b1a69a1217441283874cea92"))) + (package! helm-lsp :pin "c2c6974dadfac459b1a69a1217441283874cea92")) + (when (featurep! :completion selectrum) + (package! consult-lsp :pin "ed3cfd2e67fc5117819c0c739814780bb4c2d716"))) From 7ec71349479ae3765724ee13accf24f71af68182 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 29 Apr 2021 21:46:48 +0300 Subject: [PATCH 049/147] selectrum: improve ivy parity - add `:pg` bindings - add `selectrum-minibuffer-map` to `+default-minibuffer-maps` - add `consult-notmuch` - add selectrum option for `mu4e-completing-read-function` - document more parity failings --- modules/completion/selectrum/TODO.org | 10 +++++++++- modules/completion/selectrum/autoload/evil.el | 14 ++++++++++++++ modules/config/default/config.el | 4 +++- modules/editor/evil/+commands.el | 5 ++++- modules/email/mu4e/config.el | 7 ++++--- modules/email/notmuch/config.el | 6 ++++++ modules/email/notmuch/packages.el | 2 ++ 7 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 modules/completion/selectrum/autoload/evil.el diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 64b1d82a0..c5a91a98d 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -19,7 +19,15 @@ https://github.com/minad/marginalia/issues/59 In ivy, backspace on =/foo/bar/!= (where =!= is the cursor) leads to =/foo/!= In selectrum, it leads to =/foo/bar!= ** TODO =SPC s B= -** TODO ~:pg~ support +** TODO modules to look over +- lookup +- taskrunner (doesn't seem to be an interface yet) +- pass (creating embark-pass can't be that hard) +- irc +- org (check, might be fine) +- counsel-minibuffer-history analogue +- counsel-company analogue +- bibtex * PROJ Other ** TODO bind =consult-lsp-diagnostics= to something? ** TODO test out bibtex-actions, check if more configuration should be added diff --git a/modules/completion/selectrum/autoload/evil.el b/modules/completion/selectrum/autoload/evil.el new file mode 100644 index 000000000..048444458 --- /dev/null +++ b/modules/completion/selectrum/autoload/evil.el @@ -0,0 +1,14 @@ +;; completion/selectrum/autoload/evil.el -*- lexical-binding: t; -*- +;;;###if (featurep! :editor evil) + +;;;###autoload (autoload '+selectrum:project-search "completion/ivy/autoload/evil" nil t) +(evil-define-command +selectrum:project-search (query &optional all-files-p) + "Ex interface for `+selectrum/project-search'." + (interactive "") + (+selectrum/project-search all-files-p query)) + +;;;###autoload (autoload '+selectrum:project-search-from-cwd "completion/ivy/autoload/evil" nil t) +(evil-define-command +selectrum:project-search-from-cwd (query &optional recurse-p) + "Ex interface for `+selectrum/project-search-from-cwd'." + (interactive "") + (+selectrum/project-search-from-cwd (not recurse-p) query)) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 215b52e70..618fcef13 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -16,7 +16,9 @@ ((featurep! :completion helm) '(helm-map helm-rg-map - helm-read-file-map)))) + helm-read-file-map)) + ((featurep! :completion selectrum) + '(selectrum-minibuffer-map)))) "A list of all the keymaps used for the minibuffer.") diff --git a/modules/editor/evil/+commands.el b/modules/editor/evil/+commands.el index f7063a26f..e667823ca 100644 --- a/modules/editor/evil/+commands.el +++ b/modules/editor/evil/+commands.el @@ -68,7 +68,10 @@ ((featurep! :completion helm) (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 selectrum) + (evil-ex-define-cmd "pg[rep]" #'+selectrum:project-search) + (evil-ex-define-cmd "pg[grep]d" #'+selectrum:project-search-from-cwd))) ;;; Project tools (evil-ex-define-cmd "com[pile]" #'+evil:compile) diff --git a/modules/email/mu4e/config.el b/modules/email/mu4e/config.el index a736d3e19..274bcc24e 100644 --- a/modules/email/mu4e/config.el +++ b/modules/email/mu4e/config.el @@ -42,10 +42,11 @@ mu4e-context-policy 'pick-first ;; compose with the current context, or ask mu4e-compose-context-policy 'ask-if-none - ;; use helm/ivy + ;; use helm/ivy/selectrum mu4e-completing-read-function - (cond ((featurep! :completion ivy) #'ivy-completing-read) - ((featurep! :completion helm) #'completing-read) + (cond ((featurep! :completion ivy) #'ivy-completing-read) + ((featurep! :completion helm) #'completing-read) + ((featurep! :completion selectrum) #'completing-read) (t #'ido-completing-read)) ;; no need to ask mu4e-confirm-quit nil diff --git a/modules/email/notmuch/config.el b/modules/email/notmuch/config.el index 34ec3f90d..f99fb7ac6 100644 --- a/modules/email/notmuch/config.el +++ b/modules/email/notmuch/config.el @@ -103,3 +103,9 @@ OR a shell command string such as :when (featurep! :completion helm) :commands helm-notmuch :after notmuch) + + +(use-package! consult-notmuch + :when (featurep! :completion selectrum) + :commands consult-notmuch + :after notmuch) diff --git a/modules/email/notmuch/packages.el b/modules/email/notmuch/packages.el index 8da851ba7..7c699b80c 100644 --- a/modules/email/notmuch/packages.el +++ b/modules/email/notmuch/packages.el @@ -8,3 +8,5 @@ (package! counsel-notmuch :pin "a4a1562935e4180c42524c51609d1283e9be0688")) (when (featurep! :completion helm) (package! helm-notmuch :pin "97a01497e079a7b6505987e9feba6b603bbec288")) +(when (featurep! :completion selectrum) + (package! consult-notmuch :pin "67cf219fcce211237347a783ce6982402341d5fd")) From ff9a15e683a30a0275cc061a556fdbc45c96236a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 30 Apr 2021 00:19:38 +0300 Subject: [PATCH 050/147] selectrum: rework live-previews - for the slow consult functions it's bound to `C-SPC` - for the rest of them the current approach wasn't working out great so it's removed for the time being. --- modules/completion/selectrum/TODO.org | 18 ++++++++++-------- modules/completion/selectrum/config.el | 9 ++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index c5a91a98d..8849b490d 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,17 +1,18 @@ * PROJ List of things not working -** TODO Functions very slow on startup: -- =consult-recent-files= -- =consult-bookmark= -preview deactivated for now (see consult use-package) ** TODO Add vanilla keybindings *** TODO Add keybinding for embark-act ** TODO =SPC s s= and =SPC s S= ~:sw~ There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). -** TODO fix C-SPC -currently after executing the action it: -- moves the cursor to the new window if created, might not be desired in all cases -- for some reason opens buffers in a new window (might be upstream bug?) +** TODO =C-SPC= and live previews +Automatic live previews have been globally disabled for speed purposes. +=C-SPC= is partially implemented with the preview key for ~consult-*~ commands. +Need to get it to work for other selectrum commands such =SPC h f=. +#+begin_src emacs-lisp + (let ((embark-quit-after-action nil)) + (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) +#+end_src +gets us close but moves the cursor to the new screen which is undesirable. * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 @@ -32,3 +33,4 @@ In selectrum, it leads to =/foo/bar!= ** TODO bind =consult-lsp-diagnostics= to something? ** TODO test out bibtex-actions, check if more configuration should be added https://github.com/bdarcus/bibtex-actions + . diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 9a027c7c5..72328fb58 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -80,8 +80,9 @@ (setq consult-project-root-function #'doom-project-root) (setq completion-in-region-function #'consult-completion-in-region) (setq consult-narrow-key "<") - (setf (alist-get #'consult-bookmark consult-config) (list :preview-key nil)) - (setf (alist-get #'consult-recent-file consult-config) (list :preview-key nil)) + (setf (alist-get #'consult-bookmark consult-config) (list :preview-key (kbd "C-SPC"))) + (setf (alist-get #'consult-recent-file consult-config) (list :preview-key (kbd "C-SPC"))) + (setf (alist-get #'consult--grep consult-config) (list :preview-key (kbd "C-SPC"))) (setq consult-line-numbers-widen t) (setq consult-async-input-debounce 0.5) (setq consult-async-input-throttle 0.8)) @@ -111,9 +112,7 @@ :desc "Open target with sudo" "s" #'sudo-edit :desc "Open target with vlf" "l" #'vlf :map embark-file-map - :desc "Cycle marginalia views" "A" #'marginalia-cycle ) - (let ((embark-quit-after-action nil)) - (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) + :desc "Cycle marginalia views" "A" #'marginalia-cycle)) (use-package! marginalia :hook (doom-first-input . marginalia-mode) From f532bfe34b049a09bcd61f9bdd9d95d77fd4be35 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 30 Apr 2021 01:23:37 +0300 Subject: [PATCH 051/147] selectrum: document embark-act binding Also add `C-c C-e` TODO --- modules/completion/selectrum/README.org | 13 +++++++------ modules/completion/selectrum/TODO.org | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 56e7cec2e..5bfae6993 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -88,12 +88,13 @@ commands. These keybindings are available while a search is active: -| Keybind | Description | -|-----------+-----------------------------------------------| -| =C-c C-o= | Open a buffer with your search results | -| =C-c C-e= | Open a writable buffer of your search results | -| =C-SPC= | Preview the current candidate | -| =C-RET= | Open the selected candidate in other-window | +| Keybind | Description | +|-----------+----------------------------------------------------| +| =C-o= | Open an ~embark-act~ menu to chose a useful action | +| =C-c C-o= | Open a buffer with your search results | +| =C-c C-e= | Open a writable buffer of your search results | +| =C-SPC= | Preview the current candidate | +| =C-RET= | Open the selected candidate in other-window | Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 8849b490d..0e1f6ca5c 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -13,6 +13,7 @@ Need to get it to work for other selectrum commands such =SPC h f=. (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) #+end_src gets us close but moves the cursor to the new screen which is undesirable. +** TODO =C-C C-e= wgrep fun * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 From 19c07444e740661a56cf56e85ae78dcb88de1c80 Mon Sep 17 00:00:00 2001 From: James Conroy-Finn Date: Fri, 16 Apr 2021 10:36:03 +0100 Subject: [PATCH 052/147] selectrum: Replace obsolete selectrum-active-p https://github.com/raxod502/selectrum/pull/521 --- modules/completion/selectrum/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 72328fb58..2a0b4fac7 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -49,7 +49,7 @@ orderless-regexp)) :config (setq completion-styles '(orderless)) - (setq orderless-skip-highlighting (lambda () selectrum-active-p)) + (setq orderless-skip-highlighting (lambda () selectrum-is-active)) (setq selectrum-refine-candidates-function #'orderless-filter) (setq selectrum-highlight-candidates-function #'orderless-highlight-matches) (setq orderless-matching-styles '(orderless-regexp) From e18131888539be0678f215169751615e7769ee68 Mon Sep 17 00:00:00 2001 From: Gerry Agbobada <10496163+gagbo@users.noreply.github.com> Date: Sat, 1 May 2021 12:16:06 +0200 Subject: [PATCH 053/147] Setup consult as completion-in-region fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows `corfu` users to enable corfu and let it noop when _not_ using a graphical display. Having the function setup in `init` means company can properly override it when it’s activated later. --- modules/completion/selectrum/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 2a0b4fac7..e48e37004 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -75,6 +75,7 @@ [remap switch-to-buffer-other-frame] #'consult-buffer-other-frame [remap yank-pop] #'consult-yank-pop [remap describe-bindings] #'embark-bindings) + (setq completion-in-region-function #'consult-completion-in-region) :config (recentf-mode) (setq consult-project-root-function #'doom-project-root) From 6dfc32441d3dc274aa347eb490deb52306b91813 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 1 May 2021 13:58:02 +0300 Subject: [PATCH 054/147] selectrum: improve file category commands... now when pressing backspace on `/`, the input will go up one directory. --- modules/completion/selectrum/TODO.org | 3 --- modules/completion/selectrum/config.el | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 0e1f6ca5c..555635ac0 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -17,9 +17,6 @@ gets us close but moves the cursor to the new screen which is undesirable. * PROJ List of things needed for Ivy parity ** TODO Icons https://github.com/minad/marginalia/issues/59 -** TODO make backspace work in filepath searching -In ivy, backspace on =/foo/bar/!= (where =!= is the cursor) leads to =/foo/!= -In selectrum, it leads to =/foo/bar!= ** TODO =SPC s B= ** TODO modules to look over - lookup diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index e48e37004..3e7ec61b5 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -14,9 +14,24 @@ (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))) + + (defun +selectrum/backward-updir () + "Delete char before or go up directory for file cagetory selectrum buffers." + (interactive) + (if (and (eq (char-before) ?/) + (eq (selectrum--get-meta 'category) 'file)) + (let ((new-path (minibuffer-contents))) + (delete-region (minibuffer-prompt-end) (point-max)) + (insert (abbreviate-file-name + (file-name-directory + (directory-file-name + (expand-file-name new-path)))))) + (call-interactively 'backward-delete-char))) + (map! :map selectrum-minibuffer-map - "C-o" #'embark-act - "C-c C-o" #'embark-export)) + "C-o" #'embark-act + "C-c C-o" #'embark-export + [backspace] #'+selectrum/backward-updir)) (use-package! selectrum-prescient :when (featurep! +prescient) From c1cbfa03f70b09e5f37177f6fb06cb356e65f2c3 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 1 May 2021 14:38:54 +0300 Subject: [PATCH 055/147] selectrum: use orderless by default --- modules/completion/selectrum/README.org | 8 ++++---- modules/completion/selectrum/config.el | 4 ++-- modules/completion/selectrum/packages.el | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 5bfae6993..eb641c518 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -23,8 +23,8 @@ TODO #+end_quote ** Module Flags -+ ~+prescient~ Enables prescient filtering and sorting for Selectrum searches. -+ ~+orderless~ Enables orderless filtering for Selectrum searches. ++ ~+prescient~ Enables prescient filtering and sorting for Selectrum searches + instead of orderless. ** Plugins [[https://github.com/raxod502/selectrum][selectrum]] @@ -32,8 +32,8 @@ TODO [[https://github.com/oantolin/embark/][embark]] [[https://github.com/oantolin/embark/][embark-consult]] [[https://github.com/minad/marginalia][marginalia]] -[[https://github.com/raxod502/prescient.el][prescient]]* (~+prescient~) -[[https://github.com/oantolin/orderless][orderless]]* (~+orderless~) +[[https://github.com/oantolin/orderless][orderless]] (unless ~+prescient~) +[[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~) [[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) * Prerequisites diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 3e7ec61b5..065711130 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -6,7 +6,7 @@ (setq selectrum-display-action nil selectrum-num-candidates-displayed 15 selectrum-extend-current-candidate-highlight t) - (unless (featurep! +orderless) + (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) :config (setq selectrum-fix-vertical-window-height 17 @@ -55,7 +55,7 @@ `(orderless-without-literal . ,(substring pattern 1)))) (use-package! orderless - :when (featurep! +orderless) + :when (not (featurep! +prescient)) :after selectrum :init (setq orderless-component-separator "[ &]" diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index aa525443e..fa16b4828 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -3,10 +3,8 @@ (package! selectrum :pin "093f7e96a323179ee2a68a5a674e7fa2c5d721b8") -(when (featurep! +prescient) - (package! selectrum-prescient :pin "ed2b762241bbea03e374dc9dcd4fbe207c6b2ea4")) - -(when (featurep! +orderless) +(if (featurep! +prescient) + (package! selectrum-prescient :pin "ed2b762241bbea03e374dc9dcd4fbe207c6b2ea4") (package! orderless :pin "87ab7e47e343285f7afd42779c78551332b8fd84")) (package! consult :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31") From 56d6dc5e77e8924d6ffb6d0dbfd9813057310f7b Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 1 May 2021 14:44:29 +0300 Subject: [PATCH 056/147] selectrum: refactor orderless configuration - unify `setq`'s - move style dispatch functions into the `use-package`, rename them to follow doom conventions --- modules/completion/selectrum/config.el | 39 +++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 065711130..dcaa9efcf 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -42,18 +42,6 @@ (add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember) (add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember)) -(defun flex-if-twiddle (pattern _index _total) - (when (string-suffix-p "~" pattern) - `(orderless-flex . ,(substring pattern 0 -1)))) - -(defun first-initialism (pattern index _total) - (if (= index 0) 'orderless-initialism)) - -(defun without-if-bang (pattern _index _total) - "Define a '!not' exclusion prefix for literal strings." - (when (string-prefix-p "!" pattern) - `(orderless-without-literal . ,(substring pattern 1)))) - (use-package! orderless :when (not (featurep! +prescient)) :after selectrum @@ -63,13 +51,26 @@ orderless-initialism orderless-regexp)) :config - (setq completion-styles '(orderless)) - (setq orderless-skip-highlighting (lambda () selectrum-is-active)) - (setq selectrum-refine-candidates-function #'orderless-filter) - (setq selectrum-highlight-candidates-function #'orderless-highlight-matches) - (setq orderless-matching-styles '(orderless-regexp) - orderless-style-dispatchers '(flex-if-twiddle - without-if-bang))) + (defun +selectrum--orderless-flex-if-twiddle (pattern _index _total) + (when (string-suffix-p "~" pattern) + `(orderless-flex . ,(substring pattern 0 -1)))) + + (defun +selectrum--orderless-first-initialism (pattern index _total) + (if (= index 0) 'orderless-initialism)) + + (defun +selectrum--orderless-without-if-bang (pattern _index _total) + "Define a '!not' exclusion prefix for literal strings." + (when (string-prefix-p "!" pattern) + `(orderless-without-literal . ,(substring pattern 1)))) + + (setq completion-styles '(orderless) + orderless-skip-highlighting (lambda () selectrum-is-active) + selectrum-refine-candidates-function #'orderless-filter + selectrum-highlight-candidates-function #'orderless-highlight-matches + orderless-matching-styles '(orderless-regexp) + orderless-style-dispatchers '(+selectrum--orderless-flex-if-twiddle + +selectrum--orderless-first-initialism + +selectrum--orderless-without-if-bang))) (use-package! consult :defer t From 52cae6e18f1793c2797c65c09740643b847887be Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 1 May 2021 16:15:50 +0300 Subject: [PATCH 057/147] Bump bibtex-actions bdarcus/bibtex-actions@743f548 -> bdarcus/bibtex-actions@b1ddbb3 --- modules/tools/biblio/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tools/biblio/packages.el b/modules/tools/biblio/packages.el index 223243059..6a7901e23 100644 --- a/modules/tools/biblio/packages.el +++ b/modules/tools/biblio/packages.el @@ -7,4 +7,4 @@ (when (featurep! :completion helm) (package! helm-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) (when (featurep! :completion selectrum) - (package! bibtex-actions :pin "743f548c0cd46e3418a7ca4736bde8c86f97c073")) + (package! bibtex-actions :pin "b1ddbb32373ac01b6bb46dfc4cdc143461e3c14c")) From b9757e75edc71b6552e5db7a458e2d915a19b183 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 1 May 2021 17:55:02 +0300 Subject: [PATCH 058/147] selectrum: update bibtex-actions config - fix loading order issue - include (temporary?) binding in `SPC n b` to `bibtex-actions-open-entry` --- modules/completion/selectrum/TODO.org | 9 +++++---- modules/config/default/+emacs-bindings.el | 5 +++-- modules/config/default/+evil-bindings.el | 5 +++-- modules/tools/biblio/config.el | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 555635ac0..94dbd3a20 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -26,9 +26,10 @@ https://github.com/minad/marginalia/issues/59 - org (check, might be fine) - counsel-minibuffer-history analogue - counsel-company analogue -- bibtex * PROJ Other ** TODO bind =consult-lsp-diagnostics= to something? -** TODO test out bibtex-actions, check if more configuration should be added -https://github.com/bdarcus/bibtex-actions - . +** TODO bibtex-actions improvements? +currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a +main dispatch function like =ivy-bibtex=, rather it has a bunch of different +ones. Binding the ~bibtex-actions-map~ there would probably be better, but there +are nontrivial loading order shinanigans happening that make that not straightforward. diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index 1d23d90ea..4f0d0464e 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -148,8 +148,9 @@ :desc "Org agenda" "a" #'org-agenda (:when (featurep! :tools biblio) :desc "Bibliographic entries" "b" - (cond ((featurep! :completion ivy) #'ivy-bibtex) - ((featurep! :completion helm) #'helm-bibtex))) + (cond ((featurep! :completion ivy) #'ivy-bibtex) + ((featurep! :completion helm) #'helm-bibtex) + ((featurep! :completion selectrum) #'bibtex-actions-open-entry))) :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock :desc "Cancel current org-clock" "C" #'org-clock-cancel diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 945c5b8c1..33577fd5c 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -513,8 +513,9 @@ :desc "Org agenda" "a" #'org-agenda (:when (featurep! :tools biblio) :desc "Bibliographic entries" "b" - (cond ((featurep! :completion ivy) #'ivy-bibtex) - ((featurep! :completion helm) #'helm-bibtex))) + (cond ((featurep! :completion ivy) #'ivy-bibtex) + ((featurep! :completion helm) #'helm-bibtex) + ((featurep! :completion selectrum) #'bibtex-actions-open-entry))) :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock :desc "Cancel current org-clock" "C" #'org-clock-cancel diff --git a/modules/tools/biblio/config.el b/modules/tools/biblio/config.el index 7f1fa22b7..43dbd27c7 100644 --- a/modules/tools/biblio/config.el +++ b/modules/tools/biblio/config.el @@ -16,6 +16,7 @@ (use-package! bibtex-actions :when (featurep! :completion selectrum) + :after embark :defer t :config (add-to-list 'embark-keymap-alist '(bibtex . bibtex-actions-map))) From b2af88a6cf4e39f89dd8ab5769822e4eb9784bfb Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 2 May 2021 19:21:22 +0300 Subject: [PATCH 059/147] Bump :completion selectrum raxod502/selectrum@093f7e9 -> raxod502/selectrum@8629ab5 raxod502/prescient.el@ed2b762 -> raxod502/prescient.el@4a0f540 minad/consult@e04a404 -> minad/consult@51c1437 oantolin/embark@4d7e8e4 -> oantolin/embark@05aa11b minad/marginalia@5159256 -> minad/marginalia@ac4ab98 --- modules/completion/selectrum/packages.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index fa16b4828..6412b6455 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,17 +1,17 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "093f7e96a323179ee2a68a5a674e7fa2c5d721b8") +(package! selectrum :pin "8629ab5a6de572ada9dd5b18162a393969d9ebdf") (if (featurep! +prescient) - (package! selectrum-prescient :pin "ed2b762241bbea03e374dc9dcd4fbe207c6b2ea4") + (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") (package! orderless :pin "87ab7e47e343285f7afd42779c78551332b8fd84")) -(package! consult :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31") +(package! consult :pin "51c1437fb555f4ff7234ed01c71e29f80138156e") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "e04a404c8d8ca137be2b3b7cf664a11712639c31")) + (package! consult-flycheck :pin "51c1437fb555f4ff7234ed01c71e29f80138156e")) -(package! embark :pin "4d7e8e4d3be7aaff56730f76a066db2acad65371") -(package! embark-consult :pin "4d7e8e4d3be7aaff56730f76a066db2acad65371") +(package! embark :pin "05aa11bca37db1751c86fe78f784741be5b1a066") +(package! embark-consult :pin "05aa11bca37db1751c86fe78f784741be5b1a066") -(package! marginalia :pin "5159256d04d123899b88ee6e7eba0c27f66d0fe2") +(package! marginalia :pin "ac4ab987126c0366b876e7fdcfa797822dd3580b") From 02cf4bf3fabec9a39c228f3c40c50d6e749b159d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 2 May 2021 19:50:10 +0300 Subject: [PATCH 060/147] selectrum: regorganize TODO.org --- modules/completion/selectrum/TODO.org | 51 +++++++++++++++++---------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 94dbd3a20..ab33a675f 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,35 +1,48 @@ -* PROJ List of things not working -** TODO Add vanilla keybindings -*** TODO Add keybinding for embark-act -** TODO =SPC s s= and =SPC s S= ~:sw~ +* PROJ Design Decisions +** TODO bind =consult-lsp-diagnostics= to something? +** TODO Make sure we have all vanilla keybindings +** TODO Add keybinding for embark-act outside of the minibuffer +** TODO consider dropping prescient flag +** TODO =SPC s s= and =SPC s S= ~:sw~ ? There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). + +* PROJ Bugs ** TODO =C-SPC= and live previews -Automatic live previews have been globally disabled for speed purposes. -=C-SPC= is partially implemented with the preview key for ~consult-*~ commands. +Automatic live previews have been disabled on slow ~consult~ commands. +=C-SPC= is partially implemented as the preview key for ~consult-*~ commands. Need to get it to work for other selectrum commands such =SPC h f=. #+begin_src emacs-lisp (let ((embark-quit-after-action nil)) (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) #+end_src gets us close but moves the cursor to the new screen which is undesirable. -** TODO =C-C C-e= wgrep fun -* PROJ List of things needed for Ivy parity +probable best strategy: create an ~embark-preview~ that does this, upstream it. +** TODO ~consult-theme~ is buggy +something to do with doom theme loading modifications +** TODO ripgrep height logic bad +selectrum bug caused by file descriptors +https://github.com/raxod502/selectrum/issues/491 +** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error +probably caused by some doomism +https://github.com/oantolin/orderless/issues/41 + +* PROJ Missing Features ** TODO Icons https://github.com/minad/marginalia/issues/59 ** TODO =SPC s B= -** TODO modules to look over -- lookup -- taskrunner (doesn't seem to be an interface yet) -- pass (creating embark-pass can't be that hard) -- irc -- org (check, might be fine) -- counsel-minibuffer-history analogue -- counsel-company analogue -* PROJ Other -** TODO bind =consult-lsp-diagnostics= to something? +** TODO =C-C C-e= wgrep fun ** TODO bibtex-actions improvements? currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different ones. Binding the ~bibtex-actions-map~ there would probably be better, but there -are nontrivial loading order shinanigans happening that make that not straightforward. +are nontrivial loading order shenanigans happening that make that not straightforward. +** TODO Ivy Parity +*** TODO lookup module +*** TODO taskrunner module (doesn't seem to be an interface yet) +*** TODO pass module (creating embark-pass can't be that hard) +*** TODO irc module +*** TODO org module (check, might be fine) +*** TODO counsel-minibuffer-history analogue +*** TODO counsel-company analogue + From fa527c00e86d6bbb4b5522e57a42bb253376d27f Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 3 May 2021 11:13:28 +0300 Subject: [PATCH 061/147] selectrum: fix project search evil command autoloads --- modules/completion/selectrum/autoload/evil.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/completion/selectrum/autoload/evil.el b/modules/completion/selectrum/autoload/evil.el index 048444458..2f9b0e20c 100644 --- a/modules/completion/selectrum/autoload/evil.el +++ b/modules/completion/selectrum/autoload/evil.el @@ -1,13 +1,13 @@ ;; completion/selectrum/autoload/evil.el -*- lexical-binding: t; -*- ;;;###if (featurep! :editor evil) -;;;###autoload (autoload '+selectrum:project-search "completion/ivy/autoload/evil" nil t) +;;;###autoload (autoload '+selectrum:project-search "completion/selectrum/autoload/evil" nil t) (evil-define-command +selectrum:project-search (query &optional all-files-p) "Ex interface for `+selectrum/project-search'." (interactive "") (+selectrum/project-search all-files-p query)) -;;;###autoload (autoload '+selectrum:project-search-from-cwd "completion/ivy/autoload/evil" nil t) +;;;###autoload (autoload '+selectrum:project-search-from-cwd "completion/selectrum/autoload/evil" nil t) (evil-define-command +selectrum:project-search-from-cwd (query &optional recurse-p) "Ex interface for `+selectrum/project-search-from-cwd'." (interactive "") From 53e4e8c4d85790a1a301b7735a17b7fc402f7fb6 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 4 May 2021 16:16:36 +0300 Subject: [PATCH 062/147] selectrum: refactor orderless use-package --- modules/completion/selectrum/config.el | 43 ++++++++++++-------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index dcaa9efcf..ae98340b4 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -44,33 +44,28 @@ (use-package! orderless :when (not (featurep! +prescient)) - :after selectrum - :init - (setq orderless-component-separator "[ &]" - orderless-matching-styles '(orderless-prefixes - orderless-initialism - orderless-regexp)) + :demand t :config - (defun +selectrum--orderless-flex-if-twiddle (pattern _index _total) - (when (string-suffix-p "~" pattern) - `(orderless-flex . ,(substring pattern 0 -1)))) - - (defun +selectrum--orderless-first-initialism (pattern index _total) - (if (= index 0) 'orderless-initialism)) - - (defun +selectrum--orderless-without-if-bang (pattern _index _total) - "Define a '!not' exclusion prefix for literal strings." - (when (string-prefix-p "!" pattern) - `(orderless-without-literal . ,(substring pattern 1)))) - + (defun +selectrum-orderless-dispatch (pattern _index _total) + (cond + ;; Support $ as regexp end-of-line + ((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$"))) + ;; Ignore single ! + ((string= "!" pattern) `(orderless-literal . "")) + ;; Without literal + ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1))) + ;; Literal + ((string-suffix-p "=" pattern) `(orderless-literal . ,(substring pattern 0 -1))) + ;; Flex matching + ((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1))))) (setq completion-styles '(orderless) - orderless-skip-highlighting (lambda () selectrum-is-active) + 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 . (partial-completion)))) + orderless-style-dispatchers '(+selectrum-orderless-dispatch) + orderless-component-separator "[ &]" selectrum-refine-candidates-function #'orderless-filter - selectrum-highlight-candidates-function #'orderless-highlight-matches - orderless-matching-styles '(orderless-regexp) - orderless-style-dispatchers '(+selectrum--orderless-flex-if-twiddle - +selectrum--orderless-first-initialism - +selectrum--orderless-without-if-bang))) + selectrum-highlight-candidates-function #'orderless-highlight-matches)) (use-package! consult :defer t From 51a9a628b3c6cb4ad96a23d7c3e9f98f1eba71eb Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 5 May 2021 22:45:21 +0300 Subject: [PATCH 063/147] selectrum: eagerly load embark --- modules/completion/selectrum/config.el | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index ae98340b4..650c98994 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -110,7 +110,6 @@ :after (consult flycheck)) (use-package! embark - :defer t :init (setq embark-action-indicator (lambda (map) From 341343308a4126352c49218e457392648a6a381c Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 7 May 2021 11:40:55 -0500 Subject: [PATCH 064/147] feat(selectrum): Add wgrep --- modules/completion/selectrum/README.org | 1 + modules/completion/selectrum/config.el | 4 ++++ modules/completion/selectrum/packages.el | 2 ++ 3 files changed, 7 insertions(+) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index eb641c518..95e13120c 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -33,6 +33,7 @@ TODO [[https://github.com/oantolin/embark/][embark-consult]] [[https://github.com/minad/marginalia][marginalia]] [[https://github.com/oantolin/orderless][orderless]] (unless ~+prescient~) +[[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] [[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~) [[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 650c98994..e26d5e43b 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -136,3 +136,7 @@ :after (embark consult) :hook (embark-collect-mode . embark-consult-preview-minor-mode)) + +(use-package! wgrep + :commands wgrep-change-to-wgrep-mode + :config (setq wgrep-auto-save-buffer t)) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 6412b6455..28e881800 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -15,3 +15,5 @@ (package! embark-consult :pin "05aa11bca37db1751c86fe78f784741be5b1a066") (package! marginalia :pin "ac4ab987126c0366b876e7fdcfa797822dd3580b") + +(package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From 8957f02ab2850c3e5db7ff65d797bd5cb62cca52 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 7 May 2021 21:27:14 +0300 Subject: [PATCH 065/147] selectrum: improve wgrep - add `:demand t` to `embark-consult` so it works on first call - add `C-c C-e` to `consult-grep` --- modules/completion/selectrum/TODO.org | 1 + .../selectrum/autoload/selectrum.el | 24 +++++++++++++++++++ modules/completion/selectrum/config.el | 5 +++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index ab33a675f..268b54066 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -32,6 +32,7 @@ https://github.com/oantolin/orderless/issues/41 https://github.com/minad/marginalia/issues/59 ** TODO =SPC s B= ** TODO =C-C C-e= wgrep fun +check if we can add this to ~consult-line~ too ** TODO bibtex-actions improvements? currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 10e04ada0..071538145 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -74,3 +74,27 @@ If ARG (universal argument), include all files, even hidden or compressed ones." (defun +selectrum/search-symbol-at-point () (interactive) (consult-line (thing-at-point 'symbol))) + +;;;###autoload +(defun +selectrum/embark-wgrep () + "Invoke a wgrep buffer on the current selectrum results, if supported." + (interactive) + (require 'wgrep) + (pcase-let ((`(,type . ,candidates) + (run-hook-with-args-until-success 'embark-candidate-collectors))) + (if (null candidates) + (user-error "No candidates for export") + (if (eq type 'consult-grep) + (embark--quit-and-run + (lambda () + (let ((buf (generate-new-buffer "*Embark Export Wgrep*"))) + (with-current-buffer buf + (insert (propertize "Exported grep results:\n\n" 'wgrep-header t)) + (dolist (line candidates) (insert line "\n")) + (goto-char (point-min)) + (grep-mode) + (setq-local wgrep-header/footer-parser #'ignore) + (wgrep-setup)) + (pop-to-buffer buf) + (wgrep-change-to-wgrep-mode)))) + (user-error "embark category %S doesn't support wgrep" type))))) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index e26d5e43b..d3869afe0 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -31,6 +31,7 @@ (map! :map selectrum-minibuffer-map "C-o" #'embark-act "C-c C-o" #'embark-export + "C-c C-e" #'+selectrum/embark-wgrep [backspace] #'+selectrum/backward-updir)) (use-package! selectrum-prescient @@ -123,7 +124,8 @@ :desc "Open target with sudo" "s" #'sudo-edit :desc "Open target with vlf" "l" #'vlf :map embark-file-map - :desc "Cycle marginalia views" "A" #'marginalia-cycle)) + :desc "Cycle marginalia views" "A" #'marginalia-cycle) + (set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil)) (use-package! marginalia :hook (doom-first-input . marginalia-mode) @@ -134,6 +136,7 @@ (use-package! embark-consult :after (embark consult) + :demand t :hook (embark-collect-mode . embark-consult-preview-minor-mode)) From 34bc993a3ad18f490c09c97616215e19041cab1f Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 8 May 2021 12:24:12 +0300 Subject: [PATCH 066/147] selectrum: remove marginalia-annotators obsolete variable, and set to `heavy` by default now anyway --- modules/completion/selectrum/config.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index d3869afe0..d5823aaca 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -129,8 +129,6 @@ (use-package! marginalia :hook (doom-first-input . marginalia-mode) - :init - (setq-default marginalia-annotators '(marginalia-annotators-heavy)) :config (add-to-list 'marginalia-command-categories '(persp-switch-to-buffer . buffer))) From 1266ac7b2439d6ff684670c89c78dad1b3d35dd9 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 8 May 2021 15:54:27 +0300 Subject: [PATCH 067/147] selectrum: document orderless style dispatchers --- modules/completion/selectrum/README.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 95e13120c..d51a0f6b7 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -13,6 +13,7 @@ - [[#project-search--replace][Project search & replace]] - [[#in-buffer-searching][In-buffer searching]] - [[#selectrum-integration-for-various-completing-commands][Selectrum integration for various completing commands]] + - [[#orderless-filtering][Orderless filtering]] * Description This module provides Selectrum integration for a variety of Emacs commands, as @@ -145,3 +146,14 @@ A wgrep buffer can be opened from swiper with =C-c C-e=. | =SPC s p= | Search project | | =SPC s P= | Search another project | | =SPC s s= | Search the current buffer (incrementally) | + +** Orderless filtering +When using orderless to filter through candidates, the default behaviour is for +each space separated inputs to match the candidate as a regular expression or +literally. You can further specify each space separated input in the following +ways: +| Input | Description | +|--------+--------------------------------------------| +| =!foo= | match without literal input =foo= | +| =bar== | match only with literal input =foo= | +| =baz~= | match input =foo= with fuzzy/flex matching | From 26a310d04ceecc1848500226e4e22b77ab50cc00 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 8 May 2021 16:48:48 +0300 Subject: [PATCH 068/147] selectrum: improve ivy parity - add `completion-at-point` as analogue to `cousnel-company` - fix emacs-bindings `counsel-company` binding to respect helm and selectrum - add org jump commands `consult-org-heading` and `consult-org-agenda` bindings - add `consult-history` as `counsel-minibuffer-history` analogue - add support for `doom/help-search` - update TODO.org --- core/autoload/help.el | 2 ++ modules/completion/selectrum/TODO.org | 8 ++------ modules/config/default/+emacs-bindings.el | 8 ++++++-- modules/config/default/+evil-bindings.el | 5 +++-- modules/config/default/config.el | 6 ++++-- modules/lang/org/config.el | 6 ++++++ 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/core/autoload/help.el b/core/autoload/help.el index ccbe8face..ab8412f3e 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -226,6 +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) ((rgrep (read-regexp "Search for" (or initial-input 'grep-tag-default) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 268b54066..5d1a372aa 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -30,7 +30,6 @@ https://github.com/oantolin/orderless/issues/41 * PROJ Missing Features ** TODO Icons https://github.com/minad/marginalia/issues/59 -** TODO =SPC s B= ** TODO =C-C C-e= wgrep fun check if we can add this to ~consult-line~ too ** TODO bibtex-actions improvements? @@ -42,8 +41,5 @@ are nontrivial loading order shenanigans happening that make that not straightfo *** TODO lookup module *** TODO taskrunner module (doesn't seem to be an interface yet) *** TODO pass module (creating embark-pass can't be that hard) -*** TODO irc module -*** TODO org module (check, might be fine) -*** TODO counsel-minibuffer-history analogue -*** TODO counsel-company analogue - +*** TODO ~+irc/ivy-jump-to-channel~ analogue +*** TODO =SPC s B= (~swiper-all~ analogue) diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index 4f0d0464e..b8eb376b3 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -486,8 +486,12 @@ [C-tab] #'company-complete-common-or-cycle [tab] #'company-complete-common-or-cycle [backtab] #'company-select-previous - "C-RET" #'counsel-company - "C-" #'counsel-company + "C-RET" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company) + ((featurep! :completion selectrum) #'completion-at-point)) + "C-" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company) + ((featurep! :completion selectrum) #'completion-at-point)) :map company-search-map "C-n" #'company-search-repeat-forward "C-p" #'company-search-repeat-backward diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 33577fd5c..7caaa10d5 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -138,8 +138,9 @@ "C-u" #'company-previous-page "C-d" #'company-next-page "C-s" #'company-filter-candidates - "C-S-s" (cond ((featurep! :completion helm) #'helm-company) - ((featurep! :completion ivy) #'counsel-company)) + "C-S-s" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company) + ((featurep! :completion selectrum) #'completion-at-point)) "C-SPC" #'company-complete-common "TAB" #'company-complete-common-or-cycle [tab] #'company-complete-common-or-cycle diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 618fcef13..36c73075a 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -404,11 +404,13 @@ Continues comments if executed from a commented line. Consults "A-x" #'execute-extended-command) ;; A Doom convention where C-s on popups and interactive searches will invoke - ;; ivy/helm for their superior filtering. + ;; ivy/helm/selectrum for their superior filtering. (when-let (command (cond ((featurep! :completion ivy) #'counsel-minibuffer-history) ((featurep! :completion helm) - #'helm-minibuffer-history))) + #'helm-minibuffer-history) + ((featurep! :completion selectrum) + #'consult-history))) (define-key! :keymaps (append +default-minibuffer-maps (when (featurep! :editor evil +everywhere) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 444470847..6227feabc 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -724,6 +724,9 @@ between the two." (:when (featurep! :completion helm) "." #'helm-org-in-buffer-headings "/" #'helm-org-agenda-files-headings) + (:when (featurep! :completion selectrum) + "." #'consult-org-heading + "/" #'consult-org-agenda) "A" #'org-archive-subtree "e" #'org-export-dispatch "f" #'org-footnote-new @@ -807,6 +810,9 @@ between the two." (:when (featurep! :completion helm) "g" #'helm-org-in-buffer-headings "G" #'helm-org-agenda-files-headings) + (:when (featurep! :completion selectrum) + "g" #'consult-org-heading + "G" #'consult-org-agenda) "c" #'org-clock-goto "C" (cmd! (org-clock-goto 'select)) "i" #'org-id-goto From 693eb3c9a42690d11ba360a8308b85523acaf06e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 8 May 2021 22:50:58 +0300 Subject: [PATCH 069/147] selectrum: add +irc/selectrum-jump-to-channel --- modules/app/irc/autoload/irc.el | 5 +++-- modules/app/irc/autoload/selectrum.el | 25 +++++++++++++++++++++++++ modules/app/irc/config.el | 4 ++++ modules/completion/selectrum/TODO.org | 1 - 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 modules/app/irc/autoload/selectrum.el diff --git a/modules/app/irc/autoload/irc.el b/modules/app/irc/autoload/irc.el index fac63139f..85f9f36c7 100644 --- a/modules/app/irc/autoload/irc.el +++ b/modules/app/irc/autoload/irc.el @@ -68,8 +68,9 @@ workspace for it." argument) is non-nil only show channels in current server." (interactive "P") (call-interactively - (cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel) - ((user-error "No jump-to-channel backend is enabled. Enable ivy!"))))) + (cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel) + ((featurep! :completion selectrum) #'+irc/selectrum-jump-to-channel) + ((user-error "No jump-to-channel backend is enabled. Enable selectrum or ivy!"))))) ;;;###autoload (defun +irc/tracking-next-buffer () diff --git a/modules/app/irc/autoload/selectrum.el b/modules/app/irc/autoload/selectrum.el new file mode 100644 index 000000000..5bd5532a2 --- /dev/null +++ b/modules/app/irc/autoload/selectrum.el @@ -0,0 +1,25 @@ +;;; app/irc/autoload/selectrum.el -*- lexical-binding: t; -*- +;;;###if (featurep! :completion selectrum) + +;;;###autoload +(defun +irc/selectrum-jump-to-channel (&optional this-server) + "Jump to an open channel or server buffer with selectrum. If THIS-SERVER (universal +argument) is non-nil only show channels in current server." + (interactive "P") + (if (not (circe-server-buffers)) + (message "No circe buffers available") + (when (and this-server (not circe-server-buffer)) + (setq this-server nil)) + (when-let + ((buffer (completing-read + (format "Jump to%s: " (if this-server (format " (%s)" (buffer-name circe-server-buffer)) "")) + (cl-loop with servers = (if this-server (list circe-server-buffer) (circe-server-buffers)) + with current-buffer = (current-buffer) + for server in servers + collect (buffer-name server) + nconc + (with-current-buffer server + (cl-loop for buf in (circe-server-chat-buffers) + unless (eq buf current-buffer) + collect (buffer-name buf))))))) + (switch-to-buffer buffer)))) diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index a232c9fa2..2cb073adc 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -141,6 +141,10 @@ playback.") ;; Fail gracefully if not in a circe buffer (global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer) + (after! marginalia + (when (featurep! :completion selectrum) + (add-to-list 'marginalia-command-categories '(+irc/selectrum-jump-to-channel . buffer)))) + (map! :localleader (:map circe-mode-map "a" #'tracking-next-buffer diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 5d1a372aa..fc0e2721a 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -41,5 +41,4 @@ are nontrivial loading order shenanigans happening that make that not straightfo *** TODO lookup module *** TODO taskrunner module (doesn't seem to be an interface yet) *** TODO pass module (creating embark-pass can't be that hard) -*** TODO ~+irc/ivy-jump-to-channel~ analogue *** TODO =SPC s B= (~swiper-all~ analogue) From 1fe0ad318bb9ddf432601d7db0fc56d41b2f09e5 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 8 May 2021 23:36:14 +0300 Subject: [PATCH 070/147] selectrum: improve :tools lookup integration - move `consult-xref` stuff to `:tools lookup` where it belongs - add selectrum functionality where possible, document what's beyond the scope of this PR --- modules/completion/selectrum/TODO.org | 12 ++++++++---- modules/completion/selectrum/config.el | 6 ------ modules/tools/lookup/autoload/lookup.el | 7 +++++-- modules/tools/lookup/config.el | 8 +++++++- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index fc0e2721a..b5a11de9c 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -6,6 +6,8 @@ ** TODO =SPC s s= and =SPC s S= ~:sw~ ? There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). +** TODO =SPC s B= +Selectrum/Consult don't have a ~swiper-all~ analogue either. * PROJ Bugs ** TODO =C-SPC= and live previews @@ -38,7 +40,9 @@ main dispatch function like =ivy-bibtex=, rather it has a bunch of different ones. Binding the ~bibtex-actions-map~ there would probably be better, but there are nontrivial loading order shenanigans happening that make that not straightforward. ** TODO Ivy Parity -*** TODO lookup module -*** TODO taskrunner module (doesn't seem to be an interface yet) -*** TODO pass module (creating embark-pass can't be that hard) -*** TODO =SPC s B= (~swiper-all~ analogue) +*** TODO pass module +*** WAIT lookup module +- ~dash-docs~ backend (needs to be created) +- ~+lookup--online..~ functionality (needs a consult analogue of ~counsel-search~) +*** WAIT taskrunner module +in all likelihood requires writing ~consult-taskrunner~. diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index d5823aaca..cb2b6d73c 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -100,12 +100,6 @@ (setq consult-async-input-debounce 0.5) (setq consult-async-input-throttle 0.8)) -(use-package! consult-xref - :defer t - :init - (setq xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref)) - (use-package! consult-flycheck :when (featurep! :checkers syntax) :after (consult flycheck)) diff --git a/modules/tools/lookup/autoload/lookup.el b/modules/tools/lookup/autoload/lookup.el index 531dd7ca0..622a75d7f 100644 --- a/modules/tools/lookup/autoload/lookup.el +++ b/modules/tools/lookup/autoload/lookup.el @@ -234,8 +234,8 @@ 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' or `+helm-file-search'. Will return nil if -neither is available. These require ripgrep to be installed." +Uses and requires `+ivy-file-search', `+helm-file-search', or `+selectrum-file-search'. +Will return nil if neither is available. These require ripgrep to be installed." (unless identifier (let ((query (rxt-quote-pcre identifier))) (ignore-errors @@ -244,6 +244,9 @@ neither is available. These require ripgrep to be installed." t) ((featurep! :completion helm) (+helm-file-search :query query) + t) + ((featurep! :completion selectrum) + (+selectrum-file-search :query query) t)))))) (defun +lookup-evil-goto-definition-backend-fn (_identifier) diff --git a/modules/tools/lookup/config.el b/modules/tools/lookup/config.el index e3840ae87..d9e54ac63 100644 --- a/modules/tools/lookup/config.el +++ b/modules/tools/lookup/config.el @@ -178,7 +178,13 @@ Dictionary.app behind the scenes to get definitions.") (funcall orig-fn fetcher alist))) (use-package! helm-xref - :when (featurep! :completion helm))) + :when (featurep! :completion helm)) + + (use-package! consult-xref + :when (featurep! :completion selectrum) + :init + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref))) ;; From f372f3aa2cbfe17c547c34d8bd2b990a81b0620d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 16 May 2021 02:29:48 +0300 Subject: [PATCH 071/147] selectrum: reorganize consult use-package! --- modules/completion/selectrum/config.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index cb2b6d73c..94d4b13ca 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -90,15 +90,15 @@ (setq completion-in-region-function #'consult-completion-in-region) :config (recentf-mode) - (setq consult-project-root-function #'doom-project-root) - (setq completion-in-region-function #'consult-completion-in-region) - (setq consult-narrow-key "<") + (setq consult-project-root-function #'doom-project-root + completion-in-region-function #'consult-completion-in-region + consult-narrow-key "<" + consult-line-numbers-widen t + consult-async-input-debounce 0.5 + consult-async-input-throttle 0.8) (setf (alist-get #'consult-bookmark consult-config) (list :preview-key (kbd "C-SPC"))) (setf (alist-get #'consult-recent-file consult-config) (list :preview-key (kbd "C-SPC"))) - (setf (alist-get #'consult--grep consult-config) (list :preview-key (kbd "C-SPC"))) - (setq consult-line-numbers-widen t) - (setq consult-async-input-debounce 0.5) - (setq consult-async-input-throttle 0.8)) + (setf (alist-get #'consult--grep consult-config) (list :preview-key (kbd "C-SPC")))) (use-package! consult-flycheck :when (featurep! :checkers syntax) From 4e74a221cc544781413f090214231da4d31d34c4 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 16 May 2021 02:54:32 +0300 Subject: [PATCH 072/147] selectrum: rework consult previews - add `C-M-j` and `C-M-k` as preview scrolling keys - add `consult-theme` to functions that don't get previewed automatically (also it works now) --- modules/completion/selectrum/TODO.org | 2 -- modules/completion/selectrum/config.el | 8 +++++--- modules/config/default/+evil-bindings.el | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index b5a11de9c..9ba154b99 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -20,8 +20,6 @@ Need to get it to work for other selectrum commands such =SPC h f=. #+end_src gets us close but moves the cursor to the new screen which is undesirable. probable best strategy: create an ~embark-preview~ that does this, upstream it. -** TODO ~consult-theme~ is buggy -something to do with doom theme loading modifications ** TODO ripgrep height logic bad selectrum bug caused by file descriptors https://github.com/raxod502/selectrum/issues/491 diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 94d4b13ca..221bb4976 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -96,9 +96,11 @@ consult-line-numbers-widen t consult-async-input-debounce 0.5 consult-async-input-throttle 0.8) - (setf (alist-get #'consult-bookmark consult-config) (list :preview-key (kbd "C-SPC"))) - (setf (alist-get #'consult-recent-file consult-config) (list :preview-key (kbd "C-SPC"))) - (setf (alist-get #'consult--grep consult-config) (list :preview-key (kbd "C-SPC")))) + (mapc + (lambda (x) (setf + (alist-get x consult-config) + (list :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k"))))) + '(consult-bookmark consult-recent-file consult--grep consult-theme))) (use-package! consult-flycheck :when (featurep! :checkers syntax) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 7caaa10d5..4aeb33fcc 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -208,9 +208,11 @@ :map selectrum-minibuffer-map "M-RET" #'selectrum-submit-exact-input "C-j" #'selectrum-next-candidate + "C-M-j" #'selectrum-next-candidate ;; with preview, see modules/completion/selectrum/config.el "C-S-j" #'selectrum-next-page "C-s-j" #'selectrum-goto-end "C-k" #'selectrum-previous-candidate + "C-M-k" #'selectrum-previous-candidate ;; with preview, see modules/completion/selectrum/config.el "C-S-k" #'selectrum-previous-page "C-s-k" #'selectrum-goto-beginning))) From 2945d2dd33cf76db99cc69c19ab309fd609db202 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 16 May 2021 03:03:32 +0300 Subject: [PATCH 073/147] Bump :completion selectrum raxod502/selectrum@8629ab5 -> raxod502/selectrum@bfefb8e oantolin/orderless@87ab7e4 -> oantolin/orderless@d97a91f minad/consult@51c1437 -> minad/consult@c839b82 oantolin/embark@05aa11b -> oantolin/embark@7c850c0 minad/marginalia@ac4ab98 -> minad/marginalia@445d283 --- modules/completion/selectrum/packages.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 28e881800..4f9b8c823 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,19 +1,19 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "8629ab5a6de572ada9dd5b18162a393969d9ebdf") +(package! selectrum :pin "bfefb8e1a350d44b56290b2c7ddc3418ec217b30") (if (featurep! +prescient) (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") - (package! orderless :pin "87ab7e47e343285f7afd42779c78551332b8fd84")) + (package! orderless :pin "d97a91f6e12ace638e65bdccefd14d1e638a2dae")) -(package! consult :pin "51c1437fb555f4ff7234ed01c71e29f80138156e") +(package! consult :pin "c839b82ce3e4db3faaecf3e9e5e2d98ad010eede") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "51c1437fb555f4ff7234ed01c71e29f80138156e")) + (package! consult-flycheck :pin "c839b82ce3e4db3faaecf3e9e5e2d98ad010eede")) -(package! embark :pin "05aa11bca37db1751c86fe78f784741be5b1a066") -(package! embark-consult :pin "05aa11bca37db1751c86fe78f784741be5b1a066") +(package! embark :pin "7c850c07bfe29f3232ebb22793e8421772f820f1") +(package! embark-consult :pin "7c850c07bfe29f3232ebb22793e8421772f820f1") -(package! marginalia :pin "ac4ab987126c0366b876e7fdcfa797822dd3580b") +(package! marginalia :pin "445d2832a2f06484ad28d9b55676c52d63cd0a46") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From 5656e397de013e1c2b1667b9d2cca8b4b75c1824 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 16 May 2021 03:18:13 +0300 Subject: [PATCH 074/147] selectrum: rework orderless style dispatchers - make all markers both prefixes and suffixes - add `\`` affix for initialism - add initialism matching to be on by default in `symbol` and `command` - category completions --- modules/completion/selectrum/README.org | 16 +++++++++------- modules/completion/selectrum/config.el | 18 +++++++++++++++--- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index d51a0f6b7..a135dc796 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -150,10 +150,12 @@ A wgrep buffer can be opened from swiper with =C-c C-e=. ** Orderless filtering When using orderless to filter through candidates, the default behaviour is for each space separated inputs to match the candidate as a regular expression or -literally. You can further specify each space separated input in the following -ways: -| Input | Description | -|--------+--------------------------------------------| -| =!foo= | match without literal input =foo= | -| =bar== | match only with literal input =foo= | -| =baz~= | match input =foo= with fuzzy/flex matching | +literally. In ~command~ and ~symbol~ category searches such as =SPC h f= and =SPC +h v=, matching by initialism is also on by default. You can further specify each +space separated input in the following ways: +| Input | Description | +|------------------+--------------------------------------------| +| =!foo= or =foo!= | match without literal input =foo= | +| =`bar= or =bar`= | match input =bar= as an initialism | +| ==baz= or =baz== | match only with literal input =baz= | +| =~qux= or =qux~= | match input =qux= with fuzzy/flex matching | diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 221bb4976..2d5e447e6 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -49,20 +49,32 @@ :config (defun +selectrum-orderless-dispatch (pattern _index _total) (cond - ;; Support $ as regexp end-of-line + ;; Ensure that $ works with Consult commands, which add disambiguation suffixes ((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$"))) ;; Ignore single ! ((string= "!" pattern) `(orderless-literal . "")) ;; Without literal ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1))) - ;; Literal + ((string-suffix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 0 -1))) + ;; Initialism matching + ((string-prefix-p "`" pattern) `(orderless-initialism . ,(substring pattern 1))) + ((string-suffix-p "`" pattern) `(orderless-initialism . ,(substring pattern 0 -1))) + ;; Literal matching + ((string-prefix-p "=" pattern) `(orderless-literal . ,(substring pattern 1))) ((string-suffix-p "=" pattern) `(orderless-literal . ,(substring pattern 0 -1))) ;; Flex matching + ((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1))) ((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1))))) + (orderless-define-completion-style orderless+initialism + (orderless-matching-styles '(orderless-initialism + orderless-literal + orderless-regexp))) (setq completion-styles '(orderless) 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 . (partial-completion)))) + completion-category-overrides '((file (styles . (partial-completion))) + (command (styles orderless+initialism)) + (symbol (styles orderless+initialism))) orderless-style-dispatchers '(+selectrum-orderless-dispatch) orderless-component-separator "[ &]" selectrum-refine-candidates-function #'orderless-filter From e2f1783589e80ea549321c57df170ed495c34218 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 00:14:55 +0300 Subject: [PATCH 075/147] selectrum: pass target to `embark-action-indicator` function spec changed upstream --- modules/completion/selectrum/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 2d5e447e6..5bac5fd8d 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -121,7 +121,7 @@ (use-package! embark :init (setq embark-action-indicator - (lambda (map) + (lambda (map _target) (which-key--show-keymap "Embark" map nil nil 'no-paging) #'which-key--hide-popup-ignore-command) embark-become-indicator embark-action-indicator) From 23b4dfa521e76e2c966de8fb6bace03767823861 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 02:48:14 +0300 Subject: [PATCH 076/147] selectrum: document bugs in TODO.org --- modules/completion/selectrum/TODO.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 9ba154b99..430bb1687 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -26,6 +26,15 @@ https://github.com/raxod502/selectrum/issues/491 ** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error probably caused by some doomism https://github.com/oantolin/orderless/issues/41 +** TODO =SPC '= doesn't work on =SPC /= +Something in the ~selectrum-last-command~ logic breaks down. Maybe the fact that +~+selectrum-file-search~ is defined with ~cl-defun~? +** TODO ~orderless+initialism~ doesn't work for some reason +See https://github.com/oantolin/orderless/issues/54. +Narrowed it down to the fact that it works if ~selectrum-mode~ is off, but +doesn't if it's on (even without the ~use-package~ configuration). +However, it has no problem working with selectrum with a MWE using ~emacs -Q~, +so it might be caused by some nontrivial doomism in the area. * PROJ Missing Features ** TODO Icons From 157a6c5c4b2b56b5e8ceaa07194e5c121c1209c4 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 13:20:02 +0300 Subject: [PATCH 077/147] selectrum: partially fix selectrum-repeat issue - doesn't restore selection upon repeat, might be upstream issue - document some bugs/todos --- modules/completion/selectrum/TODO.org | 15 ++++++++++++--- .../completion/selectrum/autoload/selectrum.el | 3 +-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 430bb1687..ca51cc3c8 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -26,9 +26,18 @@ https://github.com/raxod502/selectrum/issues/491 ** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error probably caused by some doomism https://github.com/oantolin/orderless/issues/41 -** TODO =SPC '= doesn't work on =SPC /= -Something in the ~selectrum-last-command~ logic breaks down. Maybe the fact that -~+selectrum-file-search~ is defined with ~cl-defun~? +** TODO ~selectrum-repeat~ Issues +Unlike Ivy, ~selectrum-repeat~ doesn't restore the position of the selection in +the completion buffer. Seems to be reproduced in ~emacs -Q~. If so, create +upstream selectrum issue. +** TODO go over definition of ~+selectrum-file-search~ +check if anything else there needs to be cleaned up. +** TODO Embark export window buffer switching logic +If we export bookmarks, grep session, or ~find-file~ session, when pressing +enter, it opens the new buffer in another window rather than the main one, even +though at least the bookmark function ostensibly uses +~pop-to-buffer-same-window~. Ivy gets the window switched in the bookmarks and +grep case due to a custom ivy occur window switching function. ** TODO ~orderless+initialism~ doesn't work for some reason See https://github.com/oantolin/orderless/issues/54. Narrowed it down to the fact that it works if ~selectrum-mode~ is off, but diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 071538145..1c683dae5 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -23,8 +23,7 @@ one face." (user-error "Couldn't find ripgrep in your PATH")) (require 'consult) (setq deactivate-mark t) - (let* ((this-command 'consult--grep) - (project-root (or (doom-project-root) default-directory)) + (let* ((project-root (or (doom-project-root) default-directory)) (directory (or in project-root)) (args (split-string (string-trim From c349a0a046f4bff341c79bf227ea579c57db325a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 13:42:45 +0300 Subject: [PATCH 078/147] selectrum: remove automatic initialisms for M-x etc Doesn't work if we want to use selectrum highlighting optimizations, see raxod502/selectrum#539. Also document `SPC /` being slow. --- modules/completion/selectrum/README.org | 6 +++--- modules/completion/selectrum/TODO.org | 10 +++------- modules/completion/selectrum/config.el | 8 +------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index a135dc796..28e4ad567 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -150,9 +150,9 @@ A wgrep buffer can be opened from swiper with =C-c C-e=. ** Orderless filtering When using orderless to filter through candidates, the default behaviour is for each space separated inputs to match the candidate as a regular expression or -literally. In ~command~ and ~symbol~ category searches such as =SPC h f= and =SPC -h v=, matching by initialism is also on by default. You can further specify each -space separated input in the following ways: +literally. + +You can further specify each space separated input in the following ways: | Input | Description | |------------------+--------------------------------------------| | =!foo= or =foo!= | match without literal input =foo= | diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index ca51cc3c8..a442bb3ad 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -38,13 +38,9 @@ enter, it opens the new buffer in another window rather than the main one, even though at least the bookmark function ostensibly uses ~pop-to-buffer-same-window~. Ivy gets the window switched in the bookmarks and grep case due to a custom ivy occur window switching function. -** TODO ~orderless+initialism~ doesn't work for some reason -See https://github.com/oantolin/orderless/issues/54. -Narrowed it down to the fact that it works if ~selectrum-mode~ is off, but -doesn't if it's on (even without the ~use-package~ configuration). -However, it has no problem working with selectrum with a MWE using ~emacs -Q~, -so it might be caused by some nontrivial doomism in the area. - +** TODO selectrum =SPC /= is much slower than ivy =SPC /= +requires further investigation. is ~consult-ripgrep~ slower than ~counsel-rg~? +is it something the custom search function is doing? does ivy cache stuff? * PROJ Missing Features ** TODO Icons https://github.com/minad/marginalia/issues/59 diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 5bac5fd8d..228d31847 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -65,16 +65,10 @@ ;; Flex matching ((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1))) ((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1))))) - (orderless-define-completion-style orderless+initialism - (orderless-matching-styles '(orderless-initialism - orderless-literal - orderless-regexp))) (setq completion-styles '(orderless) 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 . (partial-completion))) - (command (styles orderless+initialism)) - (symbol (styles orderless+initialism))) + completion-category-overrides '((file (styles . (partial-completion)))) orderless-style-dispatchers '(+selectrum-orderless-dispatch) orderless-component-separator "[ &]" selectrum-refine-candidates-function #'orderless-filter From ed922a62cb2388d073548b6cb4263faca7005027 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 15:44:39 +0300 Subject: [PATCH 079/147] selectrum: improve bindings - add missing emacs bindings - properly feature guard swiper related bindings - for selectrum, unbind `SPC s B` and temporarily bind `SPC s s` to isearch to prevent don't get errors until we decide what to do there. - update readme to reflect that --- modules/completion/selectrum/README.org | 10 ++++------ modules/completion/selectrum/TODO.org | 5 +++-- modules/config/default/+emacs-bindings.el | 18 ++++++++++++++---- modules/config/default/+evil-bindings.el | 10 +++++++--- modules/config/default/autoload/search.el | 8 +++++--- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 28e4ad567..34b809f04 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -105,17 +105,15 @@ users). https://assets.doomemacs.org/completion/selectrum/search-replace.png ** TODO In-buffer searching -The =swiper= package provides an interactive buffer search powered by ivy. It -can be invoked with: +This module provides some in buffer searching bindings: -+ =SPC s s= (~swiper-isearch~) -+ =SPC s S= (~swiper-isearch-thing-at-point~) ++ =SPC s s= (~isearch~) ++ =SPC s S= (~+selectrum/search-symbol-at-point~ via ~consult-line~) + =SPC s b= (~consult-line~) -+ ~:sw[iper] [QUERY]~ https://assets.doomemacs.org/completion/selectrum/buffer-search.png -A wgrep buffer can be opened from swiper with =C-c C-e=. +A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet). ** Selectrum integration for various completing commands *** General diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index a442bb3ad..966b4bc8b 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -5,9 +5,10 @@ ** TODO consider dropping prescient flag ** TODO =SPC s s= and =SPC s S= ~:sw~ ? There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ -does something else (give you previously used isearch search terms). +does something else (give you previously used isearch search terms). Bound to +regular isearch for now. ** TODO =SPC s B= -Selectrum/Consult don't have a ~swiper-all~ analogue either. +Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. * PROJ Bugs ** TODO =C-SPC= and live previews diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index b8eb376b3..b3a7e72d2 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -113,8 +113,13 @@ ;;; s --- search (:prefix-map ("s" . "search") :desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point - :desc "Search buffer" "b" #'swiper - :desc "Search all open buffers" "B" #'swiper-all + :desc "Search buffer" "b" + (cond ((featurep! :completion helm) #'swiper) + ((featurep! :completion ivy) #'swiper) + ((featurep! :completion selectrum) #'consult-line)) + :desc "Search all open buffers" "B" + (cond ((featurep! :completion helm) #'swiper-all) + ((featurep! :completion ivy) #'swiper-all)) :desc "Search current directory" "d" #'+default/search-cwd :desc "Search other directory" "D" #'+default/search-other-cwd :desc "Locate file" "f" #'+lookup/file @@ -129,7 +134,10 @@ :desc "Search project" "p" #'+default/search-project :desc "Search other project" "P" #'+default/search-other-project :desc "Search buffer" "s" #'+default/search-buffer - :desc "Search buffer for thing at point" "S" #'swiper-isearch-thing-at-point + :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 selectrum) #'+selectrum/search-symbol-at-point)) :desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Thesaurus" "T" #'+lookup/synonyms) @@ -425,7 +433,9 @@ :desc "Reconnect all" "r" #'circe-reconnect-all :desc "Send message" "s" #'+irc/send-message (: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 selectrum) + :desc "Jump to channel" "j" #'+irc/selectrum-jump-to-channel))) ;;; T --- twitter (:when (featurep! :app twitter) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 4aeb33fcc..78e5145b7 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -678,9 +678,12 @@ ;;; s --- search (:prefix-map ("s" . "search") :desc "Search buffer" "b" - (cond ((featurep! :completion ivy) #'swiper) + (cond ((featurep! :completion helm) #'swiper) + ((featurep! :completion ivy) #'swiper) ((featurep! :completion selectrum) #'consult-line)) - :desc "Search all open buffers" "B" #'swiper-all + :desc "Search all open buffers" "B" + (cond ((featurep! :completion helm) #'swiper-all) + ((featurep! :completion ivy) #'swiper-all)) :desc "Search current directory" "d" #'+default/search-cwd :desc "Search other directory" "D" #'+default/search-other-cwd :desc "Locate file" "f" #'locate @@ -698,7 +701,8 @@ :desc "Jump to mark" "r" #'evil-show-marks :desc "Search buffer" "s" #'+default/search-buffer :desc "Search buffer for thing at point" "S" - (cond ((featurep! :completion ivy) #'swiper-isearch-thing-at-point) + (cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point) + ((featurep! :completion ivy) #'swiper-isearch-thing-at-point) ((featurep! :completion selectrum) #'+selectrum/search-symbol-at-point)) :desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Thesaurus" "T" #'+lookup/synonyms) diff --git a/modules/config/default/autoload/search.el b/modules/config/default/autoload/search.el index 899099fda..c9344751f 100644 --- a/modules/config/default/autoload/search.el +++ b/modules/config/default/autoload/search.el @@ -27,9 +27,11 @@ If prefix ARG is set, prompt for a directory to search from." If a selection is active, pre-fill the prompt with it." (interactive) (call-interactively - (if (region-active-p) - #'swiper-isearch-thing-at-point - #'swiper-isearch))) + (cond ((or (featurep! :completion helm) (featurep! :completion ivy)) + (if (region-active-p) + #'swiper-isearch-thing-at-point + #'swiper-isearch)) + ((featurep! :completion selectrum) #'isearch-forward)))) ;;;###autoload (defun +default/search-project (&optional arg) From 5f12afca34dc4b22b1110d4995634752ca3d4c7c Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 16:17:40 +0300 Subject: [PATCH 080/147] :tools lsp update readme to include consult-lsp --- modules/tools/lsp/README.org | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/tools/lsp/README.org b/modules/tools/lsp/README.org index bbd277d8e..505c81c4d 100644 --- a/modules/tools/lsp/README.org +++ b/modules/tools/lsp/README.org @@ -67,8 +67,9 @@ As of this writing, this is the state of LSP support in Doom Emacs: ** Plugins + [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]] + [[https://github.com/emacs-lsp/lsp-ui][lsp-ui]] -+ [[https://github.com/emacs-lsp/lsp-ivy][lsp-ivy]] -+ [[https://github.com/emacs-lsp/helm-lsp][helm-lsp]] ++ [[https://github.com/emacs-lsp/lsp-ivy][lsp-ivy]] (=:completion ivy=) ++ [[https://github.com/emacs-lsp/helm-lsp][helm-lsp]] (=:completion helm=) ++ [[https://github.com/gagbo/consult-lsp][consult-lsp]] (=:completion selectrum=) + [[https://github.com/joaotavora/eglot][eglot]] * Prerequisites @@ -85,8 +86,9 @@ including instructions to register your own. * TODO Features ** LSP-powered project search -Without the =+eglot= flag, and when =:completion ivy= or =:completion helm= is -active, LSP is used to search a symbol indexed by the LSP server : +Without the =+eglot= flag, and when =:completion ivy=, =:completion helm= or +=:completion selectrum= is active, LSP is used to search a symbol indexed by the +LSP server : | Keybind | Description | |-----------+-------------------------------------| | =SPC c j= | Jump to symbol in current workspace | From 2868177057f6780b9f3db56a218d5b05e6f4e03b Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 16:34:48 +0300 Subject: [PATCH 081/147] Bump :completion selectrum raxod502/selectrum@bfefb8e -> raxod502/selectrum@909f614 oantolin/orderless@d97a91f -> oantolin/orderless@9637d7f minad/consult@c839b82 -> minad/consult@a7964f6 oantolin/embark@7c850c0 -> oantolin/embark@0086413 minad/marginalia@445d283 -> minad/marginalia@624028c --- modules/completion/selectrum/packages.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 4f9b8c823..5464777cf 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,19 +1,19 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "bfefb8e1a350d44b56290b2c7ddc3418ec217b30") +(package! selectrum :pin "909f614319dad6c7eeebb76b2c2501e8215718ea") (if (featurep! +prescient) (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") - (package! orderless :pin "d97a91f6e12ace638e65bdccefd14d1e638a2dae")) + (package! orderless :pin "9637d7fd59f76a5b6d37470b1543ab827a0f9b8d")) -(package! consult :pin "c839b82ce3e4db3faaecf3e9e5e2d98ad010eede") +(package! consult :pin "a7964f622e0f695f55ce86092a627a1a9d57caf5") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "c839b82ce3e4db3faaecf3e9e5e2d98ad010eede")) + (package! consult-flycheck :pin "a7964f622e0f695f55ce86092a627a1a9d57caf5")) -(package! embark :pin "7c850c07bfe29f3232ebb22793e8421772f820f1") -(package! embark-consult :pin "7c850c07bfe29f3232ebb22793e8421772f820f1") +(package! embark :pin "0086413ef295025bde774157763e00746ee8fbf6") +(package! embark-consult :pin "0086413ef295025bde774157763e00746ee8fbf6") -(package! marginalia :pin "445d2832a2f06484ad28d9b55676c52d63cd0a46") +(package! marginalia :pin "624028c69b55deb3387452b9eeabe9cb963bd2a4") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From a52b9cf686b88a0e9d4f57147544fa8fd9d9629d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 17 May 2021 16:40:06 +0300 Subject: [PATCH 082/147] selectrum: change embark-consult-preview-at-point... to consult-preview-at-point following upstream --- modules/completion/selectrum/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 228d31847..602a79e68 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -138,7 +138,7 @@ :after (embark consult) :demand t :hook - (embark-collect-mode . embark-consult-preview-minor-mode)) + (embark-collect-mode . consult-preview-minor-mode)) (use-package! wgrep :commands wgrep-change-to-wgrep-mode From 23a47acc06a391b9a019846e6f0695079b4c4819 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 18 May 2021 21:17:23 +0300 Subject: [PATCH 083/147] selectrum: set manual preview to all grep variants --- modules/completion/selectrum/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 602a79e68..b7d396c07 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -106,7 +106,8 @@ (lambda (x) (setf (alist-get x consult-config) (list :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k"))))) - '(consult-bookmark consult-recent-file consult--grep consult-theme))) + '(consult-bookmark consult-recent-file consult-theme + consult--grep consult-grep consult-ripgrep consult-git-grep +default/search-project))) (use-package! consult-flycheck :when (featurep! :checkers syntax) From 49a5c5161541e0424a9e40566aefb9e040cf531f Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 20 May 2021 17:45:30 +0300 Subject: [PATCH 084/147] selectrum: fix bugs when counsel is loaded (hack) some doom functions check the completion module with `fboundp`'s instead of `featurep!`, and counsel can be loaded by using e.g. `lispy`. we add temporary fixes for this by checking for selectrum stuff first, but this should be given a more robust fix later on also we document the selectrum PR's hacks in the TODO.org see discussion on #5013 --- core/autoload/projects.el | 2 ++ modules/completion/selectrum/TODO.org | 10 ++++++++++ modules/config/default/autoload/text.el | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 0af779171..57d4c8b01 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -128,6 +128,8 @@ If DIR is not a project, it will be indexed (but not cached)." (if (doom-module-p :completion 'ivy) #'counsel-projectile-find-file #'projectile-find-file))) + ((fboundp 'selectrum-mode) ;HACK see @ymarco's comment on #5013 and TODO.org in the selecturm module. + (call-interactively #'find-file)) ((fboundp 'counsel-file-jump) ; ivy only (call-interactively #'counsel-file-jump)) ((project-current nil dir) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 966b4bc8b..89787c607 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -10,6 +10,16 @@ regular isearch for now. ** TODO =SPC s B= Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. +* PROJ HACKs to be addressed +** ~fboundp~ issues +Even if the =ivy= module isn't loaded, it's packages can still get loaded by +other means, such as =lispy= requiring =counsel=. This means that the ~fboundp~ +logic such [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] and [[file:~/.emacs.d/core/autoload/projects.el::((fboundp 'selectrum-mode) ;HACK see @ymarco's comment on #5013 and TODO.org][here]] won't work unless the selectrum option is checked +first, which is what we do for now. +** ~projectile-switch-project-action~ definition +Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs review][this]] change new projects don't get opened in a new tab, but the exact +working of this whole set up are a bit opaque to me. + * PROJ Bugs ** TODO =C-SPC= and live previews Automatic live previews have been disabled on slow ~consult~ commands. diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index b70848c3a..5da7f4937 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -27,8 +27,8 @@ "Interactively select what text to insert from the kill ring." (interactive) (call-interactively - (cond ((fboundp 'counsel-yank-pop) #'counsel-yank-pop) - ((fboundp 'consult-yank-pop) #'consult-yank-pop) + (cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;HACK see @ymarco's comment on #5013 and TODO.org in the selecturm module. + ((fboundp 'counsel-yank-pop) #'counsel-yank-pop) ((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring) ((error "No kill-ring search backend available. Enable ivy, helm or selectrum!"))))) From 24f2efd8caa17c534fb658611c578b4bd476d9f8 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 21 May 2021 18:28:38 +0300 Subject: [PATCH 085/147] selectrum: refactor +irc/selectrum-jump-to-channel --- modules/app/irc/autoload/irc.el | 10 +++++++ modules/app/irc/autoload/selectrum.el | 40 +++++++++++++-------------- modules/app/irc/config.el | 6 ++-- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/modules/app/irc/autoload/irc.el b/modules/app/irc/autoload/irc.el index 85f9f36c7..cc739fb78 100644 --- a/modules/app/irc/autoload/irc.el +++ b/modules/app/irc/autoload/irc.el @@ -72,6 +72,16 @@ argument) is non-nil only show channels in current server." ((featurep! :completion selectrum) #'+irc/selectrum-jump-to-channel) ((user-error "No jump-to-channel backend is enabled. Enable selectrum or ivy!"))))) +;;;###autoload +(defun +irc--circe-all-buffers () + (cl-loop with servers = (circe-server-buffers) + for server in servers + collect server + nconc + (with-current-buffer server + (cl-loop for buf in (circe-server-chat-buffers) + collect buf)))) + ;;;###autoload (defun +irc/tracking-next-buffer () "Disables switching to an unread buffer unless in the irc workspace." diff --git a/modules/app/irc/autoload/selectrum.el b/modules/app/irc/autoload/selectrum.el index 5bd5532a2..db343950f 100644 --- a/modules/app/irc/autoload/selectrum.el +++ b/modules/app/irc/autoload/selectrum.el @@ -2,24 +2,22 @@ ;;;###if (featurep! :completion selectrum) ;;;###autoload -(defun +irc/selectrum-jump-to-channel (&optional this-server) - "Jump to an open channel or server buffer with selectrum. If THIS-SERVER (universal -argument) is non-nil only show channels in current server." - (interactive "P") - (if (not (circe-server-buffers)) - (message "No circe buffers available") - (when (and this-server (not circe-server-buffer)) - (setq this-server nil)) - (when-let - ((buffer (completing-read - (format "Jump to%s: " (if this-server (format " (%s)" (buffer-name circe-server-buffer)) "")) - (cl-loop with servers = (if this-server (list circe-server-buffer) (circe-server-buffers)) - with current-buffer = (current-buffer) - for server in servers - collect (buffer-name server) - nconc - (with-current-buffer server - (cl-loop for buf in (circe-server-chat-buffers) - unless (eq buf current-buffer) - collect (buffer-name buf))))))) - (switch-to-buffer buffer)))) +(defun +irc/selectrum-jump-to-channel () + "Jump to an open channel or server buffer with selectrum." + (interactive) + (require 'consult) + (consult--multi (list (plist-put +irc--consult-circe-source + :hidden nil)) + :narrow nil + :require-match t + :prompt "Jump to:" + :sort nil)) + +;;;###autoload +(defvar +irc--consult-circe-source + `(:name "circe" + :hidden t + :narrow ?c + :category buffer + :state ,#'consult--buffer-state + :items ,(lambda () (mapcar #'buffer-name (+irc--circe-all-buffers))))) diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index 2cb073adc..d301fc0db 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -141,9 +141,9 @@ playback.") ;; Fail gracefully if not in a circe buffer (global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer) - (after! marginalia - (when (featurep! :completion selectrum) - (add-to-list 'marginalia-command-categories '(+irc/selectrum-jump-to-channel . buffer)))) + (when (featurep! :completion selectrum) + (after! consult + (add-to-list 'consult-buffer-sources '+irc--consult-circe-source 'append))) (map! :localleader (:map circe-mode-map From 747f1e38b381a174ce2ba8f4fcbb6669ffbd4cdc Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 20 May 2021 21:02:47 +0300 Subject: [PATCH 086/147] selectrum: update TODO.org --- modules/completion/selectrum/TODO.org | 31 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 89787c607..e81ba4d29 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,7 +1,9 @@ * PROJ Design Decisions ** TODO bind =consult-lsp-diagnostics= to something? -** TODO Make sure we have all vanilla keybindings -** TODO Add keybinding for embark-act outside of the minibuffer +** WAIT Add keybinding for embark-act outside of the minibuffer +Idealy would replace =C-o= as the default binding. Current suggestion is both +=:leader a= and =C-,=. Note that =C-,= is bound to ~org-cycle-agenda-files~ but +so is =C-'=. ** TODO consider dropping prescient flag ** TODO =SPC s s= and =SPC s S= ~:sw~ ? There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ @@ -9,6 +11,13 @@ does something else (give you previously used isearch search terms). Bound to regular isearch for now. ** TODO =SPC s B= Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. +** TODO orderless style dispatchers +currently we just copy the ones of the consult wiki (sans file extentions), but +these lead to an unexpected issue: typing e.g. =setq!= will not match ~setq!~ +due to the postfix without literal match (you need to type =setq!==). This is +undesireable since doom uses a lot of macros that end with =!=. Having the +dispatching work in both post and prefix is useful (since it lets you do +post-hoc changes to your typing), but having a one-off extention is inconsistant * PROJ HACKs to be addressed ** ~fboundp~ issues @@ -41,8 +50,6 @@ https://github.com/oantolin/orderless/issues/41 Unlike Ivy, ~selectrum-repeat~ doesn't restore the position of the selection in the completion buffer. Seems to be reproduced in ~emacs -Q~. If so, create upstream selectrum issue. -** TODO go over definition of ~+selectrum-file-search~ -check if anything else there needs to be cleaned up. ** TODO Embark export window buffer switching logic If we export bookmarks, grep session, or ~find-file~ session, when pressing enter, it opens the new buffer in another window rather than the main one, even @@ -52,11 +59,13 @@ grep case due to a custom ivy occur window switching function. ** TODO selectrum =SPC /= is much slower than ivy =SPC /= requires further investigation. is ~consult-ripgrep~ slower than ~counsel-rg~? is it something the custom search function is doing? does ivy cache stuff? + * PROJ Missing Features ** TODO Icons https://github.com/minad/marginalia/issues/59 -** TODO =C-C C-e= wgrep fun -check if we can add this to ~consult-line~ too +** WAIT =C-C C-e= wgrep fun +- rework into using ~embark-export~ directly, after [[https://github.com/oantolin/embark/issues/226][this issue]] gets resolved +- check if we can add this to ~consult-line~ too ** TODO bibtex-actions improvements? currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different @@ -64,6 +73,16 @@ ones. Binding the ~bibtex-actions-map~ there would probably be better, but there are nontrivial loading order shenanigans happening that make that not straightforward. ** TODO Ivy Parity *** TODO pass module +*** TODO remaps +refactor these to use consult so previews can work, also maybe have narrowed number keys for workspaces? +#+begin_src elisp + [remap switch-to-buffer] #'+ivy/switch-buffer + [remap switch-to-buffer-other-window] #'+ivy/switch-buffer-other-window + [remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer + [remap evil-show-jumps] #'+ivy/jump-list +#+end_src +*** TODO ~+irc/selectrum-jump-to-channel~ +rework to use ~consult~ buffer narrowing, for some reason the current attempt breaks marginalia annotating *** WAIT lookup module - ~dash-docs~ backend (needs to be created) - ~+lookup--online..~ functionality (needs a consult analogue of ~counsel-search~) From 308c6798d3f47ad5d45fdd83838554ab28030724 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 20 May 2021 22:09:41 +0300 Subject: [PATCH 087/147] selectrum: drop foo! orderless style dispatch conflicts with `!` final macros. also elaborate why we should drop the prescient flag --- modules/completion/selectrum/README.org | 7 ++++--- modules/completion/selectrum/TODO.org | 13 ++++++------- modules/completion/selectrum/config.el | 1 - 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 34b809f04..6c6f2f272 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -147,13 +147,14 @@ A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet). ** Orderless filtering When using orderless to filter through candidates, the default behaviour is for -each space separated inputs to match the candidate as a regular expression or +each space separated input to match the candidate as a regular expression or literally. -You can further specify each space separated input in the following ways: +Doom has some builtin [[https://github.com/oantolin/orderless#style-dispatchers][style dispatchers]] for more finegrained filtering, which +you can use to further specify each space separated input in the following ways: | Input | Description | |------------------+--------------------------------------------| -| =!foo= or =foo!= | match without literal input =foo= | +| =!foo= | match without literal input =foo= | | =`bar= or =bar`= | match input =bar= as an initialism | | ==baz= or =baz== | match only with literal input =baz= | | =~qux= or =qux~= | match input =qux= with fuzzy/flex matching | diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index e81ba4d29..be99a1eb0 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -5,6 +5,10 @@ Idealy would replace =C-o= as the default binding. Current suggestion is both =:leader a= and =C-,=. Note that =C-,= is bound to ~org-cycle-agenda-files~ but so is =C-'=. ** TODO consider dropping prescient flag +The only advantage over orderless is frecency over recency, without the better +integration orderless has with built in emacs completion. A compromise might be +to have ~+prescient~ just add prescient sorting, but it's probably not worth the +maintenance burden. ** TODO =SPC s s= and =SPC s S= ~:sw~ ? There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). Bound to @@ -12,13 +16,8 @@ regular isearch for now. ** TODO =SPC s B= Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. ** TODO orderless style dispatchers -currently we just copy the ones of the consult wiki (sans file extentions), but -these lead to an unexpected issue: typing e.g. =setq!= will not match ~setq!~ -due to the postfix without literal match (you need to type =setq!==). This is -undesireable since doom uses a lot of macros that end with =!=. Having the -dispatching work in both post and prefix is useful (since it lets you do -post-hoc changes to your typing), but having a one-off extention is inconsistant - +Currently the =!= style dispatcher is only as a prefix, due to the abundance of +=!= final macros. In my opinion this is useful enough to break consistency. * PROJ HACKs to be addressed ** ~fboundp~ issues Even if the =ivy= module isn't loaded, it's packages can still get loaded by diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index b7d396c07..f4321e398 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -55,7 +55,6 @@ ((string= "!" pattern) `(orderless-literal . "")) ;; Without literal ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1))) - ((string-suffix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 0 -1))) ;; Initialism matching ((string-prefix-p "`" pattern) `(orderless-initialism . ,(substring pattern 1))) ((string-suffix-p "`" pattern) `(orderless-initialism . ,(substring pattern 0 -1))) From 436794aa870212cb574c23246d30a2f37517d58b Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 20 May 2021 22:18:57 +0300 Subject: [PATCH 088/147] Bump :completion selectrum raxod502/selectrum@909f614 -> raxod502/selectrum@a922b19 minad/consult@a7964f6 -> minad/consult@556ff4e oantolin/embark@0086413 -> oantolin/embark@a21e510 --- modules/completion/selectrum/packages.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 5464777cf..cbee603f3 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,18 +1,18 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "909f614319dad6c7eeebb76b2c2501e8215718ea") +(package! selectrum :pin "a922b19f715ad6d046072a35a3df5ac5e4ed73d3") (if (featurep! +prescient) (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") (package! orderless :pin "9637d7fd59f76a5b6d37470b1543ab827a0f9b8d")) -(package! consult :pin "a7964f622e0f695f55ce86092a627a1a9d57caf5") +(package! consult :pin "556ff4eb31eb1d00a2afdda6664d03b698264e3c") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "a7964f622e0f695f55ce86092a627a1a9d57caf5")) + (package! consult-flycheck :pin "556ff4eb31eb1d00a2afdda6664d03b698264e3c")) -(package! embark :pin "0086413ef295025bde774157763e00746ee8fbf6") -(package! embark-consult :pin "0086413ef295025bde774157763e00746ee8fbf6") +(package! embark :pin "a21e510bc63c8ddc98b2bb3e6fff38e9d7f41ca9") +(package! embark-consult :pin "a21e510bc63c8ddc98b2bb3e6fff38e9d7f41ca9") (package! marginalia :pin "624028c69b55deb3387452b9eeabe9cb963bd2a4") From 85be33556b3db9cfe574afe84dbb7f2101f23c55 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 20 May 2021 22:20:20 +0300 Subject: [PATCH 089/147] selectrum: simplify +selectrum/embark-wgrep now that oantolin/embark#226 has been resolved. --- modules/completion/selectrum/TODO.org | 3 +-- .../selectrum/autoload/selectrum.el | 20 ++++--------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index be99a1eb0..2a157cb0d 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -62,8 +62,7 @@ is it something the custom search function is doing? does ivy cache stuff? * PROJ Missing Features ** TODO Icons https://github.com/minad/marginalia/issues/59 -** WAIT =C-C C-e= wgrep fun -- rework into using ~embark-export~ directly, after [[https://github.com/oantolin/embark/issues/226][this issue]] gets resolved +** TODO =C-C C-e= wgrep fun - check if we can add this to ~consult-line~ too ** TODO bibtex-actions improvements? currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 1c683dae5..76891cb10 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -81,19 +81,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones." (require 'wgrep) (pcase-let ((`(,type . ,candidates) (run-hook-with-args-until-success 'embark-candidate-collectors))) - (if (null candidates) - (user-error "No candidates for export") - (if (eq type 'consult-grep) - (embark--quit-and-run - (lambda () - (let ((buf (generate-new-buffer "*Embark Export Wgrep*"))) - (with-current-buffer buf - (insert (propertize "Exported grep results:\n\n" 'wgrep-header t)) - (dolist (line candidates) (insert line "\n")) - (goto-char (point-min)) - (grep-mode) - (setq-local wgrep-header/footer-parser #'ignore) - (wgrep-setup)) - (pop-to-buffer buf) - (wgrep-change-to-wgrep-mode)))) - (user-error "embark category %S doesn't support wgrep" type))))) + (if (not (eq type 'consult-grep)) + (user-error "embark category %S doesn't support wgrep" type) + (let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode)) + (embark-export))))) From 23a63ba5c46aac401459ff2dde1c45ed73823659 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 21 May 2021 13:19:52 +0300 Subject: [PATCH 090/147] selectrum: generalize +selectrum/embark-wgrep now tries to open a writable export of the same vein. add exports to `wdired` from `find-file` and `occur-edit` from `consult-line`. --- modules/completion/selectrum/README.org | 4 +++- modules/completion/selectrum/TODO.org | 5 +++-- .../completion/selectrum/autoload/selectrum.el | 18 ++++++++++++------ modules/completion/selectrum/config.el | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 6c6f2f272..4ec0d0e3b 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -113,7 +113,7 @@ This module provides some in buffer searching bindings: https://assets.doomemacs.org/completion/selectrum/buffer-search.png -A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet). +An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=. ** Selectrum integration for various completing commands *** General @@ -133,6 +133,8 @@ A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet). | =SPC b b=, =SPC ,= | Switch to buffer in current workspace | | =SPC b B=, =SPC <= | Switch to buffer | +~find-file~ commands support exported to a =wdired= buffer using =C-c C-e=. + *** Search | Keybind | Description | |-----------+-------------------------------------------| diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 2a157cb0d..236820d7b 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -18,6 +18,9 @@ Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. ** TODO orderless style dispatchers Currently the =!= style dispatcher is only as a prefix, due to the abundance of =!= final macros. In my opinion this is useful enough to break consistency. +** TODO =C-c C-e= +on ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit but breaks slightly from the =C-c C-e= = =wgrep= convention. + * PROJ HACKs to be addressed ** ~fboundp~ issues Even if the =ivy= module isn't loaded, it's packages can still get loaded by @@ -62,8 +65,6 @@ is it something the custom search function is doing? does ivy cache stuff? * PROJ Missing Features ** TODO Icons https://github.com/minad/marginalia/issues/59 -** TODO =C-C C-e= wgrep fun -- check if we can add this to ~consult-line~ too ** TODO bibtex-actions improvements? currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 76891cb10..faacc965d 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -75,13 +75,19 @@ If ARG (universal argument), include all files, even hidden or compressed ones." (consult-line (thing-at-point 'symbol))) ;;;###autoload -(defun +selectrum/embark-wgrep () - "Invoke a wgrep buffer on the current selectrum results, if supported." +(defun +selectrum/embark-export-write () + "Export the current selectrum results to a writable buffer if possible. + +Supports exporting consult-grep to wgrep, file to wdeired, and consult-location to occur-edit" (interactive) (require 'wgrep) (pcase-let ((`(,type . ,candidates) (run-hook-with-args-until-success 'embark-candidate-collectors))) - (if (not (eq type 'consult-grep)) - (user-error "embark category %S doesn't support wgrep" type) - (let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode)) - (embark-export))))) + (pcase type + ('consult-grep (let ((embark-after-export-hook #'wgrep-change-to-wgrep-mode)) + (embark-export))) + ('file (let ((embark-after-export-hook #'wdired-change-to-wdired-mode)) + (embark-export))) + ('consult-location (let ((embark-after-export-hook #'occur-edit-mode)) + (embark-export))) + (x (user-error "embark category %S doesn't support writable export" x))))) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index f4321e398..d3a12177a 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -31,7 +31,7 @@ (map! :map selectrum-minibuffer-map "C-o" #'embark-act "C-c C-o" #'embark-export - "C-c C-e" #'+selectrum/embark-wgrep + "C-c C-e" #'+selectrum/embark-export-write [backspace] #'+selectrum/backward-updir)) (use-package! selectrum-prescient From 188fc09d7285a3b134d4dc9f0ca5a4099c542740 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 21 May 2021 16:38:54 +0300 Subject: [PATCH 091/147] selectrum: improve SPC b b - Now uses a consult backend - has buffer preview, per workspace narrowing with `$n SPC` --- modules/completion/selectrum/README.org | 7 ++- modules/completion/selectrum/TODO.org | 12 ++--- .../selectrum/autoload/workspaces.el | 47 +++++++++++++++++++ modules/completion/selectrum/config.el | 3 +- 4 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 modules/completion/selectrum/autoload/workspaces.el diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 4ec0d0e3b..b35717633 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -133,7 +133,12 @@ An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=. | =SPC b b=, =SPC ,= | Switch to buffer in current workspace | | =SPC b B=, =SPC <= | Switch to buffer | -~find-file~ commands support exported to a =wdired= buffer using =C-c C-e=. +=SPC b b= and =SPC ,= support changing the workspace you're selecting a buffer from +via [[https://github.com/minad/consult#narrowing-and-grouping][Consult narrowing]], e.g. if you're on the first workspace, you can switch to +selecting a buffer from the third workspace by typing =3 SPC= into the prompt, +or the last workspace by typing =0 SPC=. + +=SPC f f= and =SPC .= support exporting to a =wdired= buffer using =C-c C-e=. *** Search | Keybind | Description | diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 236820d7b..f6c08d737 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -70,16 +70,12 @@ currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different ones. Binding the ~bibtex-actions-map~ there would probably be better, but there are nontrivial loading order shenanigans happening that make that not straightforward. +** TODO buffer switching +- =SPC b b= should switch workspace after choosing a buffer from a different one +- universal argument for opening buffer in another window? ** TODO Ivy Parity *** TODO pass module -*** TODO remaps -refactor these to use consult so previews can work, also maybe have narrowed number keys for workspaces? -#+begin_src elisp - [remap switch-to-buffer] #'+ivy/switch-buffer - [remap switch-to-buffer-other-window] #'+ivy/switch-buffer-other-window - [remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer - [remap evil-show-jumps] #'+ivy/jump-list -#+end_src +*** TODO ~+ivy/jump-list~ analogue *** TODO ~+irc/selectrum-jump-to-channel~ rework to use ~consult~ buffer narrowing, for some reason the current attempt breaks marginalia annotating *** WAIT lookup module diff --git a/modules/completion/selectrum/autoload/workspaces.el b/modules/completion/selectrum/autoload/workspaces.el new file mode 100644 index 000000000..673fc975e --- /dev/null +++ b/modules/completion/selectrum/autoload/workspaces.el @@ -0,0 +1,47 @@ +;;; completion/selectrum/autoload/workspaces.el -*- lexical-binding: t; -*- +;;;###if (featurep! :ui workspaces) + +;;;###autoload +(defun +selectrum--workspace-nth-source (n) + "Generate a consult buffer source for buffers in the NTH workspace" + (cond ((numberp n) + `(:name ,(nth (1- n) (+workspace-list-names)) + :hidden ,(not (string= (+workspace-current-name) (nth (1- n) (+workspace-list-names)))) + :narrow ,(string-to-char (number-to-string n)) + :category buffer + :state ,#'consult--buffer-state + :items ,(lambda () (mapcar #'buffer-name (+workspace-buffer-list (nth (1- n) (+workspace-list))))))) + ((eq n 'final) + `(:name ,(car (last (+workspace-list-names))) + :hidden t + :narrow ?0 + :category buffer + :state ,#'consult--buffer-state + :items ,(lambda () (mapcar #'buffer-name (+workspace-buffer-list (car (last (+workspace-list)))))))) + (t + (user-error "invalid workspace source %s" n)))) + +;;;###autoload +(defun +selectrum--workspace-generate-sources () + "Generate list of consult buffer sources for all workspaces" + (mapcar #'+selectrum--workspace-nth-source '(1 2 3 4 5 6 7 8 9 final))) + +(autoload 'consult--multi "consult") +;;;###autoload +(defun +selectrum/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) + :require-match + (confirm-nonexistent-file-or-buffer) + :prompt (format "Switch to buffer (%s): " + (+workspace-current-name) + :history 'consult--buffer-history + :sort nil))) + ;; When the buffer does not belong to a source, + ;; create a new buffer with the name. + (unless (cdr buffer) + (funcall consult--buffer-display (car buffer))))) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index d3a12177a..457107630 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -91,7 +91,8 @@ [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 describe-bindings] #'embark-bindings) + [remap describe-bindings] #'embark-bindings + [remap persp-switch-to-buffer] #'+selectrum/switch-workspace-buffer) (setq completion-in-region-function #'consult-completion-in-region) :config (recentf-mode) From 89fd6b66b34549f607c723f063fe8e3d4262d969 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 22 May 2021 01:21:10 +0300 Subject: [PATCH 092/147] selectrum: add preview to non-consult functions --- modules/completion/selectrum/README.org | 2 ++ modules/completion/selectrum/TODO.org | 16 ++++--------- .../selectrum/autoload/selectrum.el | 24 +++++++++++++++++++ modules/config/default/+evil-bindings.el | 5 ++-- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index b35717633..7df385d8b 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -96,6 +96,8 @@ These keybindings are available while a search is active: | =C-c C-o= | Open a buffer with your search results | | =C-c C-e= | Open a writable buffer of your search results | | =C-SPC= | Preview the current candidate | +| =C-M-j= | Scroll down and preview. | +| =C-M-k= | Scroll up and preview. | | =C-RET= | Open the selected candidate in other-window | Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index f6c08d737..83d86a14f 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -20,6 +20,9 @@ Currently the =!= style dispatcher is only as a prefix, due to the abundance of =!= final macros. In my opinion this is useful enough to break consistency. ** TODO =C-c C-e= on ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit but breaks slightly from the =C-c C-e= = =wgrep= convention. +** TODO keep or discard =C-M-j= and =C-M-k= +Scroll up and down while previewing. Essentially shortcuts for =C-(j|k) C-SPC=. +I like having them around but I can always just add them to my private config. * PROJ HACKs to be addressed ** ~fboundp~ issues @@ -32,16 +35,6 @@ Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs revie working of this whole set up are a bit opaque to me. * PROJ Bugs -** TODO =C-SPC= and live previews -Automatic live previews have been disabled on slow ~consult~ commands. -=C-SPC= is partially implemented as the preview key for ~consult-*~ commands. -Need to get it to work for other selectrum commands such =SPC h f=. -#+begin_src emacs-lisp - (let ((embark-quit-after-action nil)) - (map! :map minibuffer-local-map "C-SPC" #'embark-default-action))) -#+end_src -gets us close but moves the cursor to the new screen which is undesirable. -probable best strategy: create an ~embark-preview~ that does this, upstream it. ** TODO ripgrep height logic bad selectrum bug caused by file descriptors https://github.com/raxod502/selectrum/issues/491 @@ -74,10 +67,9 @@ are nontrivial loading order shenanigans happening that make that not straightfo - =SPC b b= should switch workspace after choosing a buffer from a different one - universal argument for opening buffer in another window? ** TODO Ivy Parity +*** TODO =C-RET= on minibuffer? *** TODO pass module *** TODO ~+ivy/jump-list~ analogue -*** TODO ~+irc/selectrum-jump-to-channel~ -rework to use ~consult~ buffer narrowing, for some reason the current attempt breaks marginalia annotating *** WAIT lookup module - ~dash-docs~ backend (needs to be created) - ~+lookup--online..~ functionality (needs a consult analogue of ~counsel-search~) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index faacc965d..1a8e4125a 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -91,3 +91,27 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location ('consult-location (let ((embark-after-export-hook #'occur-edit-mode)) (embark-export))) (x (user-error "embark category %S doesn't support writable export" x))))) + +;;;###autoload +(defun +selectrum/embark-preview () + "Previews candidate in selectrum buffer, unless it's a consult command" + (interactive) + (unless (string-match-p "^consult" (symbol-name selectrum--last-command)) + (print selectrum--last-command) + (save-selected-window + (let ((embark-quit-after-action nil)) + (embark-default-action))))) + +;;;###autoload +(defun +selectrum/next-candidate-preview () + "Move to next candidate and preivew it" + (interactive) + (selectrum-next-candidate) + (+selectrum/embark-preview)) + +;;;###autoload +(defun +selectrum/previous-candidate-preview () + "Move to previous candidate and preview it" + (interactive) + (selectrum-previous-candidate) + (+selectrum/embark-preview)) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 78e5145b7..511fd6617 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -207,12 +207,13 @@ (:after selectrum :map selectrum-minibuffer-map "M-RET" #'selectrum-submit-exact-input + "C-SPC" #'+selectrum/embark-preview "C-j" #'selectrum-next-candidate - "C-M-j" #'selectrum-next-candidate ;; with preview, see modules/completion/selectrum/config.el + "C-M-j" #'+selectrum/next-candidate-preview "C-S-j" #'selectrum-next-page "C-s-j" #'selectrum-goto-end "C-k" #'selectrum-previous-candidate - "C-M-k" #'selectrum-previous-candidate ;; with preview, see modules/completion/selectrum/config.el + "C-M-k" #'+selectrum/previous-candidate-preview "C-S-k" #'selectrum-previous-page "C-s-k" #'selectrum-goto-beginning))) From 1f3281734a4fa77425fdea8f5f6aab961da1ba21 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 22 May 2021 01:37:22 +0300 Subject: [PATCH 093/147] Bump :completion selectrum minad/consult@556ff4e -> minad/consult@4ca7747 oantolin/embark@a21e510 -> oantolin/embark@22875aa bumping early to solve `embark-become` bug, see oantolin/embark#230 --- modules/completion/selectrum/packages.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index cbee603f3..4d6cada14 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -7,12 +7,12 @@ (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") (package! orderless :pin "9637d7fd59f76a5b6d37470b1543ab827a0f9b8d")) -(package! consult :pin "556ff4eb31eb1d00a2afdda6664d03b698264e3c") +(package! consult :pin "4ca77477e980df954d75a5abde0e6584365bf404") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "556ff4eb31eb1d00a2afdda6664d03b698264e3c")) + (package! consult-flycheck :pin "4ca77477e980df954d75a5abde0e6584365bf404")) -(package! embark :pin "a21e510bc63c8ddc98b2bb3e6fff38e9d7f41ca9") -(package! embark-consult :pin "a21e510bc63c8ddc98b2bb3e6fff38e9d7f41ca9") +(package! embark :pin "22875aa5bda21b588487b719982cbaf8410830da") +(package! embark-consult :pin "22875aa5bda21b588487b719982cbaf8410830da") (package! marginalia :pin "624028c69b55deb3387452b9eeabe9cb963bd2a4") From 14d6613192f57c0b6898be41680001b30fc06367 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 22 May 2021 23:22:17 +0300 Subject: [PATCH 094/147] selectrum: refactor consult stuff - use `consult-preview-at-point-mode` instead of `consult-preview-minor-mode` - better consult preview function detection in `+selectrum/embark-preview` --- modules/completion/selectrum/autoload/selectrum.el | 9 ++++----- modules/completion/selectrum/config.el | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 1a8e4125a..1becbb67f 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -96,11 +96,10 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location (defun +selectrum/embark-preview () "Previews candidate in selectrum buffer, unless it's a consult command" (interactive) - (unless (string-match-p "^consult" (symbol-name selectrum--last-command)) - (print selectrum--last-command) - (save-selected-window - (let ((embark-quit-after-action nil)) - (embark-default-action))))) + (unless (bound-and-true-p consult--preview-function) + (save-selected-window + (let ((embark-quit-after-action nil)) + (embark-default-action))))) ;;;###autoload (defun +selectrum/next-candidate-preview () diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 457107630..070b9a2be 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -139,7 +139,7 @@ :after (embark consult) :demand t :hook - (embark-collect-mode . consult-preview-minor-mode)) + (embark-collect-mode . consult-preview-at-point-mode)) (use-package! wgrep :commands wgrep-change-to-wgrep-mode From ed283c6363f223bf8046660f5879fba2e29f4b2c Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 23 May 2021 10:54:50 +0300 Subject: [PATCH 095/147] selectrum: make workspace source number consistent The off-by-one of the keybinding and the function input now match functions like `+workspace/switch-to-$n` --- modules/completion/selectrum/autoload/workspaces.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/autoload/workspaces.el b/modules/completion/selectrum/autoload/workspaces.el index 673fc975e..30072245e 100644 --- a/modules/completion/selectrum/autoload/workspaces.el +++ b/modules/completion/selectrum/autoload/workspaces.el @@ -5,12 +5,12 @@ (defun +selectrum--workspace-nth-source (n) "Generate a consult buffer source for buffers in the NTH workspace" (cond ((numberp n) - `(:name ,(nth (1- n) (+workspace-list-names)) - :hidden ,(not (string= (+workspace-current-name) (nth (1- n) (+workspace-list-names)))) - :narrow ,(string-to-char (number-to-string n)) + `(:name ,(nth n (+workspace-list-names)) + :hidden ,(not (string= (+workspace-current-name) (nth n (+workspace-list-names)))) + :narrow ,(string-to-char (number-to-string (1+ n))) :category buffer :state ,#'consult--buffer-state - :items ,(lambda () (mapcar #'buffer-name (+workspace-buffer-list (nth (1- n) (+workspace-list))))))) + :items ,(lambda () (mapcar #'buffer-name (+workspace-buffer-list (nth n (+workspace-list))))))) ((eq n 'final) `(:name ,(car (last (+workspace-list-names))) :hidden t @@ -24,7 +24,7 @@ ;;;###autoload (defun +selectrum--workspace-generate-sources () "Generate list of consult buffer sources for all workspaces" - (mapcar #'+selectrum--workspace-nth-source '(1 2 3 4 5 6 7 8 9 final))) + (mapcar #'+selectrum--workspace-nth-source '(0 1 2 3 4 5 6 7 8 final))) (autoload 'consult--multi "consult") ;;;###autoload From 36faa0c258cd863e80146e28417ad007f3d51c5a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 23 May 2021 15:11:38 +0300 Subject: [PATCH 096/147] selectrum: bind embark-act to SPC a and C-;... not final, might change in the review --- modules/completion/selectrum/README.org | 18 +++++----- modules/completion/selectrum/TODO.org | 47 +++++++++++++++++++++---- modules/completion/selectrum/config.el | 11 +++--- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 7df385d8b..01959a597 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -90,15 +90,15 @@ commands. These keybindings are available while a search is active: -| Keybind | Description | -|-----------+----------------------------------------------------| -| =C-o= | Open an ~embark-act~ menu to chose a useful action | -| =C-c C-o= | Open a buffer with your search results | -| =C-c C-e= | Open a writable buffer of your search results | -| =C-SPC= | Preview the current candidate | -| =C-M-j= | Scroll down and preview. | -| =C-M-k= | Scroll up and preview. | -| =C-RET= | Open the selected candidate in other-window | +| Keybind | Description | +|---------------------+----------------------------------------------------| +| =C-;=, = a= | Open an ~embark-act~ menu to chose a useful action | +| =C-c C-;= | Open a buffer with your search results | +| =C-c C-e= | Open a writable buffer of your search results | +| =C-SPC= | Preview the current candidate | +| =C-M-j= | Scroll down and preview. | +| =C-M-k= | Scroll up and preview. | +| =C-RET= | Open the selected candidate in other-window | Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 83d86a14f..3bc625025 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,9 +1,39 @@ * PROJ Design Decisions ** TODO bind =consult-lsp-diagnostics= to something? -** WAIT Add keybinding for embark-act outside of the minibuffer -Idealy would replace =C-o= as the default binding. Current suggestion is both -=:leader a= and =C-,=. Note that =C-,= is bound to ~org-cycle-agenda-files~ but -so is =C-'=. +** TODO finalize =embark-act= keybindings +They are currently set to =C-;= and = a=. The motivation for this is as follows: +*** =C-;= +Least intrusive key-chord type binding I could find. Doesn't interfere with +other keybindings for the most part (unlike =C-o= which clashes for in +minibuffer =evil-want-minibuffer= users and regular buffer evil users), with the +exception of: +- =C-;= is bound to ~flyspell-auto-correct-previous-word~. via the built in + flyspell map. +- =C-;= is bound to ~+company/complete~ in the vanilla emacs bindings. +We could also just bind it in the minibuffer if we do end up going with the +leader key. +*** Alternative chord: =C-,= +still has some overlaps, but perhaps less important: +- ~flyspell-goto-next-error~ +- ~org-cycle-agenda-files~ has redundancy in =C-'= anway. +It is however less convenient than =C-;= +*** = a= +Even though top level module dependant bindings are frowned upon, here is my +case for why this should be an exception: +- It provide a useful shortcut for a bunch of commands relevant to the symbol at + point, and seems to be better at this than built in stuff, e.g. doing = f + D= to delete a file in =eshell= doesn't work, but embark recognies that it's a + file, so = a d= does. +- other than helping with discoverability for stuff this also allows for + commands for things that are too niche for top level bindings, such as actions + on ~package!~ statements and recipes or url's. +- selectrum is slated to become the default completion module, which makes this + less of an inconsistency, but I'm not sure about the performance slowdown in + ~map!~ since that seems to be one of the main concerns. +- ~embark~ like most packages in the selectrum cinematic universe can be + installed independently, so if you find it sufficiently useful you could also + have a stripped down version of the config in doom core that is just used for + on-buffer actions. ** TODO consider dropping prescient flag The only advantage over orderless is frecency over recency, without the better integration orderless has with built in emacs completion. A compromise might be @@ -19,7 +49,8 @@ Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. Currently the =!= style dispatcher is only as a prefix, due to the abundance of =!= final macros. In my opinion this is useful enough to break consistency. ** TODO =C-c C-e= -on ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit but breaks slightly from the =C-c C-e= = =wgrep= convention. +on ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit +but breaks slightly from the =C-c C-e= = =wgrep= convention. ** TODO keep or discard =C-M-j= and =C-M-k= Scroll up and down while previewing. Essentially shortcuts for =C-(j|k) C-SPC=. I like having them around but I can always just add them to my private config. @@ -62,7 +93,8 @@ https://github.com/minad/marginalia/issues/59 currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different ones. Binding the ~bibtex-actions-map~ there would probably be better, but there -are nontrivial loading order shenanigans happening that make that not straightforward. +are nontrivial loading order shenanigans happening that make that not +straightforward. ** TODO buffer switching - =SPC b b= should switch workspace after choosing a buffer from a different one - universal argument for opening buffer in another window? @@ -72,6 +104,7 @@ are nontrivial loading order shenanigans happening that make that not straightfo *** TODO ~+ivy/jump-list~ analogue *** WAIT lookup module - ~dash-docs~ backend (needs to be created) -- ~+lookup--online..~ functionality (needs a consult analogue of ~counsel-search~) +- ~+lookup--online..~ functionality + (needs a consult analogue of ~counsel-search~) *** WAIT taskrunner module in all likelihood requires writing ~consult-taskrunner~. diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 070b9a2be..9c5dcc4bf 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -8,6 +8,9 @@ selectrum-extend-current-candidate-highlight t) (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) + (map! "C-;" #'embark-act ; to be moved to :config default if accepted + :leader + :desc "Actions" "a" #'embark-act) ; to be moved to :config default if accepted :config (setq selectrum-fix-vertical-window-height 17 selectrum-max-window-height 17) @@ -29,10 +32,10 @@ (call-interactively 'backward-delete-char))) (map! :map selectrum-minibuffer-map - "C-o" #'embark-act - "C-c C-o" #'embark-export - "C-c C-e" #'+selectrum/embark-export-write - [backspace] #'+selectrum/backward-updir)) + "C-;" #'embark-act + "C-c C-;" #'embark-export + "C-c C-e" #'+selectrum/embark-export-write + [backspace] #'+selectrum/backward-updir)) (use-package! selectrum-prescient :when (featurep! +prescient) From f29f6beec284f660f27a2f8126d64902f23c43b9 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 23 May 2021 16:00:39 +0300 Subject: [PATCH 097/147] selectrum: embark changes... - move `marginalia-cycle` binding to `M-A` as it doesn'r work as an embark action. - add popup rule to Embark Collect buffers --- modules/completion/selectrum/config.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 9c5dcc4bf..eff84c263 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -34,8 +34,11 @@ (map! :map selectrum-minibuffer-map "C-;" #'embark-act "C-c C-;" #'embark-export + :desc "Export to writable buffer" "C-c C-e" #'+selectrum/embark-export-write - [backspace] #'+selectrum/backward-updir)) + [backspace] #'+selectrum/backward-updir + :desc "Cycle marginalia views" + "M-A" #'marginalia-cycle)) (use-package! selectrum-prescient :when (featurep! +prescient) @@ -128,10 +131,9 @@ :map embark-file-map :desc "Open Dired on target" "j" #'ffap-dired :desc "Open target with sudo" "s" #'sudo-edit - :desc "Open target with vlf" "l" #'vlf - :map embark-file-map - :desc "Cycle marginalia views" "A" #'marginalia-cycle) - (set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil)) + :desc "Open target with vlf" "l" #'vlf) + (set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil) + (set-popup-rule! "^\\*Embark Collect" :size 0.35 :ttl 0 :quit nil)) (use-package! marginalia :hook (doom-first-input . marginalia-mode) From f136521c1986ed86b6037890d9baa73d232cd9fc Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 26 May 2021 01:38:18 +0300 Subject: [PATCH 098/147] selectrum: sudo-edit -> doom/sudo-find-file... doom doesn't use `sudo-edit` also update TODO with subsequent marginalia tasks --- modules/completion/selectrum/TODO.org | 5 +++++ modules/completion/selectrum/config.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 3bc625025..851366689 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -102,6 +102,11 @@ straightforward. *** TODO =C-RET= on minibuffer? *** TODO pass module *** TODO ~+ivy/jump-list~ analogue +*** TODO marginalia stuff +**** TODO (buffer) clearly mark files opened with ~doom/sudo-find-file~ (remote?) with a different color +- including remote path in parens maybe +**** TODO (buffer) have a project column and use relative paths from that +**** TODO better colors? *** WAIT lookup module - ~dash-docs~ backend (needs to be created) - ~+lookup--online..~ functionality diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index eff84c263..6c7c12c3d 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -130,7 +130,7 @@ (map! :map embark-file-map :desc "Open Dired on target" "j" #'ffap-dired - :desc "Open target with sudo" "s" #'sudo-edit + :desc "Open target with sudo" "s" #'doom/sudo-find-file :desc "Open target with vlf" "l" #'vlf) (set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil) (set-popup-rule! "^\\*Embark Collect" :size 0.35 :ttl 0 :quit nil)) From 59ca6186d226dc0c7f3a1155fa57cf470a2ffa07 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 26 May 2021 02:09:58 +0300 Subject: [PATCH 099/147] Bump :completion selectrum minad/consult@4ca7747 -> minad/consult@a4b4ced minad/consult-flycheck@4ca7747 -> minad/consult-flycheck@44e7528 oantolin/embark@22875aa -> oantolin/embark@0da967a minad/marginalia@624028c -> minad/marginalia@3f33b38 Note that before this bump consult-flycheck was in the consult repo, but has since been moved to it's own repo due to consult's pending submission to ELPA --- modules/completion/selectrum/packages.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 4d6cada14..a7d84b18d 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -7,13 +7,13 @@ (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") (package! orderless :pin "9637d7fd59f76a5b6d37470b1543ab827a0f9b8d")) -(package! consult :pin "4ca77477e980df954d75a5abde0e6584365bf404") +(package! consult :pin "a4b4ced2feda2153af2ba41fc6ee5453bac3d64f") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "4ca77477e980df954d75a5abde0e6584365bf404")) + (package! consult-flycheck :pin "44e7528d3a536755e731688c9ad9b5480b0eb880")) -(package! embark :pin "22875aa5bda21b588487b719982cbaf8410830da") -(package! embark-consult :pin "22875aa5bda21b588487b719982cbaf8410830da") +(package! embark :pin "0da967adf0b1c17c59d1c0a1c166c983afe640b2") +(package! embark-consult :pin "0da967adf0b1c17c59d1c0a1c166c983afe640b2") -(package! marginalia :pin "624028c69b55deb3387452b9eeabe9cb963bd2a4") +(package! marginalia :pin "3f33b38b7c1ecd7086942e1bd8284c54a6fd30a3") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From 4359d96c4cdc12798d294653b2226c18c3c9dca4 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 26 May 2021 02:33:13 +0300 Subject: [PATCH 100/147] selectrum: use consult-customize for preview keys --- modules/completion/selectrum/config.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 6c7c12c3d..d930debeb 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -108,12 +108,15 @@ consult-line-numbers-widen t consult-async-input-debounce 0.5 consult-async-input-throttle 0.8) - (mapc - (lambda (x) (setf - (alist-get x consult-config) - (list :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k"))))) - '(consult-bookmark consult-recent-file consult-theme - consult--grep consult-grep consult-ripgrep consult-git-grep +default/search-project))) + (consult-customize + 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-cwd +default/search-other-cwd + +default/search-notes-for-symbol-at-point + consult--source-file consult--source-project-file consult--source-bookmark + :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k")))) (use-package! consult-flycheck :when (featurep! :checkers syntax) From 8c75e07497f5143a08fe337da2be5b3f96f32d1e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 29 May 2021 16:02:02 +0300 Subject: [PATCH 101/147] selectrum: reorganize keybinding locations - bind to `minibuffer-local-map` instead of `selectrum-minibuffer-map` when possible. - move bindings and remaps to be under their relevant `use-package!` statements. --- modules/completion/selectrum/config.el | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index d930debeb..44c08488e 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -8,9 +8,6 @@ selectrum-extend-current-candidate-highlight t) (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) - (map! "C-;" #'embark-act ; to be moved to :config default if accepted - :leader - :desc "Actions" "a" #'embark-act) ; to be moved to :config default if accepted :config (setq selectrum-fix-vertical-window-height 17 selectrum-max-window-height 17) @@ -32,13 +29,7 @@ (call-interactively 'backward-delete-char))) (map! :map selectrum-minibuffer-map - "C-;" #'embark-act - "C-c C-;" #'embark-export - :desc "Export to writable buffer" - "C-c C-e" #'+selectrum/embark-export-write - [backspace] #'+selectrum/backward-updir - :desc "Cycle marginalia views" - "M-A" #'marginalia-cycle)) + [backspace] #'+selectrum/backward-updir)) (use-package! selectrum-prescient :when (featurep! +prescient) @@ -97,7 +88,6 @@ [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 describe-bindings] #'embark-bindings [remap persp-switch-to-buffer] #'+selectrum/switch-workspace-buffer) (setq completion-in-region-function #'consult-completion-in-region) :config @@ -129,6 +119,16 @@ (which-key--show-keymap "Embark" map nil nil 'no-paging) #'which-key--hide-popup-ignore-command) embark-become-indicator embark-action-indicator) + (map! "C-;" #'embark-act ; to be moved to :config default if accepted + :leader + :desc "Actions" "a" #'embark-act) ; to be moved to :config default if accepted + (map! :map minibuffer-local-map + "C-;" #'embark-act + "C-c C-;" #'embark-export + :desc "Export to writable buffer" + "C-c C-e" #'+selectrum/embark-export-write) + (define-key! + [remap describe-bindings] #'embark-bindings) :config (map! :map embark-file-map @@ -140,6 +140,10 @@ (use-package! marginalia :hook (doom-first-input . marginalia-mode) + :init + (map! :map minibuffer-local-map + :desc "Cycle marginalia views" + "M-A" #'marginalia-cycle) :config (add-to-list 'marginalia-command-categories '(persp-switch-to-buffer . buffer))) From 8aea99c770b2925a73a497eb8753c7dbc4370481 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 29 May 2021 16:19:30 +0300 Subject: [PATCH 102/147] selectrum: rework setq's for selectrum use-package - display all candidates that fit, displaying only 15 leaves a gap - move all of them to `:init` since they can be there --- modules/completion/selectrum/config.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 44c08488e..52bebd46a 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -4,17 +4,15 @@ :hook (doom-first-input . selectrum-mode) :init (setq selectrum-display-action nil - selectrum-num-candidates-displayed 15 - selectrum-extend-current-candidate-highlight t) + selectrum-extend-current-candidate-highlight t + selectrum-fix-vertical-window-height 17 + selectrum-max-window-height 17) (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) :config - (setq selectrum-fix-vertical-window-height 17 - selectrum-max-window-height 17) (defadvice! +selectrum-refresh-on-cycle (&rest _) :after 'marginalia-cycle (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))) - (defun +selectrum/backward-updir () "Delete char before or go up directory for file cagetory selectrum buffers." (interactive) @@ -27,7 +25,6 @@ (directory-file-name (expand-file-name new-path)))))) (call-interactively 'backward-delete-char))) - (map! :map selectrum-minibuffer-map [backspace] #'+selectrum/backward-updir)) From e5f3166caf14f53694aa499f4f48e5f3522b2602 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 31 May 2021 16:27:27 +0300 Subject: [PATCH 103/147] selectrum: add embark target for package! statements --- modules/completion/selectrum/config.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 52bebd46a..97b72165f 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -126,6 +126,25 @@ "C-c C-e" #'+selectrum/embark-export-write) (define-key! [remap describe-bindings] #'embark-bindings) + (defun +selectrum--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 + (search-backward "(") + (when (looking-at "(\\s-*package!\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") + (let ((pkg (match-string 1))) + (set-text-properties 0 (length pkg) nil pkg) + `(package . ,pkg)))))) + (setq embark-target-finders + '(embark-target-top-minibuffer-completion + embark-target-active-region + embark-target-collect-candidate + embark-target-completion-at-point + embark-target-url-at-point + +selectrum--embark-target-package! + embark-target-file-at-point + embark-target-custom-variable-at-point + embark-target-identifier-at-point)) :config (map! :map embark-file-map From e5e75e8dc5598a45487d0a372faecd597d250c29 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Mon, 31 May 2021 16:40:36 +0300 Subject: [PATCH 104/147] selectrum: override embark-package-map with doom... related functions --- modules/completion/selectrum/config.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 97b72165f..8a3edc221 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -151,6 +151,12 @@ :desc "Open Dired on target" "j" #'ffap-dired :desc "Open target with sudo" "s" #'doom/sudo-find-file :desc "Open target with vlf" "l" #'vlf) + (setq embark-package-map (make-sparse-keymap)) + (map! :map embark-package-map + "h" #'doom/help-packages + "b" #'doom/bump-package + "c" #'doom/help-package-config + "u" #'doom/help-package-homepage) (set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil) (set-popup-rule! "^\\*Embark Collect" :size 0.35 :ttl 0 :quit nil)) From c056e718a8f325ea5b2d1109e9d67bfcc78cbb28 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 1 Jun 2021 18:10:03 +0300 Subject: [PATCH 105/147] selectrum: don't override embark-target-finders... rather, modify it by inserting `+selectrum-embark-target-package!` in the correct position. overriding it with `setq` is a bad idea since it might be modified by other packages beforehand, or changed upstream later on. --- modules/completion/selectrum/config.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 8a3edc221..c9803eb71 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -135,17 +135,17 @@ (let ((pkg (match-string 1))) (set-text-properties 0 (length pkg) nil pkg) `(package . ,pkg)))))) - (setq embark-target-finders - '(embark-target-top-minibuffer-completion - embark-target-active-region - embark-target-collect-candidate - embark-target-completion-at-point - embark-target-url-at-point - +selectrum--embark-target-package! - embark-target-file-at-point - embark-target-custom-variable-at-point - embark-target-identifier-at-point)) :config + ;; add the package! target finder before the file target finder, + ;; so we don't get a false positive match. + (let ((pos (or (cl-position + 'embark-target-file-at-point + embark-target-finders) + (length embark-target-finders)))) + (cl-callf2 + cons + '+selectrum--embark-target-package! + (nthcdr pos embark-target-finders))) (map! :map embark-file-map :desc "Open Dired on target" "j" #'ffap-dired From ebd72b715e799cdea9bd245d05e9a776594e0a6e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 6 Jun 2021 23:06:01 +0300 Subject: [PATCH 106/147] selectrum: remove some bindings - the embark actions use packages that aren't installed or don't work - the selectrum minibuffer bindings use the super key, which will probably conflict with tiling window managers --- modules/completion/selectrum/config.el | 4 +--- modules/config/default/+evil-bindings.el | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index c9803eb71..d3a2bacf8 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -148,9 +148,7 @@ (nthcdr pos embark-target-finders))) (map! :map embark-file-map - :desc "Open Dired on target" "j" #'ffap-dired - :desc "Open target with sudo" "s" #'doom/sudo-find-file - :desc "Open target with vlf" "l" #'vlf) + :desc "Open target with sudo" "s" #'doom/sudo-find-file) (setq embark-package-map (make-sparse-keymap)) (map! :map embark-package-map "h" #'doom/help-packages diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 511fd6617..3fd8e7892 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -211,11 +211,9 @@ "C-j" #'selectrum-next-candidate "C-M-j" #'+selectrum/next-candidate-preview "C-S-j" #'selectrum-next-page - "C-s-j" #'selectrum-goto-end "C-k" #'selectrum-previous-candidate "C-M-k" #'+selectrum/previous-candidate-preview - "C-S-k" #'selectrum-previous-page - "C-s-k" #'selectrum-goto-beginning))) + "C-S-k" #'selectrum-previous-page))) ;;; :ui (map! (:when (featurep! :ui popup) From 540c52302328bafdd6d1c0faaf13273947f93090 Mon Sep 17 00:00:00 2001 From: Yoav Marco Date: Tue, 8 Jun 2021 03:58:15 +0300 Subject: [PATCH 107/147] Selectrum: add embark action to open file in new workspace --- modules/completion/selectrum/autoload/workspaces.el | 6 ++++++ modules/completion/selectrum/config.el | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/autoload/workspaces.el b/modules/completion/selectrum/autoload/workspaces.el index 30072245e..5fefd4df4 100644 --- a/modules/completion/selectrum/autoload/workspaces.el +++ b/modules/completion/selectrum/autoload/workspaces.el @@ -45,3 +45,9 @@ Use consult narrowing with another workspace number to open a buffer from that w ;; create a new buffer with the name. (unless (cdr buffer) (funcall consult--buffer-display (car buffer))))) + +;;;###autoload +(defun +selectrum-embark-open-in-new-workspace (x) + "Open X (a file) in a new workspace." + (+workspace/new) + (find-file x)) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index d3a2bacf8..8f481eec0 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -148,7 +148,8 @@ (nthcdr pos embark-target-finders))) (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) (setq embark-package-map (make-sparse-keymap)) (map! :map embark-package-map "h" #'doom/help-packages From 573bd73411898edc6ac1f0fe6ee12eea28b2896e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 2 Jun 2021 15:16:25 +0300 Subject: [PATCH 108/147] selectrum: annotate more functions --- modules/completion/selectrum/config.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 8f481eec0..b55b0435b 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -166,7 +166,10 @@ :desc "Cycle marginalia views" "M-A" #'marginalia-cycle) :config - (add-to-list 'marginalia-command-categories '(persp-switch-to-buffer . buffer))) + (nconc marginalia-command-categories + '((persp-switch-to-buffer . buffer) + (projectile-find-file . project-file) + (doom/describe-active-minor-mode . minor-mode)))) (use-package! embark-consult :after (embark consult) From fad34eb71807a94d665b011db5b044ea23d7371e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 9 Jun 2021 18:14:36 +0300 Subject: [PATCH 109/147] selectrum: README changes, TODO overhaul... - Add explanation for orderless usage - Minor wording improvements --- modules/completion/selectrum/README.org | 20 ++++++++--- modules/completion/selectrum/TODO.org | 47 ++++++++++++------------- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 01959a597..2eff299e8 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -43,10 +43,11 @@ This module has no prerequisites. * Features -Selectrum and friends modify and use the built-in ~completing-read~ function, -used by any function that requires completion. Due to this the full scope of -these packages is too large to cover here, so we will detail Doom-specific -additions: +The packages in this module modify and use the built-in ~completing-read~ +function, which is used by any function that requires completion. Due to this +the full scope of these packages is too large to cover here and you are +encouraged to go and read their excellent documentation. We will detail +Doom-specific additions: ** Jump-to navigation This module provides an interface to navigate within a project using @@ -106,7 +107,7 @@ users). https://assets.doomemacs.org/completion/selectrum/search-replace.png -** TODO In-buffer searching +** In-buffer searching This module provides some in buffer searching bindings: + =SPC s s= (~isearch~) @@ -159,6 +160,15 @@ When using orderless to filter through candidates, the default behaviour is for each space separated input to match the candidate as a regular expression or literally. +Note that due to this style of matching, pressing tab does not expand the input +to the longest matching prefix (like shell completion), but rather uses the +first matched candidate as input. Filtering further is instead achieved by +pressing space and entering another input. In essence, when trying to match +=foobar.org=, instead of option 1., use option 2.: + +1. (BAD) Enter =foo TAB=, completes to =foobar.=, enter =org RET= +2. (GOOD) Enter =foo SPC org RET= + Doom has some builtin [[https://github.com/oantolin/orderless#style-dispatchers][style dispatchers]] for more finegrained filtering, which you can use to further specify each space separated input in the following ways: | Input | Description | diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 851366689..24411a70e 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -54,41 +54,45 @@ but breaks slightly from the =C-c C-e= = =wgrep= convention. ** TODO keep or discard =C-M-j= and =C-M-k= Scroll up and down while previewing. Essentially shortcuts for =C-(j|k) C-SPC=. I like having them around but I can always just add them to my private config. +** TODO Annotation Customization +Do we want to have the annotations be more like ivy? e.g. +- have a project column in the buffer annotations and a relative path? This has some overlap with project narrowing =SPC b B p SPC. +- Mark the modified/remote status of the buffer with color, on top of the modification column? +- Change colors in general? * PROJ HACKs to be addressed -** ~fboundp~ issues +** TODO ~fboundp~ issues Even if the =ivy= module isn't loaded, it's packages can still get loaded by other means, such as =lispy= requiring =counsel=. This means that the ~fboundp~ logic such [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] and [[file:~/.emacs.d/core/autoload/projects.el::((fboundp 'selectrum-mode) ;HACK see @ymarco's comment on #5013 and TODO.org][here]] won't work unless the selectrum option is checked first, which is what we do for now. -** ~projectile-switch-project-action~ definition +** TODO ~projectile-switch-project-action~ definition Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs review][this]] change new projects don't get opened in a new tab, but the exact working of this whole set up are a bit opaque to me. -* PROJ Bugs -** TODO ripgrep height logic bad -selectrum bug caused by file descriptors -https://github.com/raxod502/selectrum/issues/491 -** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error -probably caused by some doomism -https://github.com/oantolin/orderless/issues/41 -** TODO ~selectrum-repeat~ Issues -Unlike Ivy, ~selectrum-repeat~ doesn't restore the position of the selection in -the completion buffer. Seems to be reproduced in ~emacs -Q~. If so, create -upstream selectrum issue. +* PROJ Review blocking Issues ** TODO Embark export window buffer switching logic If we export bookmarks, grep session, or ~find-file~ session, when pressing enter, it opens the new buffer in another window rather than the main one, even though at least the bookmark function ostensibly uses ~pop-to-buffer-same-window~. Ivy gets the window switched in the bookmarks and grep case due to a custom ivy occur window switching function. -** TODO selectrum =SPC /= is much slower than ivy =SPC /= -requires further investigation. is ~consult-ripgrep~ slower than ~counsel-rg~? -is it something the custom search function is doing? does ivy cache stuff? - -* PROJ Missing Features ** TODO Icons -https://github.com/minad/marginalia/issues/59 +Partially solved, seems to have interaction with selectrum height issue, so not yet implemented. +** TODO Profile selectrum =SPC /= vs ivy =SPC /= +** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error +probably caused by some doomism +https://github.com/oantolin/orderless/issues/41 + +* PROJ Upstream Issues +** TODO Selectrum separators cause size calculation bug +https://github.com/raxod502/selectrum/issues/491 +** TODO ~selectrum-repeat~ doesn't scroll to previously selected candidate +Unlike Ivy, ~selectrum-repeat~ doesn't restore the position of the selection in +the completion buffer. Seems to be reproduced in ~emacs -Q~. If so, create +upstream selectrum issue. + +* PROJ Extra credit ** TODO bibtex-actions improvements? currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different @@ -102,11 +106,6 @@ straightforward. *** TODO =C-RET= on minibuffer? *** TODO pass module *** TODO ~+ivy/jump-list~ analogue -*** TODO marginalia stuff -**** TODO (buffer) clearly mark files opened with ~doom/sudo-find-file~ (remote?) with a different color -- including remote path in parens maybe -**** TODO (buffer) have a project column and use relative paths from that -**** TODO better colors? *** WAIT lookup module - ~dash-docs~ backend (needs to be created) - ~+lookup--online..~ functionality From f315a60cccc283343f1cd6f4612710a77ab06185 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 16 Jun 2021 20:24:44 +0300 Subject: [PATCH 110/147] Bump :completion selectrum raxod502/selectrum@a922b19 -> raxod502/selectrum@a19bbe9 oantolin/orderless@9637d7f -> oantolin/orderless@2646dad minad/consult@a4b4ced -> minad/consult@f1ae224 minad/consult-flycheck@44e7528 -> minad/consult-flycheck@92b259e oantolin/embark@0da967a -> oantolin/embark@acbe1cb minad/marginalia@3f33b38 -> minad/marginalia@e31e03c --- modules/completion/selectrum/packages.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index a7d84b18d..585cae552 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,19 +1,19 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "a922b19f715ad6d046072a35a3df5ac5e4ed73d3") +(package! selectrum :pin "a19bbe94de492bf504399c093cfc5695eb630fa8") (if (featurep! +prescient) (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") - (package! orderless :pin "9637d7fd59f76a5b6d37470b1543ab827a0f9b8d")) + (package! orderless :pin "2646dad28c0819fbe9ee521d39efb9ae40e03982")) -(package! consult :pin "a4b4ced2feda2153af2ba41fc6ee5453bac3d64f") +(package! consult :pin "f1ae2244da20702525fe2991076322b9c6b34202") (when (featurep! :checkers syntax) - (package! consult-flycheck :pin "44e7528d3a536755e731688c9ad9b5480b0eb880")) + (package! consult-flycheck :pin "92b259e6a8ebe6439f67d3d7ffa44b7e64b76478")) -(package! embark :pin "0da967adf0b1c17c59d1c0a1c166c983afe640b2") -(package! embark-consult :pin "0da967adf0b1c17c59d1c0a1c166c983afe640b2") +(package! embark :pin "acbe1cba548832d295449da348719f69b9685c6f") +(package! embark-consult :pin "acbe1cba548832d295449da348719f69b9685c6f") -(package! marginalia :pin "3f33b38b7c1ecd7086942e1bd8284c54a6fd30a3") +(package! marginalia :pin "e31e03c5857bf7aada333f693caedfc3087d6297") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From 5a44c1f88039bd7a187ef0b9bb772e9a63c39190 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 18 Jun 2021 23:29:30 +0300 Subject: [PATCH 111/147] selectrum: remove side effect in irc jump function `+irc/selectrum-jump-to-channel` previously modified `+irc--consult-circe-source` in the definition, since `plist-put`, and I quote from the manual: "[] may modify plist destructively, or [] may construct a new list structure without altering the old." --- modules/app/irc/autoload/selectrum.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/app/irc/autoload/selectrum.el b/modules/app/irc/autoload/selectrum.el index db343950f..1190151de 100644 --- a/modules/app/irc/autoload/selectrum.el +++ b/modules/app/irc/autoload/selectrum.el @@ -6,7 +6,7 @@ "Jump to an open channel or server buffer with selectrum." (interactive) (require 'consult) - (consult--multi (list (plist-put +irc--consult-circe-source + (consult--multi (list (plist-put (copy-sequence +irc--consult-circe-source) :hidden nil)) :narrow nil :require-match t From 53e2c32a69805a5cb52c1a1ec3fa09720171459b Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 29 Jun 2021 12:31:04 +0300 Subject: [PATCH 112/147] Bump consult-lsp gagbo/consult-lsp@ed3cfd2 -> gagbo/consult-lsp@c882749 --- modules/tools/lsp/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tools/lsp/packages.el b/modules/tools/lsp/packages.el index 500ef029f..cc930f9fa 100644 --- a/modules/tools/lsp/packages.el +++ b/modules/tools/lsp/packages.el @@ -10,4 +10,4 @@ (when (featurep! :completion helm) (package! helm-lsp :pin "c2c6974dadfac459b1a69a1217441283874cea92")) (when (featurep! :completion selectrum) - (package! consult-lsp :pin "ed3cfd2e67fc5117819c0c739814780bb4c2d716"))) + (package! consult-lsp :pin "c882749e91e4de3bae17d825ac9950cc074b1595"))) From 3283acbde9cb5af0365dd0b29629fc1033c6d7c1 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 29 Jun 2021 20:03:26 +0300 Subject: [PATCH 113/147] selectrum: use default values for consult async timers unclear why `consult-async-input-(debounce|throttle)` were set to custom higher values in the first place. --- modules/completion/selectrum/config.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index b55b0435b..161f81332 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -92,9 +92,7 @@ (setq consult-project-root-function #'doom-project-root completion-in-region-function #'consult-completion-in-region consult-narrow-key "<" - consult-line-numbers-widen t - consult-async-input-debounce 0.5 - consult-async-input-throttle 0.8) + consult-line-numbers-widen t) (consult-customize consult-ripgrep consult-git-grep consult-grep consult-bookmark consult-recent-file From 83abd71db766b3a6c762b27a58e125e360c30d9d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 29 Jun 2021 20:16:29 +0300 Subject: [PATCH 114/147] selectrum: update TODO, add docs/modules.org entry --- docs/modules.org | 1 + modules/completion/selectrum/TODO.org | 64 +++++++++++++++++---------- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/docs/modules.org b/docs/modules.org index 4b1c91c5f..54be24d84 100644 --- a/docs/modules.org +++ b/docs/modules.org @@ -46,6 +46,7 @@ completion. + helm =+fuzzy +childframe= - *Another* search engine for love and life + ido - The /other/ *other* search engine for love and life + [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life ++ [[file:../modules/completion/selectrum/README.org][selectrum]] =+prescient= - The search engine of the future * :config Modules that configure Emacs one way or another, or focus on making it easier diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 24411a70e..f6c52ed7a 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -1,7 +1,8 @@ * PROJ Design Decisions -** TODO bind =consult-lsp-diagnostics= to something? -** TODO finalize =embark-act= keybindings -They are currently set to =C-;= and = a=. The motivation for this is as follows: +** TODO Bind =consult-lsp-diagnostics= to something? +** TODO Finalize =embark-act= keybindings +They are currently set to =C-;= and = a=. The motivation for this is as +follows: *** =C-;= Least intrusive key-chord type binding I could find. Doesn't interfere with other keybindings for the most part (unlike =C-o= which clashes for in @@ -13,20 +14,20 @@ exception of: We could also just bind it in the minibuffer if we do end up going with the leader key. *** Alternative chord: =C-,= -still has some overlaps, but perhaps less important: +Still has some overlaps, but perhaps less important: - ~flyspell-goto-next-error~ -- ~org-cycle-agenda-files~ has redundancy in =C-'= anway. +- ~org-cycle-agenda-files~ has redundancy in =C-'= anyway. It is however less convenient than =C-;= *** = a= Even though top level module dependant bindings are frowned upon, here is my case for why this should be an exception: - It provide a useful shortcut for a bunch of commands relevant to the symbol at - point, and seems to be better at this than built in stuff, e.g. doing = f - D= to delete a file in =eshell= doesn't work, but embark recognies that it's a - file, so = a d= does. + point, and seems to be better at this than built in stuff, e.g. doing + = f D= to delete a file in =eshell= doesn't work, but embark + recognises that it's a file, so = a d= does. - other than helping with discoverability for stuff this also allows for commands for things that are too niche for top level bindings, such as actions - on ~package!~ statements and recipes or url's. + on ~package!~ statements and recipes or urls. - selectrum is slated to become the default completion module, which makes this less of an inconsistency, but I'm not sure about the performance slowdown in ~map!~ since that seems to be one of the main concerns. @@ -34,7 +35,7 @@ case for why this should be an exception: installed independently, so if you find it sufficiently useful you could also have a stripped down version of the config in doom core that is just used for on-buffer actions. -** TODO consider dropping prescient flag +** TODO Consider dropping prescient flag The only advantage over orderless is frecency over recency, without the better integration orderless has with built in emacs completion. A compromise might be to have ~+prescient~ just add prescient sorting, but it's probably not worth the @@ -45,20 +46,27 @@ does something else (give you previously used isearch search terms). Bound to regular isearch for now. ** TODO =SPC s B= Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. -** TODO orderless style dispatchers +** TODO Orderless style dispatchers Currently the =!= style dispatcher is only as a prefix, due to the abundance of =!= final macros. In my opinion this is useful enough to break consistency. ** TODO =C-c C-e= -on ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit +On ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit but breaks slightly from the =C-c C-e= = =wgrep= convention. -** TODO keep or discard =C-M-j= and =C-M-k= +** TODO Keep or discard =C-M-j= and =C-M-k= Scroll up and down while previewing. Essentially shortcuts for =C-(j|k) C-SPC=. I like having them around but I can always just add them to my private config. ** TODO Annotation Customization Do we want to have the annotations be more like ivy? e.g. -- have a project column in the buffer annotations and a relative path? This has some overlap with project narrowing =SPC b B p SPC. -- Mark the modified/remote status of the buffer with color, on top of the modification column? +- Have a project column in the buffer annotations and a relative path? This has + some overlap with project narrowing =SPC b B p SPC. +- Mark the modified/remote status of the buffer with color, on top of the + modification column? - Change colors in general? +** TODO Consider renaming the module +=:completion selectrum= is a bit of a misnomer. Selectrum is probably the +most easily replaceable part of the module as it can replaced with Vertico +fairly easily, other than losing the ~selectrum-repeat~ command. However, +naming is hard™. Best alternative I can think of is =:completion modular=. * PROJ HACKs to be addressed ** TODO ~fboundp~ issues @@ -78,10 +86,18 @@ though at least the bookmark function ostensibly uses ~pop-to-buffer-same-window~. Ivy gets the window switched in the bookmarks and grep case due to a custom ivy occur window switching function. ** TODO Icons -Partially solved, seems to have interaction with selectrum height issue, so not yet implemented. +Partially solved, seems to have interaction with selectrum height issue, so not +yet implemented. +** TODO ~company~ completions get ordered really weirdly +This is due to orderless adding a bunch of other matches. + +* PROJ Review non-blocking Issues ** TODO Profile selectrum =SPC /= vs ivy =SPC /= +Check if there are other places where optimisations can be made. Perhaps the +~command-input-async~ variables can tolorate lower values. ** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error -probably caused by some doomism +Probably caused by some doomism + https://github.com/oantolin/orderless/issues/41 * PROJ Upstream Issues @@ -91,24 +107,26 @@ https://github.com/raxod502/selectrum/issues/491 Unlike Ivy, ~selectrum-repeat~ doesn't restore the position of the selection in the completion buffer. Seems to be reproduced in ~emacs -Q~. If so, create upstream selectrum issue. +** TODO Marginalia annotations sometimes disappear on ~find-file~ +https://github.com/raxod502/selectrum/issues/561 * PROJ Extra credit -** TODO bibtex-actions improvements? -currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a +** TODO =bibtex-actions= improvements? +Currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different ones. Binding the ~bibtex-actions-map~ there would probably be better, but there are nontrivial loading order shenanigans happening that make that not straightforward. -** TODO buffer switching +** TODO Buffer switching - =SPC b b= should switch workspace after choosing a buffer from a different one -- universal argument for opening buffer in another window? +- Universal argument for opening buffer in another window? ** TODO Ivy Parity *** TODO =C-RET= on minibuffer? *** TODO pass module *** TODO ~+ivy/jump-list~ analogue *** WAIT lookup module - ~dash-docs~ backend (needs to be created) -- ~+lookup--online..~ functionality - (needs a consult analogue of ~counsel-search~) +- ~+lookup--online..~ functionality (needs a consult analogue of + ~counsel-search~) *** WAIT taskrunner module in all likelihood requires writing ~consult-taskrunner~. From 336ad46c47563756450037c8f6ad63fed65107d4 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 30 Jun 2021 17:58:00 +0300 Subject: [PATCH 115/147] selectrum: clean up selectrum config - remove unnecessary configuration of `selectrum` and `selectrum-prescient` - fix type of `selectrum-fix-vertical-window-height` --- modules/completion/selectrum/config.el | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 161f81332..72f13adce 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -3,16 +3,12 @@ (use-package! selectrum :hook (doom-first-input . selectrum-mode) :init - (setq selectrum-display-action nil - selectrum-extend-current-candidate-highlight t - selectrum-fix-vertical-window-height 17 + (setq selectrum-extend-current-candidate-highlight t + selectrum-fix-vertical-window-height t selectrum-max-window-height 17) (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) :config - (defadvice! +selectrum-refresh-on-cycle (&rest _) - :after 'marginalia-cycle - (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))) (defun +selectrum/backward-updir () "Delete char before or go up directory for file cagetory selectrum buffers." (interactive) @@ -31,11 +27,7 @@ (use-package! selectrum-prescient :when (featurep! +prescient) :hook (selectrum-mode . selectrum-prescient-mode) - :hook (selectrum-mode . prescient-persist-mode) - :config - (setq selectrum-preprocess-candidates-function #'selectrum-prescient--preprocess) - (add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember) - (add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember)) + :hook (selectrum-mode . prescient-persist-mode)) (use-package! orderless :when (not (featurep! +prescient)) From 7c313fbac259d0603cbeaa8b334c9a5a1cfc98ec Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 30 Jun 2021 19:24:27 +0300 Subject: [PATCH 116/147] selectrum: autoload +selectrum/backward-updir... and make it independent of selectrum --- .../completion/selectrum/autoload/selectrum.el | 18 ++++++++++++++++++ modules/completion/selectrum/config.el | 12 ------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 1becbb67f..14d4f2a3e 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -74,6 +74,24 @@ If ARG (universal argument), include all files, even hidden or compressed ones." (interactive) (consult-line (thing-at-point 'symbol))) +;;;###autoload +(defun +selectrum/backward-updir () + "Delete char before or go up directory for file cagetory selectrum buffers." + (interactive) + (let ((metadata (completion-metadata (minibuffer-contents) + minibuffer-completion-table + minibuffer-completion-predicate))) + (if (and (eq (char-before) ?/) + (eq (completion-metadata-get metadata 'category) 'file)) + (let ((new-path (minibuffer-contents))) + (delete-region (minibuffer-prompt-end) (point-max)) + (insert (abbreviate-file-name + (file-name-directory + (directory-file-name + (expand-file-name new-path)))))) + (call-interactively 'backward-delete-char)))) + + ;;;###autoload (defun +selectrum/embark-export-write () "Export the current selectrum results to a writable buffer if possible. diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 72f13adce..107625afe 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -9,18 +9,6 @@ (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) :config - (defun +selectrum/backward-updir () - "Delete char before or go up directory for file cagetory selectrum buffers." - (interactive) - (if (and (eq (char-before) ?/) - (eq (selectrum--get-meta 'category) 'file)) - (let ((new-path (minibuffer-contents))) - (delete-region (minibuffer-prompt-end) (point-max)) - (insert (abbreviate-file-name - (file-name-directory - (directory-file-name - (expand-file-name new-path)))))) - (call-interactively 'backward-delete-char))) (map! :map selectrum-minibuffer-map [backspace] #'+selectrum/backward-updir)) From 2e6a04e53650fd969de22cc3c1afe14b5ef624f0 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Thu, 1 Jul 2021 00:11:46 +0300 Subject: [PATCH 117/147] selectrum: remove embark export/collect popup rules They don't seem to be necessary anymore, and cause issues with window opening logic when clicking on links in exported grep buffers. --- modules/completion/selectrum/TODO.org | 13 ++++++++----- modules/completion/selectrum/config.el | 4 +--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index f6c52ed7a..af7b4f441 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -80,11 +80,14 @@ working of this whole set up are a bit opaque to me. * PROJ Review blocking Issues ** TODO Embark export window buffer switching logic -If we export bookmarks, grep session, or ~find-file~ session, when pressing -enter, it opens the new buffer in another window rather than the main one, even -though at least the bookmark function ostensibly uses -~pop-to-buffer-same-window~. Ivy gets the window switched in the bookmarks and -grep case due to a custom ivy occur window switching function. +*** DONE ~grep~ +The clicking links exported grep buffers used to open in a new window, but now + open in another window. Caused by the ~set-popup-rule!~ entries for the embark + export/collect buffers. These don't seem to serve much of a purpose at this + point so they have been removed. +*** TODO Open upstream Embark issue for ~bookmark~ and ~file~ +~bookmark~ or ~file~ export buffers open the links in the same window rather than +the other one. This can be reproduces on emacs -Q. ** TODO Icons Partially solved, seems to have interaction with selectrum height issue, so not yet implemented. diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 107625afe..5de489c62 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -133,9 +133,7 @@ "h" #'doom/help-packages "b" #'doom/bump-package "c" #'doom/help-package-config - "u" #'doom/help-package-homepage) - (set-popup-rule! "^\\*Embark Export" :size 0.35 :ttl 0 :quit nil) - (set-popup-rule! "^\\*Embark Collect" :size 0.35 :ttl 0 :quit nil)) + "u" #'doom/help-package-homepage)) (use-package! marginalia :hook (doom-first-input . marginalia-mode) From 78955d8a6430733caf08f30c42536d02da160f8b Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 2 Jul 2021 02:59:47 +0300 Subject: [PATCH 118/147] selectrum: add preview debounce for consult-theme --- modules/completion/selectrum/config.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 5de489c62..e28904181 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -81,7 +81,12 @@ +default/search-cwd +default/search-other-cwd +default/search-notes-for-symbol-at-point consult--source-file consult--source-project-file consult--source-bookmark - :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k")))) + :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k"))) + (consult-customize + consult-theme + :preview-key + (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k") + :debounce 0.5 'any))) (use-package! consult-flycheck :when (featurep! :checkers syntax) From d3eff82b9d96b1ea3bc7c939bc672d8359cb79c0 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 30 Jun 2021 17:36:08 +0300 Subject: [PATCH 119/147] selectrum: add experimental vertico flag --- modules/completion/selectrum/README.org | 1 + modules/completion/selectrum/TODO.org | 27 +++++++++++++- .../selectrum/autoload/selectrum.el | 16 +++++++-- modules/completion/selectrum/config.el | 23 +++++++++--- modules/completion/selectrum/packages.el | 6 +++- modules/config/default/+emacs-bindings.el | 2 +- modules/config/default/+evil-bindings.el | 35 +++++++++++++------ 7 files changed, 90 insertions(+), 20 deletions(-) diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 2eff299e8..d6ff6c683 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -28,6 +28,7 @@ TODO instead of orderless. ** Plugins +[[https://github.com/minad/vertico][vertico]] (~+vertico~, experimental for the moment) [[https://github.com/raxod502/selectrum][selectrum]] [[https://github.com/minad/consult][consult]] [[https://github.com/oantolin/embark/][embark]] diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index af7b4f441..48d91cf87 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -66,7 +66,32 @@ Do we want to have the annotations be more like ivy? e.g. =:completion selectrum= is a bit of a misnomer. Selectrum is probably the most easily replaceable part of the module as it can replaced with Vertico fairly easily, other than losing the ~selectrum-repeat~ command. However, -naming is hard™. Best alternative I can think of is =:completion modular=. +naming is hard™. Best alternative I can think of is this: +#+begin_src emacs-lisp +:completion +;... +;ivy ;; a search engine for love and life +compleseus ;; a search engine with all the planks replaced +#+end_src +** TODO Consider dropping Selectrum in favor of Vertico: +To this end there is currently a ~+vertico~ flag to try it out, weird naming +aside. I want to do this for a few reasons: +*** Selectrum is more buggy +Selectrum has a few longstanding bugs that don't exist in Vertico, namely: [[https://github.com/raxod502/selectrum/issues/491][491]] +and [[https://github.com/raxod502/selectrum/issues/561][561]], as well as having worse handling when having lines of varying height +(important for good icon support). +*** Feature Comparison +- Minad, Vertico's author, provides a detailed comparison [[https://github.com/hlissner/doom-emacs/pull/4664#issuecomment-871524782][here]]. I will note + however that I was seriously considering the switch before he wrote this + comparison due to the frustration of dealing with the rough edges. +- Vertico doesn't support prescient, but I want to drop it anyway. +- The [[https://github.com/raxod502/selectrum#vertico][feature comparison]] in the selectrum readme has been updated to better + reflect the current state of affairs. Both Vertico and Selectrum have some + features that the other package lacks. In my mind Vertico's features are more + useful, but the feature difference is small enough for it to be less important + than the bugginess imo. +*** Vertico is more actively maintained +This might be a temporary concern, but still. * PROJ HACKs to be addressed ** TODO ~fboundp~ issues diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 14d4f2a3e..55e97f630 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -123,12 +123,24 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location (defun +selectrum/next-candidate-preview () "Move to next candidate and preivew it" (interactive) - (selectrum-next-candidate) + (if (featurep! :completion selectrum +vertico) + (vertico-next) + (selectrum-next-candidate)) (+selectrum/embark-preview)) ;;;###autoload (defun +selectrum/previous-candidate-preview () "Move to previous candidate and preview it" (interactive) - (selectrum-previous-candidate) + (if (featurep! :completion selectrum +vertico) + (vertico-previous) + (selectrum-previous-candidate)) (+selectrum/embark-preview)) + +;;;###autoload +(defun +selectrum/repeat () + "Repeat the last selectrum/vertico command." + (interactive) + (if (featurep! :completion selectrum +vertico) + (user-error "The vertico flag doesn't support repeating commands (yet)") + (selectrum-repeat))) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index e28904181..18a337de0 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -1,6 +1,7 @@ ;;; completion/selectrum/config.el -*- lexical-binding: t; -*- (use-package! selectrum + :when (not (featurep! +vertico)) :hook (doom-first-input . selectrum-mode) :init (setq selectrum-extend-current-candidate-highlight t @@ -12,6 +13,17 @@ (map! :map selectrum-minibuffer-map [backspace] #'+selectrum/backward-updir)) +(use-package! vertico + :when (featurep! +vertico) + :hook (doom-first-input . vertico-mode) + :init + (setq vertico-resize nil + vertico-count 17 + vertico-cycle t) + :config + (map! :map vertico-map + [backspace] #'+selectrum/backward-updir)) + (use-package! selectrum-prescient :when (featurep! +prescient) :hook (selectrum-mode . selectrum-prescient-mode) @@ -41,11 +53,14 @@ (setq completion-styles '(orderless) 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 . (partial-completion)))) + completion-category-overrides '((file (styles . (orderless partial-completion)))) orderless-style-dispatchers '(+selectrum-orderless-dispatch) - orderless-component-separator "[ &]" - selectrum-refine-candidates-function #'orderless-filter - selectrum-highlight-candidates-function #'orderless-highlight-matches)) + orderless-component-separator "[ &]") + ;; otherwise find-file gets different highlighting than other commands + (set-face-attribute 'completions-first-difference nil :inherit nil) + (unless (featurep! +vertico) + (setq selectrum-refine-candidates-function #'orderless-filter + selectrum-highlight-candidates-function #'orderless-highlight-matches))) (use-package! consult :defer t diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 585cae552..f66d1f329 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,7 +1,11 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(package! selectrum :pin "a19bbe94de492bf504399c093cfc5695eb630fa8") +(if (featurep! +vertico) + (package! vertico + :recipe (:host github :repo "minad/vertico") + :pin "c9157759a015ac32cb299c18c84c6d5fb34e0aa1") + (package! selectrum :pin "a19bbe94de492bf504399c093cfc5695eb630fa8")) (if (featurep! +prescient) (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index b3a7e72d2..a454e7ed6 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -464,7 +464,7 @@ "C-S-s" #'swiper-helm "C-S-r" #'helm-resume) (:when (featurep! :completion selectrum) - "C-S-r" #'selectrum-repeat) + "C-S-r" #'+selectrum/repeat) ;;; objed (:when (featurep! :editor objed +manual) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 3fd8e7892..cf2427141 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -204,16 +204,29 @@ [C-return] #'helm-grep-run-other-window-action)) (:when (featurep! :completion selectrum) - (:after selectrum - :map selectrum-minibuffer-map - "M-RET" #'selectrum-submit-exact-input - "C-SPC" #'+selectrum/embark-preview - "C-j" #'selectrum-next-candidate - "C-M-j" #'+selectrum/next-candidate-preview - "C-S-j" #'selectrum-next-page - "C-k" #'selectrum-previous-candidate - "C-M-k" #'+selectrum/previous-candidate-preview - "C-S-k" #'selectrum-previous-page))) + (:when (featurep! :completion selectrum +vertico) + (:after vertico + :map vertico-map + "M-RET" #'vertico-exit-input + "C-SPC" #'+selectrum/embark-preview + "C-j" #'vertico-next + "C-M-j" #'+selectrum/next-candidate-preview + "C-S-j" #'vertico-next-group + "C-k" #'vertico-previous + "C-M-k" #'+selectrum/previous-candidate-preview + "C-S-k" #'vertico-previous-group)) + (:when (not (featurep! :completion selectrum +vertico)) + (:after selectrum + :map selectrum-minibuffer-map + "M-RET" #'selectrum-submit-exact-input + "C-SPC" #'+selectrum/embark-preview + "C-j" #'selectrum-next-candidate + "C-M-j" #'+selectrum/next-candidate-preview + "C-S-j" #'selectrum-next-page + "C-k" #'selectrum-previous-candidate + "C-M-k" #'+selectrum/previous-candidate-preview + "C-S-k" #'selectrum-previous-page)))) + ;;; :ui (map! (:when (featurep! :ui popup) @@ -305,7 +318,7 @@ :desc "Resume last search" "'" (cond ((featurep! :completion ivy) #'ivy-resume) ((featurep! :completion helm) #'helm-resume) - ((featurep! :completion selectrum) #'selectrum-repeat)) + ((featurep! :completion selectrum) #'+selectrum/repeat)) :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point :desc "Search project" "/" #'+default/search-project From e65dffd7902bfb5b1725cea9f81fdd764e280fe7 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 2 Jul 2021 17:15:13 +0300 Subject: [PATCH 120/147] selectrum: remove `selectrum-minibuffer-map` from... `+default-minibuffer-maps`. It's derived from `minibuffer-local-map` so this is unnecessary. --- modules/config/default/config.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 36c73075a..868890484 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -16,9 +16,7 @@ ((featurep! :completion helm) '(helm-map helm-rg-map - helm-read-file-map)) - ((featurep! :completion selectrum) - '(selectrum-minibuffer-map)))) + helm-read-file-map)))) "A list of all the keymaps used for the minibuffer.") From 92586cacd4a1dcacb9fe8ddc4bd4371b8cdeca21 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 2 Jul 2021 23:32:01 +0300 Subject: [PATCH 121/147] selectrum: remove `doom-project-find-file` hack This solution doesn't rely on condition evaluation order, and doesn't contain `featurep!`'s unnecessarily. --- core/autoload/projects.el | 8 ++++---- modules/completion/selectrum/TODO.org | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 57d4c8b01..93c3117e8 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -128,13 +128,13 @@ If DIR is not a project, it will be indexed (but not cached)." (if (doom-module-p :completion 'ivy) #'counsel-projectile-find-file #'projectile-find-file))) - ((fboundp 'selectrum-mode) ;HACK see @ymarco's comment on #5013 and TODO.org in the selecturm module. - (call-interactively #'find-file)) - ((fboundp 'counsel-file-jump) ; ivy only + ((and (bound-and-true-p ivy-mode) + (fboundp 'counsel-file-jump)) (call-interactively #'counsel-file-jump)) ((project-current nil dir) (project-find-file-in nil nil dir)) - ((fboundp 'helm-find-files) + ((and (bound-and-true-p helm-mode) + (fboundp 'helm-find-files)) (call-interactively #'helm-find-files)) ((call-interactively #'find-file))))) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 48d91cf87..427e21969 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -97,7 +97,7 @@ This might be a temporary concern, but still. ** TODO ~fboundp~ issues Even if the =ivy= module isn't loaded, it's packages can still get loaded by other means, such as =lispy= requiring =counsel=. This means that the ~fboundp~ -logic such [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] and [[file:~/.emacs.d/core/autoload/projects.el::((fboundp 'selectrum-mode) ;HACK see @ymarco's comment on #5013 and TODO.org][here]] won't work unless the selectrum option is checked +logic [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] (and formerly [[file:~/.emacs.d/core/autoload/projects.el::(and (bound-and-true-p ivy-mode][here]]) won't work unless the selectrum option is checked first, which is what we do for now. ** TODO ~projectile-switch-project-action~ definition Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs review][this]] change new projects don't get opened in a new tab, but the exact From d86375a468b092b20e4fc5a75d2684cc4e7e625d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 4 Jul 2021 04:15:58 +0300 Subject: [PATCH 122/147] selectrum: add icon support Use the package `all-the-icons-completion` to add icons to vertical completion buffers. --- docs/modules.org | 2 +- modules/completion/selectrum/README.org | 2 ++ modules/completion/selectrum/TODO.org | 9 ++++++--- modules/completion/selectrum/config.el | 3 +++ modules/completion/selectrum/packages.el | 5 +++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/modules.org b/docs/modules.org index 54be24d84..7bf0a7207 100644 --- a/docs/modules.org +++ b/docs/modules.org @@ -46,7 +46,7 @@ completion. + helm =+fuzzy +childframe= - *Another* search engine for love and life + ido - The /other/ *other* search engine for love and life + [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life -+ [[file:../modules/completion/selectrum/README.org][selectrum]] =+prescient= - The search engine of the future ++ [[file:../modules/completion/selectrum/README.org][selectrum]] =+prescient +icons= - The search engine of the future * :config Modules that configure Emacs one way or another, or focus on making it easier diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index d6ff6c683..6feddfe92 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -26,6 +26,7 @@ TODO ** Module Flags + ~+prescient~ Enables prescient filtering and sorting for Selectrum searches instead of orderless. ++ ~+icons~ Adds icons to ~file~ and ~buffer~ category completion selections. ** Plugins [[https://github.com/minad/vertico][vertico]] (~+vertico~, experimental for the moment) @@ -38,6 +39,7 @@ TODO [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] [[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~) [[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) +[[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (~+icons~) * Prerequisites This module has no prerequisites. diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 427e21969..0c2a00bf1 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -92,6 +92,12 @@ and [[https://github.com/raxod502/selectrum/issues/561][561]], as well as having than the bugginess imo. *** Vertico is more actively maintained This might be a temporary concern, but still. +** TODO Icon support +The icon support works well enough when using Vertico, but is a bit dodgy on +Selectrum due to it not handling lines of varying height that well, which ends +up causing the selection to slide off the screen when moving it the to the +bottom in some cases. Hopefully we just use Vertico and this becomes a nonissue, +but it should still be taken into account. * PROJ HACKs to be addressed ** TODO ~fboundp~ issues @@ -113,9 +119,6 @@ The clicking links exported grep buffers used to open in a new window, but now *** TODO Open upstream Embark issue for ~bookmark~ and ~file~ ~bookmark~ or ~file~ export buffers open the links in the same window rather than the other one. This can be reproduces on emacs -Q. -** TODO Icons -Partially solved, seems to have interaction with selectrum height issue, so not -yet implemented. ** TODO ~company~ completions get ordered really weirdly This is due to orderless adding a bunch of other matches. diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 18a337de0..dce3dd441 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -158,6 +158,9 @@ (use-package! marginalia :hook (doom-first-input . marginalia-mode) :init + (when (featurep! +icons) + (add-hook 'marginalia-mode-hook + (lambda () (all-the-icons-completion-mode (if marginalia-mode 1 -1))))) (map! :map minibuffer-local-map :desc "Cycle marginalia views" "M-A" #'marginalia-cycle) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index f66d1f329..231601d1a 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -21,3 +21,8 @@ (package! marginalia :pin "e31e03c5857bf7aada333f693caedfc3087d6297") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") + +(when (featurep! +icons) + (package! all-the-icons-completion + :recipe (:host github :repo "iyefrat/all-the-icons-completion") + :pin "975345f1b618fd316729c3cae6d11b96db530fd4")) From 814c5b5c0c7ca6d148dba78326666619f79548ee Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 7 Jul 2021 01:24:31 +0300 Subject: [PATCH 123/147] selectrum: improve company advice - try `basic` and `partial-completion` completion styles before `orderless`, since `company-mode` is usually used in in-buffer completions where these often give much more relevant results than orderless, which can still be accessed by `&`. --- modules/completion/selectrum/TODO.org | 1 - modules/completion/selectrum/autoload/selectrum.el | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 0c2a00bf1..6f77f5831 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -119,7 +119,6 @@ The clicking links exported grep buffers used to open in a new window, but now *** TODO Open upstream Embark issue for ~bookmark~ and ~file~ ~bookmark~ or ~file~ export buffers open the links in the same window rather than the other one. This can be reproduces on emacs -Q. -** TODO ~company~ completions get ordered really weirdly This is due to orderless adding a bunch of other matches. * PROJ Review non-blocking Issues diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 55e97f630..56cb5f1a9 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -2,10 +2,11 @@ ;;;###autoload (defadvice! +selectrum--company-capf--candidates-a (fn &rest args) - "Function to help company to highlight all candidates with just -one face." + "Highlight company matches correctly, and try default completion styles before +orderless." :around 'company-capf--candidates - (let ((orderless-match-faces [completions-common-part])) + (let ((orderless-match-faces [completions-common-part]) + (completion-styles '(basic partial-completion orderless))) (apply fn args))) ;;;###autoload From bc9d2bf3a4dfea4094c9f09b40921c6aabb0e2b7 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 7 Jul 2021 01:35:28 +0300 Subject: [PATCH 124/147] selectrum: better `completion-in-region-function` `consult-completion-in-region` isn't meant to be used without a vertical completion framework --- modules/completion/selectrum/config.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index dce3dd441..3018fb556 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -9,6 +9,11 @@ selectrum-max-window-height 17) (when (featurep! +prescient) (setq completion-styles '(substring partial-completion))) + (add-hook 'selectrum-mode-hook (lambda () + (setq completion-in-region-function + (if selectrum-mode + #'consult-completion-in-region + #'completion--in-region)))) :config (map! :map selectrum-minibuffer-map [backspace] #'+selectrum/backward-updir)) @@ -20,6 +25,11 @@ (setq vertico-resize nil vertico-count 17 vertico-cycle t) + (add-hook 'vertico-mode-hook (lambda () + (setq completion-in-region-function + (if vertico-mode + #'consult-completion-in-region + #'completion--in-region)))) :config (map! :map vertico-map [backspace] #'+selectrum/backward-updir)) @@ -81,11 +91,9 @@ [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) - (setq completion-in-region-function #'consult-completion-in-region) :config (recentf-mode) (setq consult-project-root-function #'doom-project-root - completion-in-region-function #'consult-completion-in-region consult-narrow-key "<" consult-line-numbers-widen t) (consult-customize From debba414036464ff78a0ed7e50c1e3d59a3b843a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 16:38:49 +0300 Subject: [PATCH 125/147] Bump :completion selectrum minad/vertico@c915775 -> minad/vertico@9f6cd5d raxod502/selectrum@a19bbe9 -> raxod502/selectrum@48ea51a minad/consult@f1ae224 -> minad/consult@f17db95 minad/marginalia@e31e03c -> minad/marginalia@3bf0a4d --- modules/completion/selectrum/packages.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 231601d1a..3fa069e2c 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -4,21 +4,21 @@ (if (featurep! +vertico) (package! vertico :recipe (:host github :repo "minad/vertico") - :pin "c9157759a015ac32cb299c18c84c6d5fb34e0aa1") - (package! selectrum :pin "a19bbe94de492bf504399c093cfc5695eb630fa8")) + :pin "9f6cd5d431ec6d288676af80e932d928346a1b36") + (package! selectrum :pin "48ea51aa5b6959ea2a134e36cd21f727047b0677")) (if (featurep! +prescient) (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") (package! orderless :pin "2646dad28c0819fbe9ee521d39efb9ae40e03982")) -(package! consult :pin "f1ae2244da20702525fe2991076322b9c6b34202") +(package! consult :pin "f17db9520ddd612dc837f4112b6bcbb172acef85") (when (featurep! :checkers syntax) (package! consult-flycheck :pin "92b259e6a8ebe6439f67d3d7ffa44b7e64b76478")) (package! embark :pin "acbe1cba548832d295449da348719f69b9685c6f") (package! embark-consult :pin "acbe1cba548832d295449da348719f69b9685c6f") -(package! marginalia :pin "e31e03c5857bf7aada333f693caedfc3087d6297") +(package! marginalia :pin "3bf0a4db55f6267467f0a08715f4776509a3b503") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From 29c49f727eebfba1c6b3592003ce012d42a898eb Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 16:41:12 +0300 Subject: [PATCH 126/147] selectrum: use `consult-completing-read-multiple` --- modules/completion/selectrum/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 3018fb556..32cc97179 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -91,6 +91,7 @@ [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) + (advice-add #'completing-read-multiple :override #'consult-completing-read-multiple) :config (recentf-mode) (setq consult-project-root-function #'doom-project-root From 794b8c238362632f88817022f1d907c7c99b5290 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 16:43:15 +0300 Subject: [PATCH 127/147] selectrum: add `vertico-repeat` support Also change the `vertico` recipe to be able to use extensions. --- modules/completion/selectrum/autoload/selectrum.el | 2 +- modules/completion/selectrum/packages.el | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 56cb5f1a9..41e4ff9f6 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -143,5 +143,5 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location "Repeat the last selectrum/vertico command." (interactive) (if (featurep! :completion selectrum +vertico) - (user-error "The vertico flag doesn't support repeating commands (yet)") + (vertico-repeat) (selectrum-repeat))) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 3fa069e2c..5dbd1f35b 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -3,7 +3,8 @@ (if (featurep! +vertico) (package! vertico - :recipe (:host github :repo "minad/vertico") + :recipe (:host github :repo "minad/vertico" + :files ("*.el" "extensions/*.el")) :pin "9f6cd5d431ec6d288676af80e932d928346a1b36") (package! selectrum :pin "48ea51aa5b6959ea2a134e36cd21f727047b0677")) From dc6da589be9f456e9538cc02737f5673d99ec7f9 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 16:45:00 +0300 Subject: [PATCH 128/147] selectrum: fix false positive marginalia annotation... for `flycheck-error-list-set-filter`. --- modules/completion/selectrum/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 32cc97179..068b73e1e 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -177,7 +177,8 @@ (nconc marginalia-command-categories '((persp-switch-to-buffer . buffer) (projectile-find-file . project-file) - (doom/describe-active-minor-mode . minor-mode)))) + (doom/describe-active-minor-mode . minor-mode) + (flycheck-error-list-set-filter . builtin)))) (use-package! embark-consult :after (embark consult) From f9e1c99b2b75e8d515dfbb63f0df85436d1b3d95 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 19:59:44 +0300 Subject: [PATCH 129/147] completion/selectrum -> completion/vertico, part 1 - Use `vertico` as default completion engine - Drop `selectrum` and `selectrum-prescient` support --- docs/modules.org | 2 +- modules/completion/selectrum/README.org | 22 ++++---- modules/completion/selectrum/TODO.org | 51 +++---------------- .../selectrum/autoload/selectrum.el | 16 +----- modules/completion/selectrum/config.el | 30 +---------- modules/completion/selectrum/packages.el | 14 ++--- modules/config/default/+emacs-bindings.el | 2 +- modules/config/default/+evil-bindings.el | 16 +----- modules/input/layout/+bepo.el | 3 -- 9 files changed, 27 insertions(+), 129 deletions(-) diff --git a/docs/modules.org b/docs/modules.org index 7bf0a7207..7a3bae28b 100644 --- a/docs/modules.org +++ b/docs/modules.org @@ -46,7 +46,7 @@ completion. + helm =+fuzzy +childframe= - *Another* search engine for love and life + ido - The /other/ *other* search engine for love and life + [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life -+ [[file:../modules/completion/selectrum/README.org][selectrum]] =+prescient +icons= - The search engine of the future ++ [[file:../modules/completion/selectrum/README.org][selectrum]] =+icons= - The search engine of the future * :config Modules that configure Emacs one way or another, or focus on making it easier diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index 6feddfe92..7b27ab454 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -12,11 +12,11 @@ - [[#jump-to-navigation][Jump-to navigation]] - [[#project-search--replace][Project search & replace]] - [[#in-buffer-searching][In-buffer searching]] - - [[#selectrum-integration-for-various-completing-commands][Selectrum integration for various completing commands]] + - [[#vertico-integration-for-various-completing-commands][Vertico integration for various completing commands]] - [[#orderless-filtering][Orderless filtering]] * Description -This module provides Selectrum integration for a variety of Emacs commands, as +This module provides Vertico integration for a variety of Emacs commands, as well as a unified interface for project search and replace, powered by ripgrep. #+begin_quote @@ -24,20 +24,16 @@ TODO #+end_quote ** Module Flags -+ ~+prescient~ Enables prescient filtering and sorting for Selectrum searches - instead of orderless. + ~+icons~ Adds icons to ~file~ and ~buffer~ category completion selections. ** Plugins -[[https://github.com/minad/vertico][vertico]] (~+vertico~, experimental for the moment) -[[https://github.com/raxod502/selectrum][selectrum]] +[[https://github.com/minad/vertico][vertico]] [[https://github.com/minad/consult][consult]] [[https://github.com/oantolin/embark/][embark]] [[https://github.com/oantolin/embark/][embark-consult]] [[https://github.com/minad/marginalia][marginalia]] -[[https://github.com/oantolin/orderless][orderless]] (unless ~+prescient~) +[[https://github.com/oantolin/orderless][orderless]] [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] -[[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~) [[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) [[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (~+icons~) @@ -121,12 +117,12 @@ https://assets.doomemacs.org/completion/selectrum/buffer-search.png An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=. -** Selectrum integration for various completing commands +** Vertico integration for various completing commands *** General -| Keybind | Description | -|----------------+-------------------------------| -| =M-x=, =SPC := | Enhanced M-x | -| =SPC '= | Resume last Selectrum session | +| Keybind | Description | +|----------------+-----------------------------| +| =M-x=, =SPC := | Enhanced M-x | +| =SPC '= | Resume last Vertico session | *** Jump to files, buffers or projects | Keybind | Description | diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 6f77f5831..1ee66f294 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -31,21 +31,16 @@ case for why this should be an exception: - selectrum is slated to become the default completion module, which makes this less of an inconsistency, but I'm not sure about the performance slowdown in ~map!~ since that seems to be one of the main concerns. -- ~embark~ like most packages in the selectrum cinematic universe can be +- ~embark~ like most packages in the vertico cinematic universe can be installed independently, so if you find it sufficiently useful you could also have a stripped down version of the config in doom core that is just used for on-buffer actions. -** TODO Consider dropping prescient flag -The only advantage over orderless is frecency over recency, without the better -integration orderless has with built in emacs completion. A compromise might be -to have ~+prescient~ just add prescient sorting, but it's probably not worth the -maintenance burden. ** TODO =SPC s s= and =SPC s S= ~:sw~ ? -There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~ +There isn't really a vertico/consult analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). Bound to regular isearch for now. ** TODO =SPC s B= -Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now. +Vertico/Consult don't have a ~swiper-all~ analogue either. Unbound for now. ** TODO Orderless style dispatchers Currently the =!= style dispatcher is only as a prefix, due to the abundance of =!= final macros. In my opinion this is useful enough to break consistency. @@ -73,37 +68,12 @@ naming is hard™. Best alternative I can think of is this: ;ivy ;; a search engine for love and life compleseus ;; a search engine with all the planks replaced #+end_src -** TODO Consider dropping Selectrum in favor of Vertico: -To this end there is currently a ~+vertico~ flag to try it out, weird naming -aside. I want to do this for a few reasons: -*** Selectrum is more buggy -Selectrum has a few longstanding bugs that don't exist in Vertico, namely: [[https://github.com/raxod502/selectrum/issues/491][491]] -and [[https://github.com/raxod502/selectrum/issues/561][561]], as well as having worse handling when having lines of varying height -(important for good icon support). -*** Feature Comparison -- Minad, Vertico's author, provides a detailed comparison [[https://github.com/hlissner/doom-emacs/pull/4664#issuecomment-871524782][here]]. I will note - however that I was seriously considering the switch before he wrote this - comparison due to the frustration of dealing with the rough edges. -- Vertico doesn't support prescient, but I want to drop it anyway. -- The [[https://github.com/raxod502/selectrum#vertico][feature comparison]] in the selectrum readme has been updated to better - reflect the current state of affairs. Both Vertico and Selectrum have some - features that the other package lacks. In my mind Vertico's features are more - useful, but the feature difference is small enough for it to be less important - than the bugginess imo. -*** Vertico is more actively maintained -This might be a temporary concern, but still. -** TODO Icon support -The icon support works well enough when using Vertico, but is a bit dodgy on -Selectrum due to it not handling lines of varying height that well, which ends -up causing the selection to slide off the screen when moving it the to the -bottom in some cases. Hopefully we just use Vertico and this becomes a nonissue, -but it should still be taken into account. * PROJ HACKs to be addressed ** TODO ~fboundp~ issues Even if the =ivy= module isn't loaded, it's packages can still get loaded by other means, such as =lispy= requiring =counsel=. This means that the ~fboundp~ -logic [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] (and formerly [[file:~/.emacs.d/core/autoload/projects.el::(and (bound-and-true-p ivy-mode][here]]) won't work unless the selectrum option is checked +logic [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] (and formerly [[file:~/.emacs.d/core/autoload/projects.el::(and (bound-and-true-p ivy-mode][here]]) won't work unless the vertico option is checked first, which is what we do for now. ** TODO ~projectile-switch-project-action~ definition Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs review][this]] change new projects don't get opened in a new tab, but the exact @@ -122,7 +92,7 @@ the other one. This can be reproduces on emacs -Q. This is due to orderless adding a bunch of other matches. * PROJ Review non-blocking Issues -** TODO Profile selectrum =SPC /= vs ivy =SPC /= +** TODO Profile vertico =SPC /= vs ivy =SPC /= Check if there are other places where optimisations can be made. Perhaps the ~command-input-async~ variables can tolorate lower values. ** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error @@ -130,17 +100,8 @@ Probably caused by some doomism https://github.com/oantolin/orderless/issues/41 -* PROJ Upstream Issues -** TODO Selectrum separators cause size calculation bug -https://github.com/raxod502/selectrum/issues/491 -** TODO ~selectrum-repeat~ doesn't scroll to previously selected candidate -Unlike Ivy, ~selectrum-repeat~ doesn't restore the position of the selection in -the completion buffer. Seems to be reproduced in ~emacs -Q~. If so, create -upstream selectrum issue. -** TODO Marginalia annotations sometimes disappear on ~find-file~ -https://github.com/raxod502/selectrum/issues/561 - * PROJ Extra credit +** ~vertico-repeat~ doesn't reselect the candidate ** TODO =bibtex-actions= improvements? Currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 41e4ff9f6..e668292b1 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -124,24 +124,12 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location (defun +selectrum/next-candidate-preview () "Move to next candidate and preivew it" (interactive) - (if (featurep! :completion selectrum +vertico) - (vertico-next) - (selectrum-next-candidate)) + (vertico-next) (+selectrum/embark-preview)) ;;;###autoload (defun +selectrum/previous-candidate-preview () "Move to previous candidate and preview it" (interactive) - (if (featurep! :completion selectrum +vertico) - (vertico-previous) - (selectrum-previous-candidate)) + (vertico-previous) (+selectrum/embark-preview)) - -;;;###autoload -(defun +selectrum/repeat () - "Repeat the last selectrum/vertico command." - (interactive) - (if (featurep! :completion selectrum +vertico) - (vertico-repeat) - (selectrum-repeat))) diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 068b73e1e..4a691ffc6 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -1,25 +1,6 @@ ;;; completion/selectrum/config.el -*- lexical-binding: t; -*- -(use-package! selectrum - :when (not (featurep! +vertico)) - :hook (doom-first-input . selectrum-mode) - :init - (setq selectrum-extend-current-candidate-highlight t - selectrum-fix-vertical-window-height t - selectrum-max-window-height 17) - (when (featurep! +prescient) - (setq completion-styles '(substring partial-completion))) - (add-hook 'selectrum-mode-hook (lambda () - (setq completion-in-region-function - (if selectrum-mode - #'consult-completion-in-region - #'completion--in-region)))) - :config - (map! :map selectrum-minibuffer-map - [backspace] #'+selectrum/backward-updir)) - (use-package! vertico - :when (featurep! +vertico) :hook (doom-first-input . vertico-mode) :init (setq vertico-resize nil @@ -34,13 +15,7 @@ (map! :map vertico-map [backspace] #'+selectrum/backward-updir)) -(use-package! selectrum-prescient - :when (featurep! +prescient) - :hook (selectrum-mode . selectrum-prescient-mode) - :hook (selectrum-mode . prescient-persist-mode)) - (use-package! orderless - :when (not (featurep! +prescient)) :demand t :config (defun +selectrum-orderless-dispatch (pattern _index _total) @@ -67,10 +42,7 @@ orderless-style-dispatchers '(+selectrum-orderless-dispatch) orderless-component-separator "[ &]") ;; otherwise find-file gets different highlighting than other commands - (set-face-attribute 'completions-first-difference nil :inherit nil) - (unless (featurep! +vertico) - (setq selectrum-refine-candidates-function #'orderless-filter - selectrum-highlight-candidates-function #'orderless-highlight-matches))) + (set-face-attribute 'completions-first-difference nil :inherit nil)) (use-package! consult :defer t diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index 5dbd1f35b..8fc0c82ea 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -1,16 +1,12 @@ ;; -*- no-byte-compile: t; -*- ;;; completion/selectrum/packages.el -(if (featurep! +vertico) - (package! vertico - :recipe (:host github :repo "minad/vertico" - :files ("*.el" "extensions/*.el")) - :pin "9f6cd5d431ec6d288676af80e932d928346a1b36") - (package! selectrum :pin "48ea51aa5b6959ea2a134e36cd21f727047b0677")) +(package! vertico + :recipe (:host github :repo "minad/vertico" + :files ("*.el" "extensions/*.el")) + :pin "9f6cd5d431ec6d288676af80e932d928346a1b36") -(if (featurep! +prescient) - (package! selectrum-prescient :pin "4a0f5405798cfcb98ea005078ef2e2d490e922c4") - (package! orderless :pin "2646dad28c0819fbe9ee521d39efb9ae40e03982")) +(package! orderless :pin "2646dad28c0819fbe9ee521d39efb9ae40e03982") (package! consult :pin "f17db9520ddd612dc837f4112b6bcbb172acef85") (when (featurep! :checkers syntax) diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index a454e7ed6..d159c6fa5 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -464,7 +464,7 @@ "C-S-s" #'swiper-helm "C-S-r" #'helm-resume) (:when (featurep! :completion selectrum) - "C-S-r" #'+selectrum/repeat) + "C-S-r" #'vertico-repeat) ;;; objed (:when (featurep! :editor objed +manual) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index cf2427141..86efc126c 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -204,7 +204,6 @@ [C-return] #'helm-grep-run-other-window-action)) (:when (featurep! :completion selectrum) - (:when (featurep! :completion selectrum +vertico) (:after vertico :map vertico-map "M-RET" #'vertico-exit-input @@ -214,18 +213,7 @@ "C-S-j" #'vertico-next-group "C-k" #'vertico-previous "C-M-k" #'+selectrum/previous-candidate-preview - "C-S-k" #'vertico-previous-group)) - (:when (not (featurep! :completion selectrum +vertico)) - (:after selectrum - :map selectrum-minibuffer-map - "M-RET" #'selectrum-submit-exact-input - "C-SPC" #'+selectrum/embark-preview - "C-j" #'selectrum-next-candidate - "C-M-j" #'+selectrum/next-candidate-preview - "C-S-j" #'selectrum-next-page - "C-k" #'selectrum-previous-candidate - "C-M-k" #'+selectrum/previous-candidate-preview - "C-S-k" #'selectrum-previous-page)))) + "C-S-k" #'vertico-previous-group))) ;;; :ui @@ -318,7 +306,7 @@ :desc "Resume last search" "'" (cond ((featurep! :completion ivy) #'ivy-resume) ((featurep! :completion helm) #'helm-resume) - ((featurep! :completion selectrum) #'+selectrum/repeat)) + ((featurep! :completion selectrum) #'vertico-repeat)) :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point :desc "Search project" "/" #'+default/search-project diff --git a/modules/input/layout/+bepo.el b/modules/input/layout/+bepo.el index fd582dce9..cc9f2c7af 100644 --- a/modules/input/layout/+bepo.el +++ b/modules/input/layout/+bepo.el @@ -135,9 +135,6 @@ In all cases, 'h' functions go to 'c' and 'l' ones go to 'r' so the navigation k (after! helm-files (+layout-bepo-rotate-bare-keymap '(helm-read-file-map) +layout-bepo-cr-rotation-style) (+layout-bepo-rotate-keymaps '(helm-read-file-map))) - (after! selectrum - (+layout-bepo-rotate-bare-keymap '(selectrum-minibuffer-map) +layout-bepo-cr-rotation-style) - (+layout-bepo-rotate-keymaps '(selectrum-minibuffer-map))) (after! company (+layout-bepo-rotate-bare-keymap '(company-active-map company-search-map) +layout-bepo-cr-rotation-style)) (after! evil-snipe From 24eaa1317c4513b1b71030fbbe14a30c5204f0bd Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 20:16:11 +0300 Subject: [PATCH 130/147] completion/selectrum -> completion/vertico, part 2 - Rename module from `:completion selectrum` to `:completion vertico` - Rename all files involved - Do *not* yet rename all the functions, as that messes up git's rename detection. --- docs/modules.org | 2 +- init.example.el | 2 +- modules/app/irc/autoload/irc.el | 4 ++-- .../irc/autoload/{selectrum.el => vertico.el} | 6 ++--- modules/app/irc/config.el | 2 +- modules/checkers/spell/README.org | 2 +- modules/checkers/spell/autoload/+spell-fu.el | 2 +- modules/checkers/spell/config.el | 2 +- modules/checkers/spell/packages.el | 2 +- .../{selectrum => vertico}/README.org | 10 ++++---- .../{selectrum => vertico}/TODO.org | 13 +--------- .../{selectrum => vertico}/autoload/evil.el | 6 ++--- .../autoload/vertico.el} | 8 +++---- .../autoload/workspaces.el | 2 +- .../{selectrum => vertico}/config.el | 2 +- .../{selectrum => vertico}/packages.el | 2 +- modules/config/default/+emacs-bindings.el | 24 +++++++++---------- modules/config/default/+evil-bindings.el | 22 ++++++++--------- modules/config/default/autoload/search.el | 16 ++++++------- modules/config/default/autoload/text.el | 2 +- modules/config/default/config.el | 4 ++-- modules/editor/evil/+commands.el | 2 +- modules/email/mu4e/config.el | 8 +++---- modules/email/notmuch/config.el | 2 +- modules/email/notmuch/packages.el | 2 +- modules/input/layout/+bepo.el | 2 +- modules/lang/org/config.el | 4 ++-- modules/tools/biblio/config.el | 2 +- modules/tools/biblio/packages.el | 2 +- modules/tools/lookup/autoload/lookup.el | 2 +- modules/tools/lookup/config.el | 2 +- modules/tools/lsp/README.org | 4 ++-- modules/tools/lsp/packages.el | 2 +- 33 files changed, 79 insertions(+), 90 deletions(-) rename modules/app/irc/autoload/{selectrum.el => vertico.el} (79%) rename modules/completion/{selectrum => vertico}/README.org (96%) rename modules/completion/{selectrum => vertico}/TODO.org (91%) rename modules/completion/{selectrum => vertico}/autoload/evil.el (80%) rename modules/completion/{selectrum/autoload/selectrum.el => vertico/autoload/vertico.el} (94%) rename modules/completion/{selectrum => vertico}/autoload/workspaces.el (96%) rename modules/completion/{selectrum => vertico}/config.el (99%) rename modules/completion/{selectrum => vertico}/packages.el (96%) diff --git a/docs/modules.org b/docs/modules.org index 7a3bae28b..2187b1cb5 100644 --- a/docs/modules.org +++ b/docs/modules.org @@ -46,7 +46,7 @@ completion. + helm =+fuzzy +childframe= - *Another* search engine for love and life + ido - The /other/ *other* search engine for love and life + [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life -+ [[file:../modules/completion/selectrum/README.org][selectrum]] =+icons= - The search engine of the future ++ [[file:../modules/completion/vertico/README.org][vertico]] =+icons= - The search engine of the future * :config Modules that configure Emacs one way or another, or focus on making it easier diff --git a/init.example.el b/init.example.el index 74170f0f0..2db8a0009 100644 --- a/init.example.el +++ b/init.example.el @@ -24,7 +24,7 @@ ;;helm ; the *other* search engine for love and life ;;ido ; the other *other* search engine... ivy ; a search engine for love and life - ;;selectrum ; the search engine of the future + ;;vertico ; the search engine of the future :ui ;;deft ; notational velocity for Emacs diff --git a/modules/app/irc/autoload/irc.el b/modules/app/irc/autoload/irc.el index cc739fb78..c1caaeb73 100644 --- a/modules/app/irc/autoload/irc.el +++ b/modules/app/irc/autoload/irc.el @@ -69,8 +69,8 @@ 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 selectrum) #'+irc/selectrum-jump-to-channel) - ((user-error "No jump-to-channel backend is enabled. Enable selectrum or ivy!"))))) + ((featurep! :completion vertico) #'+irc/selectrum-jump-to-channel) + ((user-error "No jump-to-channel backend is enabled. Enable vertico or ivy!"))))) ;;;###autoload (defun +irc--circe-all-buffers () diff --git a/modules/app/irc/autoload/selectrum.el b/modules/app/irc/autoload/vertico.el similarity index 79% rename from modules/app/irc/autoload/selectrum.el rename to modules/app/irc/autoload/vertico.el index 1190151de..f58061dcf 100644 --- a/modules/app/irc/autoload/selectrum.el +++ b/modules/app/irc/autoload/vertico.el @@ -1,9 +1,9 @@ -;;; app/irc/autoload/selectrum.el -*- lexical-binding: t; -*- -;;;###if (featurep! :completion selectrum) +;;; app/irc/autoload/vertico.el -*- lexical-binding: t; -*- +;;;###if (featurep! :completion vertico) ;;;###autoload (defun +irc/selectrum-jump-to-channel () - "Jump to an open channel or server buffer with selectrum." + "Jump to an open channel or server buffer with vertico." (interactive) (require 'consult) (consult--multi (list (plist-put (copy-sequence +irc--consult-circe-source) diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index d301fc0db..ad079d386 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -141,7 +141,7 @@ playback.") ;; Fail gracefully if not in a circe buffer (global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer) - (when (featurep! :completion selectrum) + (when (featurep! :completion vertico) (after! consult (add-to-list 'consult-buffer-sources '+irc--consult-circe-source 'append))) diff --git a/modules/checkers/spell/README.org b/modules/checkers/spell/README.org index f8eea996f..b0fb6971f 100644 --- a/modules/checkers/spell/README.org +++ b/modules/checkers/spell/README.org @@ -46,7 +46,7 @@ This module has no dedicated maintainers. + [[https://github.com/d12frosted/flyspell-correct][flyspell-correct]] + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-ivy-interface][flyspell-correct-ivy]] (=completion/ivy=) + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-helm-interface][flyspell-correct-helm]] (=completion/helm=) - + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy=, =completion/helm= or =completion/selectrum=) + + [[https://github.com/d12frosted/flyspell-correct#flyspell-correct-popup-interface][flyspell-correct-popup]] (if *neither* =completion/ivy=, =completion/helm= or =completion/vertico=) + [[https://github.com/rolandwalker/flyspell-lazy][flyspell-lazy]] + else + [[https://gitlab.com/ideasman42/emacs-spell-fu][spell-fu]] diff --git a/modules/checkers/spell/autoload/+spell-fu.el b/modules/checkers/spell/autoload/+spell-fu.el index 4bddacf8e..33450eeab 100644 --- a/modules/checkers/spell/autoload/+spell-fu.el +++ b/modules/checkers/spell/autoload/+spell-fu.el @@ -63,7 +63,7 @@ (ispell-accept-buffer-local-defs)) (if (not (or (featurep! :completion ivy) (featurep! :completion helm) - (featurep! :completion selectrum))) + (featurep! :completion vertico))) (call-interactively #'ispell-word) (cl-destructuring-bind (start . end) (or (bounds-of-thing-at-point 'word) diff --git a/modules/checkers/spell/config.el b/modules/checkers/spell/config.el index 17dc1983e..5f94032c4 100644 --- a/modules/checkers/spell/config.el +++ b/modules/checkers/spell/config.el @@ -234,7 +234,7 @@ e.g. proselint and langtool." (require 'flyspell-correct-helm nil t))) ((and (featurep! :completion ivy) (require 'flyspell-correct-ivy nil t))) - ((featurep! :completion selectrum)) ; selectrum doesn't need any extra configuration + ((featurep! :completion vertico)) ; vertico doesn't need any extra configuration ((require 'flyspell-correct-popup nil t) ; only use popup if no compatible completion UI is enabled (setq flyspell-popup-correct-delay 0.8) (define-key popup-menu-keymap [escape] #'keyboard-quit)))) diff --git a/modules/checkers/spell/packages.el b/modules/checkers/spell/packages.el index 359e7a710..32da2eaf9 100644 --- a/modules/checkers/spell/packages.el +++ b/modules/checkers/spell/packages.el @@ -8,6 +8,6 @@ (package! flyspell-correct-ivy)) ((featurep! :completion helm) (package! flyspell-correct-helm)) - ((not (featurep! :completion selectrum)) + ((not (featurep! :completion vertico)) (package! flyspell-correct-popup))) (package! flyspell-lazy :pin "0fc5996bcee20b46cbd227ae948d343c3bef7339")) diff --git a/modules/completion/selectrum/README.org b/modules/completion/vertico/README.org similarity index 96% rename from modules/completion/selectrum/README.org rename to modules/completion/vertico/README.org index 7b27ab454..c3951f5b0 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/vertico/README.org @@ -1,4 +1,4 @@ -#+TITLE: completion/selectrum +#+TITLE: completion/vertico #+DATE: February 16, 2021 #+SINCE: v3.0.0 #+STARTUP: inlineimages @@ -52,7 +52,7 @@ Doom-specific additions: This module provides an interface to navigate within a project using =projectile=: -https://assets.doomemacs.org/completion/selectrum/projectile.png +https://assets.doomemacs.org/completion/vertico/projectile.png | Keybind | Description | |----------------------+-------------------------------------| @@ -70,7 +70,7 @@ This module provides interactive text search and replace using ripgrep. | =SPC s d= | Search this directory | | =SPC s D= | Search another directory | -https://assets.doomemacs.org/completion/selectrum/search.png +https://assets.doomemacs.org/completion/vertico/search.png Prefixing these keys with the universal argument (=SPC u= for evil users; =C-u= otherwise) changes the behavior of these commands, instructing the underlying @@ -104,7 +104,7 @@ Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil users). -https://assets.doomemacs.org/completion/selectrum/search-replace.png +https://assets.doomemacs.org/completion/vertico/search-replace.png ** In-buffer searching This module provides some in buffer searching bindings: @@ -113,7 +113,7 @@ This module provides some in buffer searching bindings: + =SPC s S= (~+selectrum/search-symbol-at-point~ via ~consult-line~) + =SPC s b= (~consult-line~) -https://assets.doomemacs.org/completion/selectrum/buffer-search.png +https://assets.doomemacs.org/completion/vertico/buffer-search.png An ~occur-edit~ buffer can be opened from ~consult-line~ with =C-c C-e=. diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/vertico/TODO.org similarity index 91% rename from modules/completion/selectrum/TODO.org rename to modules/completion/vertico/TODO.org index 1ee66f294..bfdec7c0c 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/vertico/TODO.org @@ -28,7 +28,7 @@ case for why this should be an exception: - other than helping with discoverability for stuff this also allows for commands for things that are too niche for top level bindings, such as actions on ~package!~ statements and recipes or urls. -- selectrum is slated to become the default completion module, which makes this +- vertico is slated to become the default completion module, which makes this less of an inconsistency, but I'm not sure about the performance slowdown in ~map!~ since that seems to be one of the main concerns. - ~embark~ like most packages in the vertico cinematic universe can be @@ -57,17 +57,6 @@ Do we want to have the annotations be more like ivy? e.g. - Mark the modified/remote status of the buffer with color, on top of the modification column? - Change colors in general? -** TODO Consider renaming the module -=:completion selectrum= is a bit of a misnomer. Selectrum is probably the -most easily replaceable part of the module as it can replaced with Vertico -fairly easily, other than losing the ~selectrum-repeat~ command. However, -naming is hard™. Best alternative I can think of is this: -#+begin_src emacs-lisp -:completion -;... -;ivy ;; a search engine for love and life -compleseus ;; a search engine with all the planks replaced -#+end_src * PROJ HACKs to be addressed ** TODO ~fboundp~ issues diff --git a/modules/completion/selectrum/autoload/evil.el b/modules/completion/vertico/autoload/evil.el similarity index 80% rename from modules/completion/selectrum/autoload/evil.el rename to modules/completion/vertico/autoload/evil.el index 2f9b0e20c..78d15c8b8 100644 --- a/modules/completion/selectrum/autoload/evil.el +++ b/modules/completion/vertico/autoload/evil.el @@ -1,13 +1,13 @@ -;; completion/selectrum/autoload/evil.el -*- lexical-binding: t; -*- +;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*- ;;;###if (featurep! :editor evil) -;;;###autoload (autoload '+selectrum:project-search "completion/selectrum/autoload/evil" nil t) +;;;###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'." (interactive "") (+selectrum/project-search all-files-p query)) -;;;###autoload (autoload '+selectrum:project-search-from-cwd "completion/selectrum/autoload/evil" nil t) +;;;###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'." (interactive "") diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/vertico/autoload/vertico.el similarity index 94% rename from modules/completion/selectrum/autoload/selectrum.el rename to modules/completion/vertico/autoload/vertico.el index e668292b1..b613b70cd 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -1,4 +1,4 @@ -;;; completion/selectrum/autoload/selectrum.el -*- lexical-binding: t; -*- +;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*- ;;;###autoload (defadvice! +selectrum--company-capf--candidates-a (fn &rest args) @@ -77,7 +77,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones." ;;;###autoload (defun +selectrum/backward-updir () - "Delete char before or go up directory for file cagetory selectrum buffers." + "Delete char before or go up directory for file cagetory vertico buffers." (interactive) (let ((metadata (completion-metadata (minibuffer-contents) minibuffer-completion-table @@ -95,7 +95,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones." ;;;###autoload (defun +selectrum/embark-export-write () - "Export the current selectrum 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" (interactive) @@ -113,7 +113,7 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location ;;;###autoload (defun +selectrum/embark-preview () - "Previews candidate in selectrum buffer, unless it's a consult command" + "Previews candidate in vertico buffer, unless it's a consult command" (interactive) (unless (bound-and-true-p consult--preview-function) (save-selected-window diff --git a/modules/completion/selectrum/autoload/workspaces.el b/modules/completion/vertico/autoload/workspaces.el similarity index 96% rename from modules/completion/selectrum/autoload/workspaces.el rename to modules/completion/vertico/autoload/workspaces.el index 5fefd4df4..d8396438e 100644 --- a/modules/completion/selectrum/autoload/workspaces.el +++ b/modules/completion/vertico/autoload/workspaces.el @@ -1,4 +1,4 @@ -;;; completion/selectrum/autoload/workspaces.el -*- lexical-binding: t; -*- +;;; completion/vertico/autoload/workspaces.el -*- lexical-binding: t; -*- ;;;###if (featurep! :ui workspaces) ;;;###autoload diff --git a/modules/completion/selectrum/config.el b/modules/completion/vertico/config.el similarity index 99% rename from modules/completion/selectrum/config.el rename to modules/completion/vertico/config.el index 4a691ffc6..a6eaee77c 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/vertico/config.el @@ -1,4 +1,4 @@ -;;; completion/selectrum/config.el -*- lexical-binding: t; -*- +;;; completion/vertico/config.el -*- lexical-binding: t; -*- (use-package! vertico :hook (doom-first-input . vertico-mode) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/vertico/packages.el similarity index 96% rename from modules/completion/selectrum/packages.el rename to modules/completion/vertico/packages.el index 8fc0c82ea..fcc64cee2 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/vertico/packages.el @@ -1,5 +1,5 @@ ;; -*- no-byte-compile: t; -*- -;;; completion/selectrum/packages.el +;;; completion/vertico/packages.el (package! vertico :recipe (:host github :repo "minad/vertico" diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index d159c6fa5..b78d5d4c7 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -54,7 +54,7 @@ (:when (featurep! :completion helm) :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols :desc "Jump to symbol in any workspace" "J" (cmd! #'consult-lsp-symbols '(4))) (:when (featurep! :ui treemacs +lsp) @@ -116,7 +116,7 @@ :desc "Search buffer" "b" (cond ((featurep! :completion helm) #'swiper) ((featurep! :completion ivy) #'swiper) - ((featurep! :completion selectrum) #'consult-line)) + ((featurep! :completion vertico) #'consult-line)) :desc "Search all open buffers" "B" (cond ((featurep! :completion helm) #'swiper-all) ((featurep! :completion ivy) #'swiper-all)) @@ -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 selectrum) #'+selectrum/search-symbol-at-point)) + ((featurep! :completion vertico) #'+selectrum/search-symbol-at-point)) :desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Thesaurus" "T" #'+lookup/synonyms) @@ -158,7 +158,7 @@ :desc "Bibliographic entries" "b" (cond ((featurep! :completion ivy) #'ivy-bibtex) ((featurep! :completion helm) #'helm-bibtex) - ((featurep! :completion selectrum) #'bibtex-actions-open-entry))) + ((featurep! :completion vertico) #'bibtex-actions-open-entry))) :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock :desc "Cancel current org-clock" "C" #'org-clock-cancel @@ -434,7 +434,7 @@ :desc "Send message" "s" #'+irc/send-message (:when (featurep! :completion ivy) :desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) :desc "Jump to channel" "j" #'+irc/selectrum-jump-to-channel))) ;;; T --- twitter @@ -463,7 +463,7 @@ (:when (featurep! :completion helm) "C-S-s" #'swiper-helm "C-S-r" #'helm-resume) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) "C-S-r" #'vertico-repeat) ;;; objed @@ -496,12 +496,12 @@ [C-tab] #'company-complete-common-or-cycle [tab] #'company-complete-common-or-cycle [backtab] #'company-select-previous - "C-RET" (cond ((featurep! :completion helm) #'helm-company) - ((featurep! :completion ivy) #'counsel-company) - ((featurep! :completion selectrum) #'completion-at-point)) - "C-" (cond ((featurep! :completion helm) #'helm-company) - ((featurep! :completion ivy) #'counsel-company) - ((featurep! :completion selectrum) #'completion-at-point)) + "C-RET" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company) + ((featurep! :completion vertico) #'completion-at-point)) + "C-" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company) + ((featurep! :completion vertico) #'completion-at-point)) :map company-search-map "C-n" #'company-search-repeat-forward "C-p" #'company-search-repeat-backward diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 86efc126c..ddc9fdbbb 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -138,9 +138,9 @@ "C-u" #'company-previous-page "C-d" #'company-next-page "C-s" #'company-filter-candidates - "C-S-s" (cond ((featurep! :completion helm) #'helm-company) - ((featurep! :completion ivy) #'counsel-company) - ((featurep! :completion selectrum) #'completion-at-point)) + "C-S-s" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company) + ((featurep! :completion vertico) #'completion-at-point)) "C-SPC" #'company-complete-common "TAB" #'company-complete-common-or-cycle [tab] #'company-complete-common-or-cycle @@ -203,7 +203,7 @@ (:after helm-grep :map helm-grep-map [C-return] #'helm-grep-run-other-window-action)) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) (:after vertico :map vertico-map "M-RET" #'vertico-exit-input @@ -306,7 +306,7 @@ :desc "Resume last search" "'" (cond ((featurep! :completion ivy) #'ivy-resume) ((featurep! :completion helm) #'helm-resume) - ((featurep! :completion selectrum) #'vertico-repeat)) + ((featurep! :completion vertico) #'vertico-repeat)) :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point :desc "Search project" "/" #'+default/search-project @@ -384,7 +384,7 @@ (:when (featurep! :completion helm) :desc "Jump to symbol in current workspace" "j" #'helm-lsp-workspace-symbol :desc "Jump to symbol in any workspace" "J" #'helm-lsp-global-workspace-symbol) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols :desc "Jump to symbol in any workspace" "J" (cmd! #'consult-lsp-symbols '(4))) (:when (featurep! :ui treemacs +lsp) @@ -516,9 +516,9 @@ :desc "Org agenda" "a" #'org-agenda (:when (featurep! :tools biblio) :desc "Bibliographic entries" "b" - (cond ((featurep! :completion ivy) #'ivy-bibtex) - ((featurep! :completion helm) #'helm-bibtex) - ((featurep! :completion selectrum) #'bibtex-actions-open-entry))) + (cond ((featurep! :completion ivy) #'ivy-bibtex) + ((featurep! :completion helm) #'helm-bibtex) + ((featurep! :completion vertico) #'bibtex-actions-open-entry))) :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock :desc "Cancel current org-clock" "C" #'org-clock-cancel @@ -680,7 +680,7 @@ :desc "Search buffer" "b" (cond ((featurep! :completion helm) #'swiper) ((featurep! :completion ivy) #'swiper) - ((featurep! :completion selectrum) #'consult-line)) + ((featurep! :completion vertico) #'consult-line)) :desc "Search all open buffers" "B" (cond ((featurep! :completion helm) #'swiper-all) ((featurep! :completion ivy) #'swiper-all)) @@ -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 selectrum) #'+selectrum/search-symbol-at-point)) + ((featurep! :completion vertico) #'+selectrum/search-symbol-at-point)) :desc "Dictionary" "t" #'+lookup/dictionary-definition :desc "Thesaurus" "T" #'+lookup/synonyms) diff --git a/modules/config/default/autoload/search.el b/modules/config/default/autoload/search.el index c9344751f..8a2ac4196 100644 --- a/modules/config/default/autoload/search.el +++ b/modules/config/default/autoload/search.el @@ -10,9 +10,9 @@ If prefix ARG is set, prompt for a directory to search from." (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) - ((featurep! :completion selectrum) #'+selectrum/project-search-from-cwd) + (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) (#'rgrep))))) ;;;###autoload @@ -31,7 +31,7 @@ If a selection is active, pre-fill the prompt with it." (if (region-active-p) #'swiper-isearch-thing-at-point #'swiper-isearch)) - ((featurep! :completion selectrum) #'isearch-forward)))) + ((featurep! :completion vertico) #'isearch-forward)))) ;;;###autoload (defun +default/search-project (&optional arg) @@ -48,9 +48,9 @@ If prefix ARG is set, include ignored/hidden files." (user-error "There are no known projects")) default-directory))) (call-interactively - (cond ((featurep! :completion ivy) #'+ivy/project-search) - ((featurep! :completion helm) #'+helm/project-search) - ((featurep! :completion selectrum) #'+selectrum/project-search) + (cond ((featurep! :completion ivy) #'+ivy/project-search) + ((featurep! :completion helm) #'+helm/project-search) + ((featurep! :completion vertico) #'+selectrum/project-search) (#'projectile-ripgrep))))) ;;;###autoload @@ -77,7 +77,7 @@ If prefix ARG is set, prompt for a known project to search from." (+ivy/project-search nil symbol)) ((featurep! :completion helm) (+helm/project-search nil symbol)) - ((featurep! :completion selectrum) + ((featurep! :completion vertico) (+selectrum/project-search nil symbol)) ((rgrep (regexp-quote symbol)))))) diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index 5da7f4937..cb9ef34c8 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -30,7 +30,7 @@ (cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;HACK see @ymarco's comment on #5013 and TODO.org in the selecturm module. ((fboundp 'counsel-yank-pop) #'counsel-yank-pop) ((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring) - ((error "No kill-ring search backend available. Enable ivy, helm or selectrum!"))))) + ((error "No kill-ring search backend available. Enable ivy, helm or vertico!"))))) ;;;###autoload (defun +default/yank-buffer-path (&optional root) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 868890484..b99d9be08 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -402,12 +402,12 @@ Continues comments if executed from a commented line. Consults "A-x" #'execute-extended-command) ;; A Doom convention where C-s on popups and interactive searches will invoke - ;; ivy/helm/selectrum for their superior filtering. + ;; ivy/helm/vertico for their superior filtering. (when-let (command (cond ((featurep! :completion ivy) #'counsel-minibuffer-history) ((featurep! :completion helm) #'helm-minibuffer-history) - ((featurep! :completion selectrum) + ((featurep! :completion vertico) #'consult-history))) (define-key! :keymaps (append +default-minibuffer-maps diff --git a/modules/editor/evil/+commands.el b/modules/editor/evil/+commands.el index e667823ca..606654a9f 100644 --- a/modules/editor/evil/+commands.el +++ b/modules/editor/evil/+commands.el @@ -69,7 +69,7 @@ ((featurep! :completion helm) (evil-ex-define-cmd "pg[rep]" #'+helm:project-search) (evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd)) - ((featurep! :completion selectrum) + ((featurep! :completion vertico) (evil-ex-define-cmd "pg[rep]" #'+selectrum:project-search) (evil-ex-define-cmd "pg[grep]d" #'+selectrum:project-search-from-cwd))) diff --git a/modules/email/mu4e/config.el b/modules/email/mu4e/config.el index 274bcc24e..bf7e46cd4 100644 --- a/modules/email/mu4e/config.el +++ b/modules/email/mu4e/config.el @@ -42,11 +42,11 @@ mu4e-context-policy 'pick-first ;; compose with the current context, or ask mu4e-compose-context-policy 'ask-if-none - ;; use helm/ivy/selectrum + ;; use helm/ivy/vertico mu4e-completing-read-function - (cond ((featurep! :completion ivy) #'ivy-completing-read) - ((featurep! :completion helm) #'completing-read) - ((featurep! :completion selectrum) #'completing-read) + (cond ((featurep! :completion ivy) #'ivy-completing-read) + ((featurep! :completion helm) #'completing-read) + ((featurep! :completion vertico) #'completing-read) (t #'ido-completing-read)) ;; no need to ask mu4e-confirm-quit nil diff --git a/modules/email/notmuch/config.el b/modules/email/notmuch/config.el index f99fb7ac6..1ebc040ae 100644 --- a/modules/email/notmuch/config.el +++ b/modules/email/notmuch/config.el @@ -106,6 +106,6 @@ OR a shell command string such as (use-package! consult-notmuch - :when (featurep! :completion selectrum) + :when (featurep! :completion vertico) :commands consult-notmuch :after notmuch) diff --git a/modules/email/notmuch/packages.el b/modules/email/notmuch/packages.el index 7c699b80c..e6fc02bd7 100644 --- a/modules/email/notmuch/packages.el +++ b/modules/email/notmuch/packages.el @@ -8,5 +8,5 @@ (package! counsel-notmuch :pin "a4a1562935e4180c42524c51609d1283e9be0688")) (when (featurep! :completion helm) (package! helm-notmuch :pin "97a01497e079a7b6505987e9feba6b603bbec288")) -(when (featurep! :completion selectrum) +(when (featurep! :completion vertico) (package! consult-notmuch :pin "67cf219fcce211237347a783ce6982402341d5fd")) diff --git a/modules/input/layout/+bepo.el b/modules/input/layout/+bepo.el index cc9f2c7af..8fa1edcc8 100644 --- a/modules/input/layout/+bepo.el +++ b/modules/input/layout/+bepo.el @@ -105,7 +105,7 @@ In all cases, 'h' functions go to 'c' and 'l' ones go to 'r' so the navigation k :n "C-#" #'+popup/raise)) (after! treemacs (+layout-bepo-rotate-ts-bare-keymap '(evil-treemacs-state-map))) - (after! (:or helm ivy selectrum icomplete) + (after! (:or helm ivy vertico icomplete) (+layout-bepo-rotate-keymaps '(minibuffer-local-map minibuffer-local-ns-map diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 6227feabc..76a176f59 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -724,7 +724,7 @@ between the two." (:when (featurep! :completion helm) "." #'helm-org-in-buffer-headings "/" #'helm-org-agenda-files-headings) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) "." #'consult-org-heading "/" #'consult-org-agenda) "A" #'org-archive-subtree @@ -810,7 +810,7 @@ between the two." (:when (featurep! :completion helm) "g" #'helm-org-in-buffer-headings "G" #'helm-org-agenda-files-headings) - (:when (featurep! :completion selectrum) + (:when (featurep! :completion vertico) "g" #'consult-org-heading "G" #'consult-org-agenda) "c" #'org-clock-goto diff --git a/modules/tools/biblio/config.el b/modules/tools/biblio/config.el index 43dbd27c7..532fc552f 100644 --- a/modules/tools/biblio/config.el +++ b/modules/tools/biblio/config.el @@ -15,7 +15,7 @@ (use-package! bibtex-actions - :when (featurep! :completion selectrum) + :when (featurep! :completion vertico) :after embark :defer t :config diff --git a/modules/tools/biblio/packages.el b/modules/tools/biblio/packages.el index 6a7901e23..2ebb049e6 100644 --- a/modules/tools/biblio/packages.el +++ b/modules/tools/biblio/packages.el @@ -6,5 +6,5 @@ (package! ivy-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) (when (featurep! :completion helm) (package! helm-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) -(when (featurep! :completion selectrum) +(when (featurep! :completion vertico) (package! bibtex-actions :pin "b1ddbb32373ac01b6bb46dfc4cdc143461e3c14c")) diff --git a/modules/tools/lookup/autoload/lookup.el b/modules/tools/lookup/autoload/lookup.el index 622a75d7f..39198019a 100644 --- a/modules/tools/lookup/autoload/lookup.el +++ b/modules/tools/lookup/autoload/lookup.el @@ -245,7 +245,7 @@ Will return nil if neither is available. These require ripgrep to be installed." ((featurep! :completion helm) (+helm-file-search :query query) t) - ((featurep! :completion selectrum) + ((featurep! :completion vertico) (+selectrum-file-search :query query) t)))))) diff --git a/modules/tools/lookup/config.el b/modules/tools/lookup/config.el index d9e54ac63..b7e1a0d73 100644 --- a/modules/tools/lookup/config.el +++ b/modules/tools/lookup/config.el @@ -181,7 +181,7 @@ Dictionary.app behind the scenes to get definitions.") :when (featurep! :completion helm)) (use-package! consult-xref - :when (featurep! :completion selectrum) + :when (featurep! :completion vertico) :init (setq xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref))) diff --git a/modules/tools/lsp/README.org b/modules/tools/lsp/README.org index 505c81c4d..4dfefa79b 100644 --- a/modules/tools/lsp/README.org +++ b/modules/tools/lsp/README.org @@ -69,7 +69,7 @@ As of this writing, this is the state of LSP support in Doom Emacs: + [[https://github.com/emacs-lsp/lsp-ui][lsp-ui]] + [[https://github.com/emacs-lsp/lsp-ivy][lsp-ivy]] (=:completion ivy=) + [[https://github.com/emacs-lsp/helm-lsp][helm-lsp]] (=:completion helm=) -+ [[https://github.com/gagbo/consult-lsp][consult-lsp]] (=:completion selectrum=) ++ [[https://github.com/gagbo/consult-lsp][consult-lsp]] (=:completion vertico=) + [[https://github.com/joaotavora/eglot][eglot]] * Prerequisites @@ -87,7 +87,7 @@ including instructions to register your own. * TODO Features ** LSP-powered project search Without the =+eglot= flag, and when =:completion ivy=, =:completion helm= or -=:completion selectrum= is active, LSP is used to search a symbol indexed by the +=:completion vertico= is active, LSP is used to search a symbol indexed by the LSP server : | Keybind | Description | |-----------+-------------------------------------| diff --git a/modules/tools/lsp/packages.el b/modules/tools/lsp/packages.el index cc930f9fa..110c982c2 100644 --- a/modules/tools/lsp/packages.el +++ b/modules/tools/lsp/packages.el @@ -9,5 +9,5 @@ (package! lsp-ivy :pin "bccd86028e669f5a1cad78364775fe7a0741ff93")) (when (featurep! :completion helm) (package! helm-lsp :pin "c2c6974dadfac459b1a69a1217441283874cea92")) - (when (featurep! :completion selectrum) + (when (featurep! :completion vertico) (package! consult-lsp :pin "c882749e91e4de3bae17d825ac9950cc074b1595"))) From a0eb4e9b658a33ccb331e0826367a6ac044164ab Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Fri, 9 Jul 2021 20:28:40 +0300 Subject: [PATCH 131/147] completion/selectrum -> completion/vertico, part 3 - Rename all functions and variables in the module to reflect the namechange (and the irc jump function) --- core/autoload/help.el | 4 +-- modules/app/irc/autoload/irc.el | 2 +- modules/app/irc/autoload/vertico.el | 2 +- modules/completion/vertico/README.org | 2 +- modules/completion/vertico/autoload/evil.el | 16 +++++------ .../completion/vertico/autoload/vertico.el | 28 +++++++++---------- .../completion/vertico/autoload/workspaces.el | 12 ++++---- modules/completion/vertico/config.el | 18 ++++++------ modules/config/default/+emacs-bindings.el | 4 +-- modules/config/default/+evil-bindings.el | 8 +++--- modules/config/default/autoload/search.el | 6 ++-- modules/editor/evil/+commands.el | 4 +-- modules/tools/lookup/autoload/lookup.el | 4 +-- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/core/autoload/help.el b/core/autoload/help.el index ab8412f3e..8f01f4a01 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -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) diff --git a/modules/app/irc/autoload/irc.el b/modules/app/irc/autoload/irc.el index c1caaeb73..b44c47070 100644 --- a/modules/app/irc/autoload/irc.el +++ b/modules/app/irc/autoload/irc.el @@ -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 diff --git a/modules/app/irc/autoload/vertico.el b/modules/app/irc/autoload/vertico.el index f58061dcf..c97edece9 100644 --- a/modules/app/irc/autoload/vertico.el +++ b/modules/app/irc/autoload/vertico.el @@ -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) diff --git a/modules/completion/vertico/README.org b/modules/completion/vertico/README.org index c3951f5b0..cfc81f358 100644 --- a/modules/completion/vertico/README.org +++ b/modules/completion/vertico/README.org @@ -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 diff --git a/modules/completion/vertico/autoload/evil.el b/modules/completion/vertico/autoload/evil.el index 78d15c8b8..85e10ce03 100644 --- a/modules/completion/vertico/autoload/evil.el +++ b/modules/completion/vertico/autoload/evil.el @@ -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 "") - (+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 "") - (+selectrum/project-search-from-cwd (not recurse-p) query)) + (+vertico/project-search-from-cwd (not recurse-p) query)) diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index b613b70cd..7efad0113 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -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)) diff --git a/modules/completion/vertico/autoload/workspaces.el b/modules/completion/vertico/autoload/workspaces.el index d8396438e..90586aa2c 100644 --- a/modules/completion/vertico/autoload/workspaces.el +++ b/modules/completion/vertico/autoload/workspaces.el @@ -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)) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index a6eaee77c..d4212bbaa 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -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 diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index b78d5d4c7..b809ee1c2 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -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))) ;;; T --- twitter (:when (featurep! :app twitter) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index ddc9fdbbb..a7bfcd4de 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -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) diff --git a/modules/config/default/autoload/search.el b/modules/config/default/autoload/search.el index 8a2ac4196..aa5f50de9 100644 --- a/modules/config/default/autoload/search.el +++ b/modules/config/default/autoload/search.el @@ -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 diff --git a/modules/editor/evil/+commands.el b/modules/editor/evil/+commands.el index 606654a9f..7ebc8378c 100644 --- a/modules/editor/evil/+commands.el +++ b/modules/editor/evil/+commands.el @@ -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) diff --git a/modules/tools/lookup/autoload/lookup.el b/modules/tools/lookup/autoload/lookup.el index 39198019a..37c2744d4 100644 --- a/modules/tools/lookup/autoload/lookup.el +++ b/modules/tools/lookup/autoload/lookup.el @@ -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) From 34f8e1fdec8f8b2e334f8e12a271303b3eddd262 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 11 Jul 2021 20:01:27 +0300 Subject: [PATCH 132/147] vertico: Improve README and update TODO... - Add basic configuration instructions - Add Vertico keybindings - Improve =C-c C-e= documentation - Prepare TODO for PR review --- modules/completion/vertico/README.org | 105 ++++++++++++++++++-------- modules/completion/vertico/TODO.org | 87 +++++++++++++++------ 2 files changed, 138 insertions(+), 54 deletions(-) diff --git a/modules/completion/vertico/README.org b/modules/completion/vertico/README.org index cfc81f358..013d90660 100644 --- a/modules/completion/vertico/README.org +++ b/modules/completion/vertico/README.org @@ -3,39 +3,55 @@ #+SINCE: v3.0.0 #+STARTUP: inlineimages -* Table of Contents :TOC_2:noexport: +* Table of Contents :TOC_3:noexport: - [[#description][Description]] + - [[#maintainers][Maintainers]] - [[#module-flags][Module Flags]] - [[#plugins][Plugins]] - [[#prerequisites][Prerequisites]] - [[#features][Features]] + - [[#vertico-keybindings][Vertico keybindings]] - [[#jump-to-navigation][Jump-to navigation]] - [[#project-search--replace][Project search & replace]] - [[#in-buffer-searching][In-buffer searching]] - [[#vertico-integration-for-various-completing-commands][Vertico integration for various completing commands]] + - [[#general][General]] + - [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects]] + - [[#search][Search]] + - [[#marginalia][Marginalia]] - [[#orderless-filtering][Orderless filtering]] +- [[#configuration][Configuration]] * Description -This module provides Vertico integration for a variety of Emacs commands, as -well as a unified interface for project search and replace, powered by ripgrep. +This module enhances the Emacs search and completion experience, and also +provides a united interface for project search and replace, powered by [[https://github.com/BurntSushi/ripgrep/][ripgrep]]. -#+begin_quote -TODO -#+end_quote +It does this with several modular packages focused on enhancing the built-in +~completing-read~ interface, rather than replacing it with a parallel ecosystem +like =ivy= and =helm= do. The primary packages are: + ++ Vertico, which provides the vertical completion user interface ++ Consult, which provides a suite of useful commands using ~completing-read~ ++ Embark, which provides a set of minibuffer actions ++ Marginalia, which provides annotations to completion candidates ++ Orderless, which provides better filtering methods + +** Maintainers +This module has no dedicated maintainers. ** Module Flags -+ ~+icons~ Adds icons to ~file~ and ~buffer~ category completion selections. ++ =+icons= Adds icons to =file= and =buffer= category completion selections. ** Plugins -[[https://github.com/minad/vertico][vertico]] -[[https://github.com/minad/consult][consult]] -[[https://github.com/oantolin/embark/][embark]] -[[https://github.com/oantolin/embark/][embark-consult]] -[[https://github.com/minad/marginalia][marginalia]] -[[https://github.com/oantolin/orderless][orderless]] -[[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] -[[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) -[[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (~+icons~) ++ [[https://github.com/minad/vertico][vertico]] ++ [[https://github.com/minad/consult][consult]] ++ [[https://github.com/oantolin/embark/][embark]] ++ [[https://github.com/oantolin/embark/][embark-consult]] ++ [[https://github.com/minad/marginalia][marginalia]] ++ [[https://github.com/oantolin/orderless][orderless]] ++ [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] ++ [[https://github.com/minad/consult/][consult-flycheck]] (=:checkers syntax=) ++ [[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (=+icons=) * Prerequisites This module has no prerequisites. @@ -48,6 +64,28 @@ the full scope of these packages is too large to cover here and you are encouraged to go and read their excellent documentation. We will detail Doom-specific additions: +** Vertico keybindings +When in an active Vertico completion session, the following doom added +keybindings are available: + +| Keybind | Description | +|-----------------------+----------------------------------------------------| +| =C-p= | Go to previous candidate | +| =C-n= | Go to next candidate | +| =C-k= | (evil) Go to previous candidate | +| =C-j= | (evil) Go to next candidate | +| =C-;= or = a= | Open an ~embark-act~ menu to chose a useful action | +| =C-c C-;= | export the current candidate list to a buffer | +| =C-SPC= | Preview the current candidate | +| =C-M-k= | (evil) Go to previous candidate and preview. | +| =C-M-j= | (evil) Go to next candidate and preview. | + +~embark-act~ will prompt you with a =which-key= menu with useful commands on the +selected candidate or candidate list, depending on the completion category. Note +that you can press =C-h= instead of choosing a command to filter through the +options with a Vertico buffer, that also has slightly more detailed descriptions +due to Marginalia annotations. + ** Jump-to navigation This module provides an interface to navigate within a project using =projectile=: @@ -88,21 +126,11 @@ commands. ----- -These keybindings are available while a search is active: - -| Keybind | Description | -|---------------------+----------------------------------------------------| -| =C-;=, = a= | Open an ~embark-act~ menu to chose a useful action | -| =C-c C-;= | Open a buffer with your search results | -| =C-c C-e= | Open a writable buffer of your search results | -| =C-SPC= | Preview the current candidate | -| =C-M-j= | Scroll down and preview. | -| =C-M-k= | Scroll up and preview. | -| =C-RET= | Open the selected candidate in other-window | - -Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed -with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil -users). +On top of the usual Vertico keybindings, search commands also offer support for +exporting the current candidate list to an editable buffer =C-c C-e=. After +editing the changes can be committed with =C-c C-c= and aborted with =C-c C-k= +(alternatively =ZZ= and =ZQ=, for evil users). It uses =wgrep= for grep +searches, =wdired= for file searches, and =occur= for buffer searches. https://assets.doomemacs.org/completion/vertico/search-replace.png @@ -154,6 +182,11 @@ or the last workspace by typing =0 SPC=. | =SPC s P= | Search another project | | =SPC s s= | Search the current buffer (incrementally) | +** Marginalia +| Keybind | Description | +|---------+---------------------------------| +| =M-A= | Cycle between annotation levels | + ** Orderless filtering When using orderless to filter through candidates, the default behaviour is for each space separated input to match the candidate as a regular expression or @@ -176,3 +209,13 @@ you can use to further specify each space separated input in the following ways: | =`bar= or =bar`= | match input =bar= as an initialism | | ==baz= or =baz== | match only with literal input =baz= | | =~qux= or =qux~= | match input =qux= with fuzzy/flex matching | + +* Configuration +If you want to further configure this module, here are some good places to start: + ++ Vertico provides several [[https://github.com/minad/vertico#extensions][extentions]] that can be used to extend it's interface ++ You can add more Marginalia annotation levels and change the existing ones by + editing ~marginalia-annotator-registry~ ++ You can change the available commands in Embark for category ~$cat~ by editing + ~embark-$cat-map~, and even add new categories. Note that you add categories + by defining them [[https://github.com/minad/marginalia/#adding-custom-annotators-or-classifiers][through marginalia]], and embark picks up on them. diff --git a/modules/completion/vertico/TODO.org b/modules/completion/vertico/TODO.org index bfdec7c0c..ca065bcfb 100644 --- a/modules/completion/vertico/TODO.org +++ b/modules/completion/vertico/TODO.org @@ -35,15 +35,13 @@ case for why this should be an exception: installed independently, so if you find it sufficiently useful you could also have a stripped down version of the config in doom core that is just used for on-buffer actions. +*** We also might want to add keybinidngs for =embark-dwim= ** TODO =SPC s s= and =SPC s S= ~:sw~ ? There isn't really a vertico/consult analogue to ~swiper-isearch~, ~consult-isearch~ does something else (give you previously used isearch search terms). Bound to regular isearch for now. ** TODO =SPC s B= Vertico/Consult don't have a ~swiper-all~ analogue either. Unbound for now. -** TODO Orderless style dispatchers -Currently the =!= style dispatcher is only as a prefix, due to the abundance of -=!= final macros. In my opinion this is useful enough to break consistency. ** TODO =C-c C-e= On ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit but breaks slightly from the =C-c C-e= = =wgrep= convention. @@ -53,12 +51,51 @@ I like having them around but I can always just add them to my private config. ** TODO Annotation Customization Do we want to have the annotations be more like ivy? e.g. - Have a project column in the buffer annotations and a relative path? This has - some overlap with project narrowing =SPC b B p SPC. + some overlap with project narrowing =SPC b B p SPC=. - Mark the modified/remote status of the buffer with color, on top of the modification column? - Change colors in general? +** TODO Orderless +*** TODO Style dispatchers + Currently the =!= style dispatcher is only as a prefix, due to the abundance of + =!= final macros. In my opinion this is useful enough to break consistency. +*** TODO Completion Style on file paths +Currently we have the following completion style override for files: +#+begin_src emacs-lisp +(setq completion-category-overrides '((file (styles . (orderless partial-completion))))) +#+end_src +This means that =parital-completion= matches (basically completing word +prefixes + globbing) only get considered if there are no =orderless= matches. I +find this to be the useful order, since I only really want =partial-completion= +for the globbing, but it does mean that you lose the ability to type the first +few letters of a file and only get the files that start with that, since you get +broader orderless matching. Ivy doesn't have this distinction with prescient on, +but does seem to only show hidden files only after there are no visible ones +left, which we don't have here. -* PROJ HACKs to be addressed +This also relates to the [[https://github.com/minad/vertico#tramp-hostname-completion][recommended settings in the vertico readme]] for remote +hostname completion somewhat. It's hard for me to figure out what's best here +because I don't have any remotes to try this out on. +*** TODO Initialisms by default/ +Do we want to use =orderless+initialism= by default for some of the completion +categories? see [[https://github.com/hlissner/doom-emacs/pull/4664#discussion_r667368998 +][here]] +** TODO Decide what Vertico extensions to use +Currently we only use =vertico-repeat=, and after the next bump I'll replace +~+vertico/backward-updir~ with the =vertico-directory= implementation. Do we +want to use any other ones or leave that to users? +** TODO Decide what to do with ~embark-package-map~ +** TODO =SPC b B= currently displays recent files and bookmarks by default +We can have it only display buffers by setting an initial narrowing +** TODO Company completion style +Currently we advise ~company-capf--candidates~ to try the default emacs +completion styles before orderless, since trying orderless first leads to a +bunch of junk candidates. We could let the company completion style here be a +variable for mildly easy customization, and we could also use orderless but use +a custom sorting function like ~vertico-sort-length-alpha~ which has decent +results ([[https://github.com/hlissner/doom-emacs/pull/4664#discussion_r668897763][see here]]). + +* PROJ HACKs that need looking over ** TODO ~fboundp~ issues Even if the =ivy= module isn't loaded, it's packages can still get loaded by other means, such as =lispy= requiring =counsel=. This means that the ~fboundp~ @@ -68,29 +105,33 @@ first, which is what we do for now. Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs review][this]] change new projects don't get opened in a new tab, but the exact working of this whole set up are a bit opaque to me. -* PROJ Review blocking Issues -** TODO Embark export window buffer switching logic -*** DONE ~grep~ -The clicking links exported grep buffers used to open in a new window, but now - open in another window. Caused by the ~set-popup-rule!~ entries for the embark - export/collect buffers. These don't seem to serve much of a purpose at this - point so they have been removed. -*** TODO Open upstream Embark issue for ~bookmark~ and ~file~ -~bookmark~ or ~file~ export buffers open the links in the same window rather than -the other one. This can be reproduces on emacs -Q. -This is due to orderless adding a bunch of other matches. +* PROJ Things I'd like help with +** TODO Fix ~(defadvice! +orderless-match-with-one-face..~ lexical error +[[https://github.com/oantolin/orderless/issues/41][Probably caused by some doomism]] +** TODO Embark Export/Correct popup logic +Currently when e.g. exporting a ~consult-grep~ search to a grep buffer, it just +gets exported to a new window without any special configuration with +~set-popup-rule!~. This is because using ~set-popup-rule!~ causes the links in +the grep buffer to be opened in a new window rather than the other window, which +is undesirable. However, the default window opening logic leads to the exported +buffer being opened in a right split if the emacs frame is wide, which is also +undesirable. I have not been able to figure out what about the doom popup +mechanism is causing this, I don't think it's something in ~set-popup-rule!~ +directly, but something deeper in the =:ui popup= -* PROJ Review non-blocking Issues + +* PROJ Things to do before the merge ** TODO Profile vertico =SPC /= vs ivy =SPC /= Check if there are other places where optimisations can be made. Perhaps the -~command-input-async~ variables can tolorate lower values. -** TODO ~(defadvice! +orderless-match-with-one-face..~ causes lexical error -Probably caused by some doomism - -https://github.com/oantolin/orderless/issues/41 +~command-input-async~ variables can tolerate lower values. +** TODO Better Marginalia annotations for Projectile commands (maybe upstream) +** TODO after the next bump, replace ~+vertico/backward-updir~ with ~vertico-directory~ version +** TODO bump =bibtex-actions= +** TODO Fix the duplicate candidate issue +[[https://github.com/minad/vertico/issues/69][See here.]] If this doesn't get fixed upstream by the time of the merge we should +add an override for ~read-library-name~ at least. * PROJ Extra credit -** ~vertico-repeat~ doesn't reselect the candidate ** TODO =bibtex-actions= improvements? Currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a main dispatch function like =ivy-bibtex=, rather it has a bunch of different From 41e657f70fd42c7b5a62303e707daa8040bcfa09 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 13 Jul 2021 13:55:15 +0300 Subject: [PATCH 133/147] vertico: remove `:demand t` from `use-package`'s It didn't do anything for the `orderless` statement, and we can setup `embark-consult` correctly without it. --- modules/completion/vertico/config.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index d4212bbaa..5ac940278 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -16,7 +16,6 @@ [backspace] #'+vertico/backward-updir)) (use-package! orderless - :demand t :config (defun +vertico-orderless-dispatch (pattern _index _total) (cond @@ -154,9 +153,8 @@ (use-package! embark-consult :after (embark consult) - :demand t - :hook - (embark-collect-mode . consult-preview-at-point-mode)) + :config + (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) (use-package! wgrep :commands wgrep-change-to-wgrep-mode From f8a64c8767b31118ed8fe53527160a922a9d63f1 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 13 Jul 2021 14:01:42 +0300 Subject: [PATCH 134/147] vertico: pass universal argument from vertico... motion preview commands to underlying motion commands. --- modules/completion/vertico/autoload/vertico.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 7efad0113..8b8f697fd 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -121,15 +121,15 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location (embark-default-action))))) ;;;###autoload -(defun +vertico/next-candidate-preview () - "Move to next candidate and preivew it" +(defun +vertico/next-candidate-preview (&optional n) + "Go forward N candidates and preivew" (interactive) - (vertico-next) + (vertico-next (or n 1)) (+vertico/embark-preview)) ;;;###autoload -(defun +vertico/previous-candidate-preview () - "Move to previous candidate and preview it" +(defun +vertico/previous-candidate-preview (&optional n) + "Go backward N candidates and preivew" (interactive) - (vertico-previous) + (vertico-previous (or n 1)) (+vertico/embark-preview)) From 099f8510bb7a72ff9f5c0deeddd39f8883aadc27 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Tue, 13 Jul 2021 15:33:27 +0300 Subject: [PATCH 135/147] vertico: add consult buffer source for org buffers --- modules/completion/vertico/TODO.org | 21 +++++++++++++++++++-- modules/completion/vertico/config.el | 11 ++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/modules/completion/vertico/TODO.org b/modules/completion/vertico/TODO.org index ca065bcfb..9a6a8ec87 100644 --- a/modules/completion/vertico/TODO.org +++ b/modules/completion/vertico/TODO.org @@ -85,8 +85,6 @@ Currently we only use =vertico-repeat=, and after the next bump I'll replace ~+vertico/backward-updir~ with the =vertico-directory= implementation. Do we want to use any other ones or leave that to users? ** TODO Decide what to do with ~embark-package-map~ -** TODO =SPC b B= currently displays recent files and bookmarks by default -We can have it only display buffers by setting an initial narrowing ** TODO Company completion style Currently we advise ~company-capf--candidates~ to try the default emacs completion styles before orderless, since trying orderless first leads to a @@ -94,6 +92,25 @@ bunch of junk candidates. We could let the company completion style here be a variable for mildly easy customization, and we could also use orderless but use a custom sorting function like ~vertico-sort-length-alpha~ which has decent results ([[https://github.com/hlissner/doom-emacs/pull/4664#discussion_r668897763][see here]]). +** TODO ~consult-buffer~ considerations +~consult-buffer~ is what the vertico module uses on =SPC b B=. +*** What should be shown by default? +Currently it just uses the default settings of showing open buffers, recent +files, and bookmarks by default. It's possible to have it only show buffers by +setting the recent files and bookmarks sources to be hidden, or pre-narrowing +the command. +*** Org buffer source +I've added a [[https://github.com/minad/consult#narrowing-and-grouping][consult source]] that lets you narrow for org-mode buffers. Originally +I did this by autoloading ~org-buffers-list~, but beyond potential snappiness +considerations regarding loading org too early, I would also occasionally get +nondeterministic void variable errors on ~org-buffers-list~, which I suspect are +caused by the use of ~:defer-incrementally~ in the org ~use-package!~ statement. + +This is currently implemented by only adding the buffer source in an ~after! +org~ statement, but per minad every additional buffer source slows +~consult-buffer~ down, so it is worth consideration if this option is desired at +all. I haven't noticed a difference, but it might be noticible on slower +machines. * PROJ HACKs that need looking over ** TODO ~fboundp~ issues diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 5ac940278..880385cd8 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -81,7 +81,16 @@ consult-theme :preview-key (list (kbd "C-SPC") (kbd "C-M-j") (kbd "C-M-k") - :debounce 0.5 'any))) + :debounce 0.5 'any)) + (after! org + (defvar +vertico--consult-org-source + `(:name "Org" + :narrow ?o + :hidden t + :category buffer + :state ,#'consult--buffer-state + :items ,(lambda () (mapcar #'buffer-name (org-buffer-list))))) + (add-to-list 'consult-buffer-sources '+vertico--consult-org-source 'append))) (use-package! consult-flycheck :when (featurep! :checkers syntax) From 21b91e5e1fd4032963012a7a7060668ce0fa4972 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 18 Jul 2021 17:13:30 +0300 Subject: [PATCH 136/147] Bump :completion vertico minad/vertico@9f6cd5d -> minad/vertico@e1faeb0 minad/consult@f17db95 -> minad/consult@5fb6248 oantolin/embark@acbe1cb -> oantolin/embark@9d56be1 minad/marginalia@3bf0a4d -> minad/marginalia@d4c2028 iyefrat/all-the-icons-completion@975345f -> iyefrat/all-the-icons-completion@24cdb3b --- modules/completion/vertico/packages.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/completion/vertico/packages.el b/modules/completion/vertico/packages.el index fcc64cee2..c886ae042 100644 --- a/modules/completion/vertico/packages.el +++ b/modules/completion/vertico/packages.el @@ -4,22 +4,22 @@ (package! vertico :recipe (:host github :repo "minad/vertico" :files ("*.el" "extensions/*.el")) - :pin "9f6cd5d431ec6d288676af80e932d928346a1b36") + :pin "e1faeb01ed379dd773116adbc22e8ca52f6f8162") (package! orderless :pin "2646dad28c0819fbe9ee521d39efb9ae40e03982") -(package! consult :pin "f17db9520ddd612dc837f4112b6bcbb172acef85") +(package! consult :pin "5fb6248c8e12630ce1247985c67ea28ae4077e4f") (when (featurep! :checkers syntax) (package! consult-flycheck :pin "92b259e6a8ebe6439f67d3d7ffa44b7e64b76478")) -(package! embark :pin "acbe1cba548832d295449da348719f69b9685c6f") -(package! embark-consult :pin "acbe1cba548832d295449da348719f69b9685c6f") +(package! embark :pin "9d56be162badbbfee405595f2ebdfe16a5bca47d") +(package! embark-consult :pin "9d56be162badbbfee405595f2ebdfe16a5bca47d") -(package! marginalia :pin "3bf0a4db55f6267467f0a08715f4776509a3b503") +(package! marginalia :pin "d4c2028c7917b2ff926b3a67c3acc0351be658cc") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") (when (featurep! +icons) (package! all-the-icons-completion :recipe (:host github :repo "iyefrat/all-the-icons-completion") - :pin "975345f1b618fd316729c3cae6d11b96db530fd4")) + :pin "24cdb3b42c6ca0a8926ad6958c76d7928fc559ce")) From d0f4c5f03ca0293a31eeb3bfcfecfa913e33ea4a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 18 Jul 2021 17:33:52 +0300 Subject: [PATCH 137/147] vertico: use `all-the-icons-completion-marginalia-setup` --- modules/completion/vertico/config.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 880385cd8..9006a418a 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -148,8 +148,7 @@ :hook (doom-first-input . marginalia-mode) :init (when (featurep! +icons) - (add-hook 'marginalia-mode-hook - (lambda () (all-the-icons-completion-mode (if marginalia-mode 1 -1))))) + (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)) (map! :map minibuffer-local-map :desc "Cycle marginalia views" "M-A" #'marginalia-cycle) From 29bd530970304c867638b57744ef25a52d693c76 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 18 Jul 2021 21:27:44 +0300 Subject: [PATCH 138/147] vertico: use `vertico-directory-tidy` cleans up shadowed paths automatically --- modules/completion/vertico/TODO.org | 4 +++- modules/completion/vertico/config.el | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/completion/vertico/TODO.org b/modules/completion/vertico/TODO.org index 9a6a8ec87..4190c5dad 100644 --- a/modules/completion/vertico/TODO.org +++ b/modules/completion/vertico/TODO.org @@ -111,6 +111,9 @@ org~ statement, but per minad every additional buffer source slows ~consult-buffer~ down, so it is worth consideration if this option is desired at all. I haven't noticed a difference, but it might be noticible on slower machines. +** TODO Should we use ~vertico-directory-delete-char~ instead of ~+vertico/backward-updir~ +Pro: use builtin upstream thing +Con: lose ability to backspace through =~/= * PROJ HACKs that need looking over ** TODO ~fboundp~ issues @@ -142,7 +145,6 @@ directly, but something deeper in the =:ui popup= Check if there are other places where optimisations can be made. Perhaps the ~command-input-async~ variables can tolerate lower values. ** TODO Better Marginalia annotations for Projectile commands (maybe upstream) -** TODO after the next bump, replace ~+vertico/backward-updir~ with ~vertico-directory~ version ** TODO bump =bibtex-actions= ** TODO Fix the duplicate candidate issue [[https://github.com/minad/vertico/issues/69][See here.]] If this doesn't get fixed upstream by the time of the merge we should diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 9006a418a..f10cfeace 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -12,6 +12,7 @@ #'consult-completion-in-region #'completion--in-region)))) :config + (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) (map! :map vertico-map [backspace] #'+vertico/backward-updir)) From 770084fdda44ee71798b04476477a7baf59cf6bc Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 14:54:10 +0300 Subject: [PATCH 139/147] vertico: use consult-line in +default/search-buffer While it only gives one candidate per line, it's more important to have something that uses the completion UI --- modules/config/default/autoload/search.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config/default/autoload/search.el b/modules/config/default/autoload/search.el index aa5f50de9..329043464 100644 --- a/modules/config/default/autoload/search.el +++ b/modules/config/default/autoload/search.el @@ -31,7 +31,7 @@ If a selection is active, pre-fill the prompt with it." (if (region-active-p) #'swiper-isearch-thing-at-point #'swiper-isearch)) - ((featurep! :completion vertico) #'isearch-forward)))) + ((featurep! :completion vertico) #'consult-line)))) ;;;###autoload (defun +default/search-project (&optional arg) From 3f1016753d078fd5456be667f5e76526d7385cf9 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 15:00:46 +0300 Subject: [PATCH 140/147] vertico: various refactors... - unify `map!` statements when possible - rename `+vertico--embark-target-package!` to `+vertico--embark-target-package` and autoload it - set `completion-in-region-function` to a wrapper function instead of changing it with a hook - use `:override` advice instead of `fset` for `multi-occur` - document what `vertico-directory-tidy` does - move `:init` contents to `:config` when possible --- .../completion/vertico/autoload/vertico.el | 9 +++ modules/completion/vertico/config.el | 69 +++++++++---------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 8b8f697fd..962c0bcb2 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -92,6 +92,15 @@ If ARG (universal argument), include all files, even hidden or compressed ones." (expand-file-name new-path)))))) (call-interactively 'backward-delete-char)))) +(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 + (search-backward "(") + (when (looking-at "(\\s-*package!\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") + (let ((pkg (match-string 1))) + (set-text-properties 0 (length pkg) nil pkg) + `(package . ,pkg)))))) ;;;###autoload (defun +vertico/embark-export-write () diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index f10cfeace..e681a0bf6 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -2,16 +2,18 @@ (use-package! vertico :hook (doom-first-input . vertico-mode) - :init + :config (setq vertico-resize nil vertico-count 17 vertico-cycle t) - (add-hook 'vertico-mode-hook (lambda () - (setq completion-in-region-function - (if vertico-mode - #'consult-completion-in-region - #'completion--in-region)))) - :config + (setq completion-in-region-function + (lambda (&rest args) + (apply (if vertico-mode + #'consult-completion-in-region + #'completion--in-region) + args))) + ;; cleans up path when moving directories with shadowed paths syntax, + ;; e.g. cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/. (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy) (map! :map vertico-map [backspace] #'+vertico/backward-updir)) @@ -47,7 +49,7 @@ (use-package! consult :defer t :init - (fset 'multi-occur #'consult-multi-occur) + (advice-add #'multi-occur :override #'consult-multi-occur) (define-key! [remap apropos] #'consult-apropos [remap bookmark-jump] #'consult-bookmark @@ -99,31 +101,22 @@ (use-package! embark :init + (map! "C-;" #'embark-act ; to be moved to :config default if accepted + :map minibuffer-local-map + "C-;" #'embark-act + "C-c C-;" #'embark-export + :desc "Export to writable buffer" + "C-c C-e" #'+vertico/embark-export-write + :leader + :desc "Actions" "a" #'embark-act) ; to be moved to :config default if accepted + (define-key! + [remap describe-bindings] #'embark-bindings) + :config (setq embark-action-indicator (lambda (map _target) (which-key--show-keymap "Embark" map nil nil 'no-paging) #'which-key--hide-popup-ignore-command) embark-become-indicator embark-action-indicator) - (map! "C-;" #'embark-act ; to be moved to :config default if accepted - :leader - :desc "Actions" "a" #'embark-act) ; to be moved to :config default if accepted - (map! :map minibuffer-local-map - "C-;" #'embark-act - "C-c C-;" #'embark-export - :desc "Export to writable buffer" - "C-c C-e" #'+vertico/embark-export-write) - (define-key! - [remap describe-bindings] #'embark-bindings) - (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 - (search-backward "(") - (when (looking-at "(\\s-*package!\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") - (let ((pkg (match-string 1))) - (set-text-properties 0 (length pkg) nil pkg) - `(package . ,pkg)))))) - :config ;; add the package! target finder before the file target finder, ;; so we don't get a false positive match. (let ((pos (or (cl-position @@ -132,28 +125,28 @@ (length embark-target-finders)))) (cl-callf2 cons - '+vertico--embark-target-package! + '+vertico--embark-target-package (nthcdr pos embark-target-finders))) + (setq embark-package-map (make-sparse-keymap)) (map! :map embark-file-map :desc "Open target with sudo" "s" #'doom/sudo-find-file - :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 - "b" #'doom/bump-package - "c" #'doom/help-package-config - "u" #'doom/help-package-homepage)) + :desc "Open in new workspace" "TAB" #'+vertico-embark-open-in-new-workspace + :map embark-package-map + "h" #'doom/help-packages + "b" #'doom/bump-package + "c" #'doom/help-package-config + "u" #'doom/help-package-homepage)) (use-package! marginalia :hook (doom-first-input . marginalia-mode) :init - (when (featurep! +icons) - (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)) (map! :map minibuffer-local-map :desc "Cycle marginalia views" "M-A" #'marginalia-cycle) :config + (when (featurep! +icons) + (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)) (nconc marginalia-command-categories '((persp-switch-to-buffer . buffer) (projectile-find-file . project-file) From c12fb64c9886db6149798954386a725979ffc25e Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 15:49:57 +0300 Subject: [PATCH 141/147] vertico: defer loading of embark and orderless --- modules/completion/vertico/config.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index e681a0bf6..701b55e2a 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -19,6 +19,8 @@ [backspace] #'+vertico/backward-updir)) (use-package! orderless + :defer t + :after-call doom-first-input-hook :config (defun +vertico-orderless-dispatch (pattern _index _total) (cond @@ -100,6 +102,7 @@ :after (consult flycheck)) (use-package! embark + :defer t :init (map! "C-;" #'embark-act ; to be moved to :config default if accepted :map minibuffer-local-map From a4093e90fef457de90219380711cde20f830fdee Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 16:17:04 +0300 Subject: [PATCH 142/147] vertico: fix unused lexical variable error --- modules/completion/vertico/TODO.org | 2 -- modules/completion/vertico/autoload/vertico.el | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/completion/vertico/TODO.org b/modules/completion/vertico/TODO.org index 4190c5dad..0a23692e2 100644 --- a/modules/completion/vertico/TODO.org +++ b/modules/completion/vertico/TODO.org @@ -126,8 +126,6 @@ Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs revie working of this whole set up are a bit opaque to me. * PROJ Things I'd like help with -** TODO Fix ~(defadvice! +orderless-match-with-one-face..~ lexical error -[[https://github.com/oantolin/orderless/issues/41][Probably caused by some doomism]] ** TODO Embark Export/Correct popup logic Currently when e.g. exporting a ~consult-grep~ search to a grep buffer, it just gets exported to a new window without any special configuration with diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 962c0bcb2..b263d7546 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -1,5 +1,9 @@ ;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*- +;; To prevent "Unused lexical variable" warning from +vertico--company-capf--candidates-a +;;;###autoload +(defvar orderless-match-faces) + ;;;###autoload (defadvice! +vertico--company-capf--candidates-a (fn &rest args) "Highlight company matches correctly, and try default completion styles before From a0e384fe8e076fd68cbc177e220007a5c3359c10 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 16:38:57 +0300 Subject: [PATCH 143/147] Bump :completion vertico minad/consult@5fb6248 -> minad/consult@28f9ba8 minad/marginalia@d4c2028 -> minad/marginalia@a3a8edb minad/vertico@e1faeb0 -> minad/vertico@4a90297 oantolin/embark@9d56be1 -> oantolin/embark@be03ce9 oantolin/orderless@2646dad -> oantolin/orderless@1e84120 --- modules/completion/vertico/packages.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/completion/vertico/packages.el b/modules/completion/vertico/packages.el index c886ae042..5f30427f9 100644 --- a/modules/completion/vertico/packages.el +++ b/modules/completion/vertico/packages.el @@ -4,18 +4,18 @@ (package! vertico :recipe (:host github :repo "minad/vertico" :files ("*.el" "extensions/*.el")) - :pin "e1faeb01ed379dd773116adbc22e8ca52f6f8162") + :pin "4a9029714e847832d3ecb3ae74a7049306924f2e") -(package! orderless :pin "2646dad28c0819fbe9ee521d39efb9ae40e03982") +(package! orderless :pin "1e84120a28525ccb47b602fc19b7afbeffbbe502") -(package! consult :pin "5fb6248c8e12630ce1247985c67ea28ae4077e4f") +(package! consult :pin "28f9ba8bdfdb13257862a658715b6ceb96f4951e") (when (featurep! :checkers syntax) (package! consult-flycheck :pin "92b259e6a8ebe6439f67d3d7ffa44b7e64b76478")) -(package! embark :pin "9d56be162badbbfee405595f2ebdfe16a5bca47d") -(package! embark-consult :pin "9d56be162badbbfee405595f2ebdfe16a5bca47d") +(package! embark :pin "be03ce9ce1630b32e29cc50118d058c05696cb35") +(package! embark-consult :pin "be03ce9ce1630b32e29cc50118d058c05696cb35") -(package! marginalia :pin "d4c2028c7917b2ff926b3a67c3acc0351be658cc") +(package! marginalia :pin "a3a8edbf25db4b1e167f1fdff6f60a065d0bf9cb") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") From f94b985244a6095c7ca59ac68cae28b1735c8a17 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 16:43:23 +0300 Subject: [PATCH 144/147] Bump :tools biblio bdarcus/bibtex-actions@b1ddbb3 -> bdarcus/bibtex-actions@6e3a194 tmalsburg/helm-bibtex@9f6ea92 -> tmalsburg/helm-bibtex@a0d32ab tmalsburg/helm-bibtex@9f6ea92 -> tmalsburg/helm-bibtex@a0d32ab tmalsburg/helm-bibtex@9f6ea92 -> tmalsburg/helm-bibtex@a0d32ab bibtex-actions is way out of date, and bibtex-completion has a new org-cite improvement --- modules/tools/biblio/packages.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/tools/biblio/packages.el b/modules/tools/biblio/packages.el index 2ebb049e6..d4a1c28aa 100644 --- a/modules/tools/biblio/packages.el +++ b/modules/tools/biblio/packages.el @@ -1,10 +1,10 @@ ;; -*- no-byte-compile: t; -*- ;;; tools/biblio/packages.el -(package! bibtex-completion :pin "9f6ea920a49457d85096caa0e61f086a42b2908e") +(package! bibtex-completion :pin "a0d32ab16748b7b0c43d6421f1b497b7caf8e590") (when (featurep! :completion ivy) - (package! ivy-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) + (package! ivy-bibtex :pin "a0d32ab16748b7b0c43d6421f1b497b7caf8e590")) (when (featurep! :completion helm) - (package! helm-bibtex :pin "9f6ea920a49457d85096caa0e61f086a42b2908e")) + (package! helm-bibtex :pin "a0d32ab16748b7b0c43d6421f1b497b7caf8e590")) (when (featurep! :completion vertico) - (package! bibtex-actions :pin "b1ddbb32373ac01b6bb46dfc4cdc143461e3c14c")) + (package! bibtex-actions :pin "6e3a194c3ab655693f8194be78542366755c58c9")) From aff25b132bb4b76b9001248c2187852691cf837a Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 16:44:39 +0300 Subject: [PATCH 145/147] Bump :checkers spell d12frosted/flyspell-correct@4042336 -> d12frosted/flyspell-correct@0035795 flyspell-correct got some completing-read improvements relevant to completion/vertico --- modules/checkers/spell/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/checkers/spell/packages.el b/modules/checkers/spell/packages.el index 32da2eaf9..f91114ce7 100644 --- a/modules/checkers/spell/packages.el +++ b/modules/checkers/spell/packages.el @@ -3,7 +3,7 @@ (if (not (featurep! +flyspell)) (package! spell-fu :pin "1abcb5594e1bfe35716d29e64523e4cebdce737c") - (package! flyspell-correct :pin "404233604439117301562deadc952fe82cb02120") + (package! flyspell-correct :pin "00357953a736e21d0a1c8d76f5605820990544fe") (cond ((featurep! :completion ivy) (package! flyspell-correct-ivy)) ((featurep! :completion helm) From e2cd827f96496c977567375bf1969c0dc1bcc070 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 24 Jul 2021 17:21:55 +0300 Subject: [PATCH 146/147] vertico: add variable to set company completion styles --- modules/completion/vertico/autoload/vertico.el | 2 +- modules/completion/vertico/config.el | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index b263d7546..1c02f1909 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -10,7 +10,7 @@ orderless." :around 'company-capf--candidates (let ((orderless-match-faces [completions-common-part]) - (completion-styles '(basic partial-completion orderless))) + (completion-styles +vertico-company-completion-styles)) (apply fn args))) ;;;###autoload diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index 701b55e2a..0b6cc6b9c 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -1,5 +1,12 @@ ;;; completion/vertico/config.el -*- lexical-binding: t; -*- +(defvar +vertico-company-completion-styles '(basic partial-completion orderless) + "Completion styles for company to use. + +The completion/vertico module uses the orderless completion style by default, +but this returns too broad a candidate set for company completion. This +variable overrides `completion-styles' during company completion sessions.") + (use-package! vertico :hook (doom-first-input . vertico-mode) :config From beb0b445d8b6617d58b975e969e4a65f6ec2fac2 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 25 Jul 2021 02:33:37 +0300 Subject: [PATCH 147/147] vertico: prepare for merge... - move TODO.org to discourse (https://discourse.doomemacs.org/t/vertico-module-tasklist/1386) - update README date - add @iyefrat as maintainer --- modules/completion/vertico/README.org | 4 +- modules/completion/vertico/TODO.org | 170 -------------------------- 2 files changed, 2 insertions(+), 172 deletions(-) delete mode 100644 modules/completion/vertico/TODO.org diff --git a/modules/completion/vertico/README.org b/modules/completion/vertico/README.org index 013d90660..7b6cb339a 100644 --- a/modules/completion/vertico/README.org +++ b/modules/completion/vertico/README.org @@ -1,5 +1,5 @@ #+TITLE: completion/vertico -#+DATE: February 16, 2021 +#+DATE: July 25, 2021 #+SINCE: v3.0.0 #+STARTUP: inlineimages @@ -37,7 +37,7 @@ like =ivy= and =helm= do. The primary packages are: + Orderless, which provides better filtering methods ** Maintainers -This module has no dedicated maintainers. ++ @iyefrat ** Module Flags + =+icons= Adds icons to =file= and =buffer= category completion selections. diff --git a/modules/completion/vertico/TODO.org b/modules/completion/vertico/TODO.org deleted file mode 100644 index 0a23692e2..000000000 --- a/modules/completion/vertico/TODO.org +++ /dev/null @@ -1,170 +0,0 @@ -* PROJ Design Decisions -** TODO Bind =consult-lsp-diagnostics= to something? -** TODO Finalize =embark-act= keybindings -They are currently set to =C-;= and = a=. The motivation for this is as -follows: -*** =C-;= -Least intrusive key-chord type binding I could find. Doesn't interfere with -other keybindings for the most part (unlike =C-o= which clashes for in -minibuffer =evil-want-minibuffer= users and regular buffer evil users), with the -exception of: -- =C-;= is bound to ~flyspell-auto-correct-previous-word~. via the built in - flyspell map. -- =C-;= is bound to ~+company/complete~ in the vanilla emacs bindings. -We could also just bind it in the minibuffer if we do end up going with the -leader key. -*** Alternative chord: =C-,= -Still has some overlaps, but perhaps less important: -- ~flyspell-goto-next-error~ -- ~org-cycle-agenda-files~ has redundancy in =C-'= anyway. -It is however less convenient than =C-;= -*** = a= -Even though top level module dependant bindings are frowned upon, here is my -case for why this should be an exception: -- It provide a useful shortcut for a bunch of commands relevant to the symbol at - point, and seems to be better at this than built in stuff, e.g. doing - = f D= to delete a file in =eshell= doesn't work, but embark - recognises that it's a file, so = a d= does. -- other than helping with discoverability for stuff this also allows for - commands for things that are too niche for top level bindings, such as actions - on ~package!~ statements and recipes or urls. -- vertico is slated to become the default completion module, which makes this - less of an inconsistency, but I'm not sure about the performance slowdown in - ~map!~ since that seems to be one of the main concerns. -- ~embark~ like most packages in the vertico cinematic universe can be - installed independently, so if you find it sufficiently useful you could also - have a stripped down version of the config in doom core that is just used for - on-buffer actions. -*** We also might want to add keybinidngs for =embark-dwim= -** TODO =SPC s s= and =SPC s S= ~:sw~ ? -There isn't really a vertico/consult analogue to ~swiper-isearch~, ~consult-isearch~ -does something else (give you previously used isearch search terms). Bound to -regular isearch for now. -** TODO =SPC s B= -Vertico/Consult don't have a ~swiper-all~ analogue either. Unbound for now. -** TODO =C-c C-e= -On ~consult-line~ this opens a ~occur-edit~ buffer, which is a more natural fit -but breaks slightly from the =C-c C-e= = =wgrep= convention. -** TODO Keep or discard =C-M-j= and =C-M-k= -Scroll up and down while previewing. Essentially shortcuts for =C-(j|k) C-SPC=. -I like having them around but I can always just add them to my private config. -** TODO Annotation Customization -Do we want to have the annotations be more like ivy? e.g. -- Have a project column in the buffer annotations and a relative path? This has - some overlap with project narrowing =SPC b B p SPC=. -- Mark the modified/remote status of the buffer with color, on top of the - modification column? -- Change colors in general? -** TODO Orderless -*** TODO Style dispatchers - Currently the =!= style dispatcher is only as a prefix, due to the abundance of - =!= final macros. In my opinion this is useful enough to break consistency. -*** TODO Completion Style on file paths -Currently we have the following completion style override for files: -#+begin_src emacs-lisp -(setq completion-category-overrides '((file (styles . (orderless partial-completion))))) -#+end_src -This means that =parital-completion= matches (basically completing word -prefixes + globbing) only get considered if there are no =orderless= matches. I -find this to be the useful order, since I only really want =partial-completion= -for the globbing, but it does mean that you lose the ability to type the first -few letters of a file and only get the files that start with that, since you get -broader orderless matching. Ivy doesn't have this distinction with prescient on, -but does seem to only show hidden files only after there are no visible ones -left, which we don't have here. - -This also relates to the [[https://github.com/minad/vertico#tramp-hostname-completion][recommended settings in the vertico readme]] for remote -hostname completion somewhat. It's hard for me to figure out what's best here -because I don't have any remotes to try this out on. -*** TODO Initialisms by default/ -Do we want to use =orderless+initialism= by default for some of the completion -categories? see [[https://github.com/hlissner/doom-emacs/pull/4664#discussion_r667368998 -][here]] -** TODO Decide what Vertico extensions to use -Currently we only use =vertico-repeat=, and after the next bump I'll replace -~+vertico/backward-updir~ with the =vertico-directory= implementation. Do we -want to use any other ones or leave that to users? -** TODO Decide what to do with ~embark-package-map~ -** TODO Company completion style -Currently we advise ~company-capf--candidates~ to try the default emacs -completion styles before orderless, since trying orderless first leads to a -bunch of junk candidates. We could let the company completion style here be a -variable for mildly easy customization, and we could also use orderless but use -a custom sorting function like ~vertico-sort-length-alpha~ which has decent -results ([[https://github.com/hlissner/doom-emacs/pull/4664#discussion_r668897763][see here]]). -** TODO ~consult-buffer~ considerations -~consult-buffer~ is what the vertico module uses on =SPC b B=. -*** What should be shown by default? -Currently it just uses the default settings of showing open buffers, recent -files, and bookmarks by default. It's possible to have it only show buffers by -setting the recent files and bookmarks sources to be hidden, or pre-narrowing -the command. -*** Org buffer source -I've added a [[https://github.com/minad/consult#narrowing-and-grouping][consult source]] that lets you narrow for org-mode buffers. Originally -I did this by autoloading ~org-buffers-list~, but beyond potential snappiness -considerations regarding loading org too early, I would also occasionally get -nondeterministic void variable errors on ~org-buffers-list~, which I suspect are -caused by the use of ~:defer-incrementally~ in the org ~use-package!~ statement. - -This is currently implemented by only adding the buffer source in an ~after! -org~ statement, but per minad every additional buffer source slows -~consult-buffer~ down, so it is worth consideration if this option is desired at -all. I haven't noticed a difference, but it might be noticible on slower -machines. -** TODO Should we use ~vertico-directory-delete-char~ instead of ~+vertico/backward-updir~ -Pro: use builtin upstream thing -Con: lose ability to backspace through =~/= - -* PROJ HACKs that need looking over -** TODO ~fboundp~ issues -Even if the =ivy= module isn't loaded, it's packages can still get loaded by -other means, such as =lispy= requiring =counsel=. This means that the ~fboundp~ -logic [[file:~/.emacs.d/modules/config/default/autoload/text.el::(cond ((fboundp 'consult-yank-pop) #'consult-yank-pop) ;;HACK see @ymarco's comment on #5013 and TODO.org][here]] (and formerly [[file:~/.emacs.d/core/autoload/projects.el::(and (bound-and-true-p ivy-mode][here]]) won't work unless the vertico option is checked -first, which is what we do for now. -** TODO ~projectile-switch-project-action~ definition -Without [[file:~/.emacs.d/modules/ui/workspaces/config.el::;; HACK?? needs review][this]] change new projects don't get opened in a new tab, but the exact -working of this whole set up are a bit opaque to me. - -* PROJ Things I'd like help with -** TODO Embark Export/Correct popup logic -Currently when e.g. exporting a ~consult-grep~ search to a grep buffer, it just -gets exported to a new window without any special configuration with -~set-popup-rule!~. This is because using ~set-popup-rule!~ causes the links in -the grep buffer to be opened in a new window rather than the other window, which -is undesirable. However, the default window opening logic leads to the exported -buffer being opened in a right split if the emacs frame is wide, which is also -undesirable. I have not been able to figure out what about the doom popup -mechanism is causing this, I don't think it's something in ~set-popup-rule!~ -directly, but something deeper in the =:ui popup= - - -* PROJ Things to do before the merge -** TODO Profile vertico =SPC /= vs ivy =SPC /= -Check if there are other places where optimisations can be made. Perhaps the -~command-input-async~ variables can tolerate lower values. -** TODO Better Marginalia annotations for Projectile commands (maybe upstream) -** TODO bump =bibtex-actions= -** TODO Fix the duplicate candidate issue -[[https://github.com/minad/vertico/issues/69][See here.]] If this doesn't get fixed upstream by the time of the merge we should -add an override for ~read-library-name~ at least. - -* PROJ Extra credit -** TODO =bibtex-actions= improvements? -Currently =SPC n b= is bound to a function, but =bibtex-actions= doesn't have a -main dispatch function like =ivy-bibtex=, rather it has a bunch of different -ones. Binding the ~bibtex-actions-map~ there would probably be better, but there -are nontrivial loading order shenanigans happening that make that not -straightforward. -** TODO Buffer switching -- =SPC b b= should switch workspace after choosing a buffer from a different one -- Universal argument for opening buffer in another window? -** TODO Ivy Parity -*** TODO =C-RET= on minibuffer? -*** TODO pass module -*** TODO ~+ivy/jump-list~ analogue -*** WAIT lookup module -- ~dash-docs~ backend (needs to be created) -- ~+lookup--online..~ functionality (needs a consult analogue of - ~counsel-search~) -*** WAIT taskrunner module -in all likelihood requires writing ~consult-taskrunner~.