branch: externals/consult
commit 2fe809494cf2b42e83b8345f2b62f019473d695e
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Make consult-preview-at-point obsolete
---
README.org | 9 ---------
consult.el | 36 ++++++++++++++++++++++++------------
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/README.org b/README.org
index 19646daa56..096828e8a1 100644
--- a/README.org
+++ b/README.org
@@ -386,13 +386,8 @@ their descriptions.
#+findex: consult-completion-in-region
#+findex: consult-theme
-#+findex: consult-preview-at-point
-#+findex: consult-preview-at-point-mode
- =consult-theme=: Select a theme and disable all currently enabled themes.
Supports live preview of the theme while scrolling through the candidates.
-- =consult-preview-at-point= and =consult-preview-at-point-mode=: Command and
minor
- mode which previews the candidate at point in the =*Completions*= buffer.
This
- mode is relevant if you use [[https://git.sr.ht/~protesilaos/mct][Mct]] or
the default =*Completions*= UI.
- =consult-completion-in-region=: In case you don't use
[[https://github.com/minad/corfu][Corfu]] as your in-buffer
completion UI, this function can be set as =completion-in-region-function=.
Then
your minibuffer completion UI (e.g., Vertico or Icomplete) will be used for
@@ -829,10 +824,6 @@ configuration examples.
("M-s" . consult-history) ;; orig.
next-matching-history-element
("M-r" . consult-history)) ;; orig.
previous-matching-history-element
- ;; Enable automatic preview at point in the *Completions* buffer. This is
- ;; relevant when you use the default completion UI.
- :hook (completion-list-mode . consult-preview-at-point-mode)
-
;; The :init configuration is always executed (Not lazy)
:init
diff --git a/consult.el b/consult.el
index acfcdb05c4..8af7388ff2 100644
--- a/consult.el
+++ b/consult.el
@@ -5577,28 +5577,40 @@ the asynchronous search."
:add-history (thing-at-point 'symbol)
:history '(:input consult--man-history)))
-;;;; Preview at point in completions buffers
+;;;; Obsolete preview at point (enabled automatically)
+(defun consult-preview-at-point ()
+ "Obsolete since preview is enabled automatically."
+ (interactive))
(define-minor-mode consult-preview-at-point-mode
- "Preview minor mode for *Completions* buffers.
-When moving around in the *Completions* buffer, the candidate at point is
-automatically previewed."
- :group 'consult
- (if consult-preview-at-point-mode
- (add-hook 'post-command-hook #'consult-preview-at-point nil 'local)
- (remove-hook 'post-command-hook #'consult-preview-at-point 'local)))
+ "Obsolete since preview is enabled automatically."
+ :group 'consult)
+(make-obsolete 'consult-preview-at-point-mode nil
+ "Obsolete since preview is enabled automatically.")
+(make-obsolete-variable 'consult-preview-at-point-mode nil
+ "Obsolete since preview is enabled automatically.")
+(make-obsolete 'consult-preview-at-point nil
+ "Obsolete since preview is enabled automatically.")
-(defun consult-preview-at-point ()
+;;;; Integration with completion systems
+
+;;;;; Integration: Default *Completions*
+
+(defun consult--default-completion-list-preview ()
"Preview candidate at point in *Completions* buffer."
- (interactive)
(when-let ((win (active-minibuffer-window))
(buf (window-buffer win))
(fun (buffer-local-value 'consult--preview-function buf)))
(funcall fun)))
-;;;; Integration with completion systems
+(defun consult--default-completion-list-preview-setup ()
+ "Setup preview at point in *Completions* buffer."
+ (add-hook 'post-command-hook #'consult--default-completion-list-preview nil
'local))
-;;;;; Integration: Default *Completions*
+(add-hook 'completion-list-mode-hook
#'consult--default-completion-list-preview-setup)
+;; TODO move to embark-consult.el
+(with-eval-after-load 'embark
+ (add-hook 'embark-collect-mode-hook
#'consult--default-completion-list-preview-setup))
(defun consult--default-completion-minibuffer-candidate ()
"Return current minibuffer candidate from default completion system or
Icomplete."