emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/completions-highlight-modifications d4aab7d 3/4: New command min


From: Jimmy Aguilar Mena
Subject: feature/completions-highlight-modifications d4aab7d 3/4: New command minibuffer-choose-completion
Date: Thu, 19 Nov 2020 01:29:52 -0500 (EST)

branch: feature/completions-highlight-modifications
commit d4aab7d481603b6798979a064dfee28844d441fe
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>

    New command minibuffer-choose-completion
    
    This command uses *Completions* candidates only when highlighted.
---
 lisp/completions-highlight.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lisp/completions-highlight.el b/lisp/completions-highlight.el
index 9ce83e6..e19a4d8 100644
--- a/lisp/completions-highlight.el
+++ b/lisp/completions-highlight.el
@@ -153,6 +153,15 @@ is executed in another window, but cursor stays in 
minibuffer."
   (interactive "p")
   (with-minibuffer-scroll-window (previous-line n)))
 
+;; Maybe this may be done with an advise?
+(defun minibuffer-choose-completion ()
+  "Execute `choose-completion' in *Completions*."
+  (interactive)
+  (if (and (completions-highlight-completions-visible-p)
+           (overlay-buffer completions-highlight-overlay))
+      (with-minibuffer-scroll-window (choose-completion))
+    (minibuffer-complete-and-exit)))
+
 ;; General commands
 (defun completions-highlight--set-suffix (choice)
   "Set CHOICE suffix to current completion.
@@ -192,6 +201,8 @@ suffix."
     (define-key map [left] #'minibuffer-previous-completion)
     (define-key map [down] #'minibuffer-next-line-completion)
     (define-key map [up] #'minibuffer-previous-line-completion)
+    (define-key map [remap minibuffer-complete-and-exit]
+      #'minibuffer-choose-completion)
     map)
   "Keymap used in minibuffer while *Completions* is active.")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]