[Top][All Lists]

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

bug#33595: 26; Have `try-completion' or `completion--done' run abnormal

From: Stefan Monnier
Subject: bug#33595: 26; Have `try-completion' or `completion--done' run abnormal hook if sole completion
Date: Wed, 02 Jan 2019 22:15:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> So in your example, your hook function is very tightly linked to the
>> completion table.  I still don't understand this example well enough to
>> understand if/how it's linked to the UI (e.g. what should happen if the
>> user happens to use, say, ido-ubiquitous to complete his function names).
> Ido?  Idon't.  I don't know either.  Try it, to see. ;-)

More generally, the code you wrote shouldn't presume exactly which
completion UI is used, so the API should let you provide some "show
extra info" function, and then separately some UI may opt to use this
function for example when completing a sole match.

>> It's not as simple as it seems: if the user goes to some other buffer in
>> the middle of the completion, your completion-sole-match-functions will
>> not wreak havoc in unrelated completions.

> I don't know what you mean.  Maybe give a specific
> example (e.g. recipe, using the patch)?  Or not.

The hook function is active as long as the minibuffer is active, so if
the user uses recursive minibuffers, the hook function will apply not
just to the originally planned completion but also to other completions
that take place in recursive minibuffers.

It's basically the same problem as the usual problem of passing extra
parameters via dynamic scoping, where the dynamic let-binding doesn't
apply only to the first call, but to all nested calls that may occur.

Anyway, thanks, I think I see how to introduce that feature (and
I suspect it's actually already covered by the company-compatibility
extra properties).


reply via email to

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