[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating *Completions* as you type

From: Eshel Yaron
Subject: Re: Updating *Completions* as you type
Date: Sun, 15 Oct 2023 22:31:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13)


sbaugh@catern.com writes:

> Taking inspiration from zcomplete, I wrote this patch to
> provide just this feature, thoughts?
> From fef547ece1d5cd3eebbc2fb7f51e51f15cfc2b4a Mon Sep 17 00:00:00 2001
> From: Spencer Baugh <sbaugh@catern.com>
> Date: Sat, 14 Oct 2023 14:27:23 -0400
> Subject: [PATCH] Add completions-auto-update
> It can be useful for the *Completions* buffer to automatically update
> as you type.  That way you can see immediately what the next
> completion operation will do, even if you've changed text in the
> buffer since triggering completion.
> * lisp/minibuffer.el (completions-auto-update): Add.
> (completions-no-auto-update-commands): Add.
> (completions--post-command): Add.
> (minibuffer-completion-help): Add completions--post-command to
> post-command-hook.

I tried this out, and I came across a certain issue: say you do
`C-h o foo TAB`, and then looking at the completion candidates
you realize you actually wanted something with `bar`, so you
type `M-DEL` to delete `foo` from the minibuffer to make room
for `bar`.  But now `post-command-hook` runs with an empty
minibuffer before you start typing `bar`, so it updates the
completions buffer with a very large list of symbols, causing
Emacs to briefly stall.  I think that the completions buffer
possibly shouldn't be updated when the minibuffer is empty.
Perhaps there could be a minimum minibuffer contents size for
updating the completions buffer, or some other heuristic to
avoid auto-displaying excessively large sets of candidates.
Another option is to update the completions buffer on
`post-self-insert-hook` instead of `post-command-hook`, that
way you only update the completions buffer when the user
actually inserts input in the minibuffer, and you don't need to
keep a `completions-no-auto-update-commands` list.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]