From 2db2bd94c53fdbb757d885ba8aca94dacb46ce7a Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 26 Mar 2021 00:09:10 +0800 Subject: Poor man's live update of completion candidates * completion-conf.el (minibuffer-local-completion-map): (durand-completion-display-after-change): (durand-completion-toggle-display): This will toggle between live updating and not live updating. --- completion-conf.el | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'completion-conf.el') diff --git a/completion-conf.el b/completion-conf.el index ed28b06..efc9bd5 100644 --- a/completion-conf.el +++ b/completion-conf.el @@ -43,6 +43,7 @@ (define-key minibuffer-local-completion-map (vector 'down) #'durand-embark-scroll-down-or-go-to-completions) (define-key minibuffer-local-completion-map (vector 'up) #'durand-embark-scroll-up-or-go-to-completions) +(define-key minibuffer-local-completion-map (vector ?\s-v) #'durand-completion-toggle-display) (define-key completion-list-mode-map (vector 'down) #'durand-completion-scroll-down-or-go-to-minibuffer) (define-key completion-list-mode-map (vector 'up) #'durand-completion-scroll-up-or-go-to-minibuffer) @@ -88,6 +89,48 @@ minibuffer as usual." (remove-hook 'minibuffer-setup-hook 'durand-headlong-minibuffer-setup-hook) (remove-hook 'minibuffer-exit-hook 'durand-headlong-minibuffer-exit-hook)) +;;;###autoload +(fset + 'durand-completion-display-after-change + (make-byte-code + #x080 + (unibyte-string 192 32 135) + (vector #'minibuffer-completion-help) + 2 + "Call `minibuffer-completion-help' with no input. + +\(fn &rest ARGS)" + nil)) + +;;;###autoload +(fset + 'durand-completion-toggle-display + (make-byte-code + 0 + (unibyte-string 192 9 62 ; determine if it is a member + 131 14 0 + ;; memq + 194 193 192 196 35 130 20 0 + ;; not memq + 195 193 192 197 196 36 + 135) + (vector #'durand-completion-display-after-change + 'after-change-functions + 'remove-hook 'add-hook t nil) + 6 + "Toggle to display the list of completions after each input. + +\(fn)" + nil)) + +;; (defun durand-completion-toggle-display () +;; "Toggle to display the list of completions after each input." +;; (interactive) +;; (cond +;; ((memq #'durand-completion-display-after-change 'post-command-hook) +;; (remove-hook 'post-command-hook #'durand-completion-display-after-change t)) +;; ((add-hook 'post-command-hook #'durand-completion-display-after-change nil t)))) + ;;;###autoload (defun regex-try-completion (string table pred point &optional metadata) "The function that tries to complete STRING using completion table \ -- cgit v1.2.3-18-g5258