From: Jimmy Aguilar Mena Date: Thu, 10 Mar 2022 10:24:17 +0000 (+0100) Subject: completion-auto-help new values. X-Git-Tag: emacs-29.0.90~1931^2~1002^2~21 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6b3c665d2a8070791dff6520652c00c7b44d64bd;p=emacs.git completion-auto-help new values. Added also entries to news and manual --- diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 13d9269c68e..5d351dd10b6 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -628,7 +628,14 @@ commands never display the completion list buffer; you must type shows the completion list buffer on the second attempt to complete. In other words, if there is nothing to complete, the first @key{TAB} echoes @samp{Next char not unique}; the second @key{TAB} shows the -completion list buffer. +completion list buffer. With the previous values and the default +@code{t} the completions are hidden when some unique completion is +executed. If @code{completion-auto-help} is set to @code{always} the +completion commands are always shown after a completion attempt or +updated if they are already visible. If the value is @code{visible} +then completions are not hidden, but updated if they are already +visible while the current behavior stays the same as default if they +are not. @vindex completion-cycle-threshold If @code{completion-cycle-threshold} is non-@code{nil}, completion diff --git a/etc/NEWS b/etc/NEWS index 80cf0a2f725..3d325133861 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -554,6 +554,15 @@ This option controls the sorting of the completion candidates in the "*Completions*" buffer. Available styles are no sorting, alphabetical (the default), or a custom sort function. +*** New values for the 'completion-auto-select' option. + +There are two new values to control the way *Completions* behave after +a if completion is not unique. 'always updates or shows +the *Completions* buffer after any attempt to complete. 'visual is +like 'always, but only update the completions if they are already +visible. The default value t always hide the completion buffer after +some completion is made. + ** Isearch and Replace +++ diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 36b8d808417..c6a803cbc44 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -898,7 +898,11 @@ If the value is t the *Completions* buffer is displayed whenever completion is requested but cannot be done. If the value is `lazy', the *Completions* buffer is only displayed after the second failed attempt to complete." - :type '(choice (const nil) (const t) (const lazy))) + :type '(choice (const :tag "Disabled" nil) + (const :tag "Enabled legacy" t) + (const :tag "After a second attempt" lazy) + (const :tag "Visible update" visible) + (const :tag "Always update" always))) (defvar completion-styles-alist '((emacs21 @@ -1343,16 +1347,19 @@ when the buffer's text is already an exact match." (completion--cache-all-sorted-completions beg end comps) (minibuffer-force-complete beg end)) (completed - ;; We could also decide to refresh the completions, - ;; if they're displayed (and assuming there are - ;; completions left). - (minibuffer-hide-completions) - (if exact - ;; If completion did not put point at end of field, - ;; it's a sign that completion is not finished. - (completion--done completion - (if (< comp-pos (length completion)) - 'exact 'unknown)))) + (cond + (exact + ;; If completion did not put point at end of field, + ;; it's a sign that completion is not finished. + (minibuffer-hide-completions) + (completion--done completion + (if (< comp-pos (length completion)) + 'exact 'unknown))) + ((pcase completion-auto-help + ('visible (get-buffer-window "*Completions*" 0)) + ('always t)) + (minibuffer-completion-help beg end)) + (t (minibuffer-hide-completions)))) ;; Show the completion table, if requested. ((not exact) (if (pcase completion-auto-help