[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult e1dce9725b: Preview: Use consult--completion-wi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult e1dce9725b: Preview: Use consult--completion-window-p |
Date: |
Sat, 9 Sep 2023 09:57:33 -0400 (EDT) |
branch: externals/consult
commit e1dce9725b2fdf5c450d77bfb1ba93f97fd4d980
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Preview: Use consult--completion-window-p
---
consult.el | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/consult.el b/consult.el
index 5bc505ccaf..2a29681978 100644
--- a/consult.el
+++ b/consult.el
@@ -1675,8 +1675,7 @@ PREVIEW-KEY, STATE, TRANSFORM and CANDIDATE."
(funcall state 'setup nil))
(setq consult--preview-function
(lambda ()
- (when-let ((cand (funcall candidate))
- (mbwin (active-minibuffer-window)))
+ (when-let ((cand (funcall candidate)))
;; Drop properties to prevent bugs regarding candidate
;; lookup, which must handle candidates without
;; properties. Otherwise the arguments passed to the
@@ -1684,11 +1683,11 @@ PREVIEW-KEY, STATE, TRANSFORM and CANDIDATE."
;; the candidate has properties but for the final
lookup
;; after completion it does not.
(setq cand (substring-no-properties cand))
- (with-selected-window mbwin
+ (with-selected-window (active-minibuffer-window)
(let ((input (minibuffer-contents-no-properties))
(narrow consult--narrow)
- (pwin (or (minibuffer-selected-window)
(next-window))))
- (with-selected-window pwin
+ (win (or (minibuffer-selected-window)
(next-window))))
+ (with-selected-window win
(when-let ((transformed (funcall transform
narrow input cand))
(debounce
(consult--preview-key-debounce preview-key transformed)))
(when timer
@@ -1716,11 +1715,12 @@ PREVIEW-KEY, STATE, TRANSFORM and CANDIDATE."
(run-at-time
debounce nil
(lambda ()
- ;; Only preview when the
minibuffer is selected
- ;; and when the preview window
is alive.
- (when (and (eq
(selected-window) mbwin)
- (window-live-p pwin))
- (with-selected-window pwin
+ ;; Preview only when a
completion
+ ;; window is selected and when
+ ;; the preview window is alive.
+ (when (and
(consult--completion-window-p)
+ (window-live-p win))
+ (with-selected-window win
;; STEP 2: Preview candidate
(funcall state 'preview
(setq previewed transformed)))))))
;; STEP 2: Preview candidate
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/consult e1dce9725b: Preview: Use consult--completion-window-p,
ELPA Syncer <=