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`
This commit is contained in:
Itai Y. Efrat 2021-05-22 23:22:17 +03:00
parent 1f3281734a
commit 14d6613192
2 changed files with 5 additions and 6 deletions

View file

@ -96,8 +96,7 @@ 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)
(unless (bound-and-true-p consult--preview-function)
(save-selected-window
(let ((embark-quit-after-action nil))
(embark-default-action)))))

View file

@ -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