all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Drew Adams <drew.adams@oracle.com>
Cc: 33595@debbugs.gnu.org
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	[thread overview]
Message-ID: <jwvpntesano.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4f16869e-5f88-47bc-a118-5ea37cfb6d9a@default> (Drew Adams's message of "Wed, 2 Jan 2019 08:20:51 -0800 (PST)")

>> 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.
   ^^^
   now

> 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).


        Stefan





      reply	other threads:[~2019-01-03  3:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03  4:07 bug#33595: 26; Have `try-completion' or `completion--done' run abnormal hook if sole completion Drew Adams
2018-12-03 18:52 ` bug#33595: [PATCH] " Drew Adams
2018-12-28 18:56   ` Drew Adams
2018-12-29  8:08     ` Eli Zaretskii
2019-01-02  1:23       ` Stefan Monnier
2019-01-02  4:41 ` Stefan Monnier
2019-01-02  7:11   ` Drew Adams
2019-01-02 15:27     ` Stefan Monnier
2019-01-02 16:20       ` Drew Adams
2019-01-03  3:15         ` Stefan Monnier [this message]

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=jwvpntesano.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=33595@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /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.