bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#66948: [PATCH] Add Completion Preview mode


From: Juri Linkov
Subject: bug#66948: [PATCH] Add Completion Preview mode
Date: Tue, 07 Nov 2023 09:08:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> Only one thing that I suggest is to add `backward-delete-char-untabify`
>> to `completion-preview-commands` since it's bound to DEL in Lisp buffers.
>> Or there is no way to generalize it for all modes?
>
> I too wonder if there's a good generalization we can make here.  It
> seems impractical and inelegant to track all backward-deleting commands
> in `completion-preview-commands`.  We could try to check if a command
> was invoked by pressing DEL, regardless of what command it actually is,
> but I don't think that's such a good solution because of course the DEL
> key itself is not the point--we want to recognize `delete-backward-char`
> even if it's bound to some other key, for example.

We have exactly the same problem while developing a live update
of the *Completions* window while typing in the minibuffer.
Here too DEL needs to update the completions.  But this works
as long as the users don't rebind the DEL key.  Therefore
currently a list of commands is used as well.

> The current solution, of providing a minimal list of commands in
> `completion-preview-commands`, basically delegates the decision of which
> further commands should keep the preview alive to major mode authors and
> to the users themselves.  I think that's basically fine, but if we had
> some way to recognize backward-deleting commands without hard-coding
> them (perhaps a symbol property such as `delete-backward-command`) that
> would be even better IMO.

Agreed, it's easy to customize commands deemed to be important for the user.

Until we will find a way to remove such a list altogether.
One possible solution is to rely on the hook:

  (add-hook 'after-change-functions
            (lambda (beg end len)
              (when (and (= beg end) (= len 1))
                ...))
            nil t)

But this should be developed separately,
then later integrated into completion-preview.





reply via email to

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