all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: [PATCH] Question about completion behavior
Date: Wed, 9 Mar 2022 17:14:53 +0100	[thread overview]
Message-ID: <20220309161453.g3ta6sd2xqzvwcgr@Ergus> (raw)
In-Reply-To: <20220309143016.n2q3u25gat6plaxz@Ergus>

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

Please give a look to the attached patch...

It adds two new values:

visible: to update when visible else do nothing (as Stefan suggested).

always: to always update or show completions (Like bash
show-all-if-ambiguous)

BTW: the lazy value is more like show-all-if-unmodified i think


On Wed, Mar 09, 2022 at 03:30:16PM +0100, Ergus wrote:
>On Wed, Mar 09, 2022 at 03:16:17PM +0200, Eli Zaretskii wrote:
>>>Date: Wed, 9 Mar 2022 12:46:54 +0100
>>>From: Ergus <spacibba@aol.com>
>>>Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
>>>
>>>Look at the attached patch, it may need some small improve to solve the
>>>case 4. but so far it gives a consistent behavior with any value of
>>>completion-auto-help (and it is actually simpler than the current code)
>>>
>>>Alternatively we may add another custom, something like:
>>>
>>>completions-on-complete-action which may have 3 possible values:
>>
>>We don't need a new option, we can add a new value to the
>>completion-auto-help.
>>
>>But yes, I think this behavior you propose _must_ be optional, most
>>probably opt-in for starters.  Not everyone will want it.
>>
>>See also completion-cycle-threshold: this new behavior should not
>>tramp that option.
>
>I tend to agree Eli, but actually I started a thread because the default
>behavior is indeed inconsistent with completion-auto-help as the same
>Stefan mentioned.
>
>The current behavior mixes the completion-auto-help==t with
>completion-auto-help=='lazy when there is some completion and the
>completions are already visible (hiding them).
>
>If we do:
>
>compi<tab> it should be completed, but if the completions list is
>somehow visible, then after the tab it is not correct, so we currently
>hide it, when we must just update it right?
>
>The fix in any case is extremely simple and I think that with a new vale
>for completion-auto-help to 'always it will work, but may be even
>complicated to explain in the documentation...
>
>

[-- Attachment #2: completion_custom.patch --]
[-- Type: text/plain, Size: 2238 bytes --]

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 @@ completion-auto-help
 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 @@ completion--do-completion
               (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

  reply	other threads:[~2022-03-09 16:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220309001013.gxyh2uasbuxiz6ww.ref@Ergus>
2022-03-09  0:10 ` Question about completion behavior Ergus
2022-03-09  0:22   ` Stefan Monnier
2022-03-09  1:46     ` Ergus
2022-03-09  3:05       ` Stefan Monnier
2022-03-09  3:37         ` Eli Zaretskii
2022-03-09 10:11           ` Ergus
2022-03-09 11:46             ` Ergus
2022-03-09 13:16               ` Eli Zaretskii
2022-03-09 13:46                 ` Po Lu
2022-03-09 17:32                   ` Stefan Monnier
2022-03-09 17:41                     ` Ergus
2022-03-10  0:42                     ` Po Lu
2022-03-10 10:21                       ` Ergus
2022-03-10 11:15                         ` Po Lu
2022-03-10 14:03                           ` Ergus
2022-03-10 18:50                             ` Juri Linkov
2022-03-10 22:35                               ` Ergus
2022-03-12 18:31                                 ` Juri Linkov
2022-03-13 14:58                                   ` Ergus
2022-03-12  0:17                               ` Ergus
2022-03-12 18:34                                 ` Juri Linkov
2022-03-13 11:21                                   ` Ergus
2022-03-13 17:44                                     ` Juri Linkov
2022-03-13 18:50                                       ` Ergus
2022-03-13 18:57                                         ` Eli Zaretskii
2022-03-13 19:49                                           ` Ergus
2022-03-13 20:48                                       ` [External] : " Drew Adams
2022-03-13 21:15                                         ` Ergus
2022-03-13 23:14                                           ` Drew Adams
2022-03-13 23:38                                             ` Ergus
2022-03-14  2:23                                               ` Drew Adams
2022-03-12 20:25                             ` Drew Adams
2022-03-09 14:30                 ` Ergus
2022-03-09 16:14                   ` Ergus [this message]
2022-03-09 16:56                   ` Eli Zaretskii
2022-03-09 13:10             ` Eli Zaretskii
2022-03-09 14:22               ` Ergus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220309161453.g3ta6sd2xqzvwcgr@Ergus \
    --to=spacibba@aol.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.