From 14d6613192f57c0b6898be41680001b30fc06367 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 22 May 2021 23:22:17 +0300 Subject: [PATCH] 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