GNU bug report logs -
#68801
30.0.50; minibuffer-visible-completions=t makes RET in completion-in-region a no-op with nothing selected
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Mon, 29 Jan 2024 18:51:02 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
sbaugh <at> catern.com writes:
>>> Alternatively... as a completely separate point, I'd like
>>> completion-in-region to select the first completion candidate by
>>> default. I think that's useful in some cases and, for
>>> completion-in-region, doesn't have any negatives: we couldn't do it in
>>> the minibuffer because it would interfere with accepting the default,
>>> but there are no defaults in completion-in-region.
>>>
>>> If we make c-i-r select the first completion candidate by default, that
>>> would both:
>>>
>>> - Make the completion-show-help help render correctly with the "only
>>> override RET when there's a selected completion" patch.
>>>
>>> - Partially mitigate the RET issue all on its own
>>
>> Calling 'first-completion' makes sense even for the minibuffer,
>> at least optionally.
>
> What about this simple patch?
>
> If minibuffer-visible-completions=nil, it just calls first-completion.
> This doesn't meaningfully change anything, since previously M-RET would
> just no-op in that situation. And it's actually quite useful, because
> it makes M-RET useful without having to ever actually do M-<down>; one
> can just type text to narrow the completions and then hit M-RET. Which
> is sometimes nice.
>
> If minibuffer-visible-completions=t, it calls first-completion only when
> there's no minibuffer-default; that way a simple RET will still select
> the minibuffer default.
>
> diff --git a/lisp/simple.el b/lisp/simple.el
> index 8246b9cab81..715ab672655 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -10355,7 +10355,10 @@ completion-setup-function
> "Type \\[minibuffer-choose-completion] on a completion to select it.\n")))
> (insert (substitute-command-keys
> "Type \\[minibuffer-next-completion] or \\[minibuffer-previous-completion] \
> -to move point between completions.\n\n")))))))
> +to move point between completions.\n\n"))))
> + (unless (and minibuffer-visible-completions minibuffer-default)
> + (with-minibuffer-completions-window
> + (first-completion))))))
>
> (add-hook 'completion-setup-hook #'completion-setup-function)
>
I found selecting first-completion in the minibuffer to be annoying, so
now I'm trying with the following instead (which also fixes the
highlight to actually be shown):
(defun minibuffer-cir-first-completion ()
"Move point to the first completion in the *Completions* window."
(when completion-in-region-mode
(with-selected-window (get-buffer-window standard-output 0)
(when completions-highlight-face
(setq-local cursor-face-highlight-nonselected-window t))
(first-completion))))
(add-hook 'completion-setup-hook #'minibuffer-cir-first-completion 90)
This bug report was last modified 1 year and 69 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.