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: Tassilo Horn
Subject: Re: My read-buffer-function doesn't work when called by switch-to-buffer
Date: Sun, 12 Mar 2023 19:51:33 +0100
User-agent: mu4e 1.9.22; emacs 30.0.50

Michael Heerdegen <michael_heerdegen@web.de> writes:

Hi Michael,

> I think the lesson is that it's better to avoid nested
> `completing-read' calls.  It is probably not intended to allow to
> change the completion table in `read-buffer-function'.

Seems so but it nevertheless works extremely well since I strongly
stated my wish by appending to minibuffer-with-setup-hook. :-)

> Maybe an advice of a higher level function would better fit your
> wished-for behavior.

Do you have one in mind?

>> And a bonus question: I use vertico + marginalia, so the buffers (and
>> files in C-x C-f, variables/functions in C-h v/f,...) are nicely
>> annotated, e.g., with the buffer's mode or the file's permissions.
>> What do I have to do that the recentf candidates also get those
>> niceties?  Wrap the recentf completion table so that it responds to
>> metadata requests?
>
> Dunno.  I don't use these packages.  Maybe using :annotation-function
> in `completion-extra-properties' also works?  How do these packages
> achieve this?

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.

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.

Bye,
Tassilo



reply via email to

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