[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/completions-customs 6b3c665d2a 1/3: completion-auto-help new val
From: |
Jimmy Aguilar Mena |
Subject: |
feature/completions-customs 6b3c665d2a 1/3: completion-auto-help new values. |
Date: |
Thu, 10 Mar 2022 08:42:43 -0500 (EST) |
branch: feature/completions-customs
commit 6b3c665d2a8070791dff6520652c00c7b44d64bd
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>
completion-auto-help new values.
Added also entries to news and manual
---
doc/emacs/mini.texi | 9 ++++++++-
etc/NEWS | 9 +++++++++
lisp/minibuffer.el | 29 ++++++++++++++++++-----------
3 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 13d9269c68..5d351dd10b 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 80cf0a2f72..3d32513386 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 <tab> 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 36b8d80841..c6a803cbc4 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