Subject: Re: bug#33595: 26; Have `try-completion' or `completion--done' run abnormal hook if sole completion

From: Stefan Monnier <[email-masked]>
Date: Tue, 01 Jan 2019 23:41:06 -0500

> Enhancement request: When `try-completion' returns `t' there is a
> "unique match which is exact".  Please add an abnormal hook at this
> point, which accepts that sole completion as argument.

I'm not sure exactly what's the intention behind this: would it be an
option that influences the UI or the completion table?

More concretely, do you expect a hook function places on this variable
to apply for "any completion table" or would it be specific to
a particular completion table?

The example you give in `my-describe-function` gives me the impression
that those would inevitably be tightly linked to the completion table.
So instead of a hook variable, it would probably make more sense to add
a new `completion-extra-properties` alongside to :exit-function.

Do you have other example applications than `my-describe-function` (to
be honest, I found this example not very compelling).

> no exit function.  `try-completion' is the logical place to do this, I

Definitely not: try-completion can be used in lots of other
non-completion uses, can be called many times for a single completion
operation, etc...  try-completion should be renamed to `find-common-prefix`.

        Stefan

PS: I'm not sure I completely understand the intended behavior of
    `my-describe-function`, but I get the impression that for this
    particular example, a maybe even better approach is to use
    minibuffer-with-setup-hook to set a post-command-hook that calls
    describe-function whenever the minibuffer names a valid function
    (whether we get there via completion or plain typing, and regardless
    if it's the sole completion).