[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Navigating completions from minibuffer
|
From: |
Juri Linkov |
|
Subject: |
Re: Navigating completions from minibuffer |
|
Date: |
Tue, 07 Nov 2023 09:20:45 +0200 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
>> This change:
>> f0c0ff6bf23 * New option to use arrows in the minibuffer to select
>> completions (bug#59486)
>> works really well but appears to introduce a separate problem:
>>
>> Assume you have a command e.g. foo but also foo-bar and foo-bas.
>>
>> Earlier you could type M-x foo and press enter to invoke foo.
>>
>> Now, with the new option enabled, typing
>> M-x foo
>> appears to require that you first press TAB before pressing RET.
>
> The problem is that now RET calls minibuffer-choose-completion,
> whereas exit-minibuffer is what you want if what you have typed is a
> valid completion already; Perhaps we need
> minibuffer-choose-completion-or-exit-minibuffer ...
Agreed. When a completion candidate is not selected
let's use the contents of the minibuffer.
Please try this patch:
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 4e8590989b3..0410e3a0b8d 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3005,7 +3005,7 @@ minibuffer-visible-completions-map
"<right>" (minibuffer-visible-completions-bind #'minibuffer-next-completion)
"<up>" (minibuffer-visible-completions-bind
#'minibuffer-previous-line-completion)
"<down>" (minibuffer-visible-completions-bind
#'minibuffer-next-line-completion)
- "RET" (minibuffer-visible-completions-bind
#'minibuffer-choose-completion)
+ "RET" (minibuffer-visible-completions-bind
#'minibuffer-choose-completion-or-exit)
"C-g" (minibuffer-visible-completions-bind
#'minibuffer-hide-completions))
@@ -4693,6 +4693,12 @@ minibuffer-choose-completion
(let ((completion-use-base-affixes t))
(choose-completion nil no-exit no-quit))))
+(defun minibuffer-choose-completion-or-exit (&optional no-exit no-quit)
+ (interactive "P")
+ (condition-case nil
+ (minibuffer-choose-completion no-exit no-quit)
+ (error (exit-minibuffer))))
+
(defun minibuffer-complete-history ()
"Complete the minibuffer history as far as possible.
Like `minibuffer-complete' but completes on the history items
- Navigating completions from minibuffer, T.V Raman, 2023/11/06
- Navigating completions from minibuffer, T.V Raman, 2023/11/06
- Re: Navigating completions from minibuffer,
Juri Linkov <=
- Re: Navigating completions from minibuffer, T.V Raman, 2023/11/07
- Re: Navigating completions from minibuffer, T.V Raman, 2023/11/07
- Re: Navigating completions from minibuffer, Juri Linkov, 2023/11/08
- Re: Navigating completions from minibuffer, T.V Raman, 2023/11/08
- Re: Navigating completions from minibuffer, T.V Raman, 2023/11/08
- Slow completion-at-point was Re: Navigating completions from minibuffer, T.V Raman, 2023/11/08
- Re: Slow completion-at-point, Juri Linkov, 2023/11/09
- Re: Slow completion-at-point, Dmitry Gutov, 2023/11/09
- Re: Slow completion-at-point, Juri Linkov, 2023/11/09
- Re: Slow completion-at-point, João Távora, 2023/11/09