summaryrefslogtreecommitdiff
path: root/completion-conf.el
diff options
context:
space:
mode:
Diffstat (limited to 'completion-conf.el')
-rw-r--r--completion-conf.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/completion-conf.el b/completion-conf.el
index c40294e..b4d2c03 100644
--- a/completion-conf.el
+++ b/completion-conf.el
@@ -212,11 +212,21 @@ candidates."
group-fun))
((list str grou-fun)))))
+(defun durand-preview-exit-hook ()
+ "Clear things up."
+ (let (bf)
+ (cond
+ ((setq bf (get-buffer "*Completions*"))
+ (with-current-buffer bf
+ (remove-hook 'post-command-hook
+ #'durand-preview-in-completion-list))))))
+
(defun durand-open-completion-list-with-buffer-preview ()
"Open the completion list buffer and propertize the candidates."
(interactive)
(advice-add #'completion--insert :filter-args
#'durand-propertize-buffer-for-completion-list)
+ (add-hook 'minibuffer-exit-hook #'durand-preview-exit-hook)
(let ((minibuffer-allow-text-properties t))
(minibuffer-completion-help))
(advice-remove #'completion--insert
@@ -226,7 +236,7 @@ candidates."
(cond
((derived-mode-p 'completion-list-mode)
(add-hook 'post-command-hook
- #'durand-preview-in-completion-list))
+ #'durand-preview-in-completion-list nil t))
((user-error "Something is wrong!"))))
;; (defun durand-quit-completion-list-with-buffer-preview ()