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

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

Re: My read-buffer-function doesn't work when called by switch-to-buffer


From: Michael Heerdegen
Subject: Re: My read-buffer-function doesn't work when called by switch-to-buffer
Date: Mon, 13 Mar 2023 01:32:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Tassilo Horn <tsdh@gnu.org> writes:

> > Maybe an advice of a higher level function would better fit your
> > wished-for behavior.
>
> Do you have one in mind?

`read-buffer-to-switch'.

> I haven't checked their implementation but completion-extra-properties
> is nil and the metadata completion requests also don't return an
> annotation-function or affixation-function.  Nevertheless, all standard
> completions are annotated.  I'll have a look how marginalia does it.

They do this:

(advice-add #'completion-metadata-get
            :before-until #'marginalia--completion-metadata-get)

Looks like this is how they install their annotation-function.

> Anyway, I've played a bit with responding to metadata requests and it
> looks like it's not really suited for my goal because it seems to assume
> that the metadata won't change (e.g., category from buffer to file)
> during a single completion which is obviously a reasonable assumption.

Hmm, yes, that's a problem.  Seems a completion table can only provide
one ind of metadata for all completions and what you want doesn't fit at
all into that approach.  See the comment in `completion-table-in-turn'.


Michael.




reply via email to

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