summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-03-26 00:09:10 +0800
committerJSDurand <mmemmew@gmail.com>2021-03-26 00:09:10 +0800
commit2db2bd94c53fdbb757d885ba8aca94dacb46ce7a (patch)
treed585f6b98f37efa2ce28e0a3f80288a9a1b92e8b
parent399b1f3f5bb5f3c5e19256b28b1880e2eeb87494 (diff)
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.
-rw-r--r--completion-conf.el43
1 files changed, 43 insertions, 0 deletions
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)
@@ -89,6 +90,48 @@ minibuffer as usual."
(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 \
TABLE for the `regex' style.