Re: [PATCH] implement a capf for address completion

Subject: Re: [PATCH] implement a capf for address completion

Date: Sat, 10 Aug 2024 15:27:25 -0400

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Antoine Beaupré


On 2024-08-06 07:30:30, David Bremner wrote:
> Antoine Beaupré <anarcat@debian.org> writes:
>
>>
>> Now, it seems to me a simple fix is to implement a proper
>> capf (`completion-at-point-function') for notmuch. And that, in turn,
>> is actually pretty simple compared to the code hidden underneath
>> `notmuch-address-expand-name', which not only finds completion
>> candidates, but also does the whole trouble of editing the buffer.
>
> Disclaimer: I have not looked at 'capf' before today.
>
> Did you see the note at the end of docstring for completion-at-point
> functions
>
>     NOTE: These functions should be cheap to run since they’re sometimes
>     run from ‘post-command-hook’; and they should ideally only choose
>     which kind of completion table to use, and not pre-filter it based
>     on the current text between START and END (e.g., they should not
>     obey ‘completion-styles’).
>
> I'm not sure how expensive #notmuch-address-options is with the
> defaults, but calling it from post-command-hook does sound like it could
> be problematic.
>
> A second question I have about this change is how can we test
> completion? It is quite complex already, and I'm nervous about breakage.

I should have posted a followup to this patch already, and must say it's
really not ready at all.

I have found myself in the situation where my address completion is now
completely broken. I don't even *know* how to restore the previous
behavior.

So clearly, this patch should be ignored for now... But I do feel we
should somehow figure out how to hook ourselves in there. There's
probably a way to do some asynchronous thing here, and indeed that's how
even the normal tab completion works, from what I gathered.

But this is getting way too deep for me.

I will definitely need to look at this again soon though because my
stuff is broken, I will try to keep you updated.

a.
-- 
It is better to sit alone than in company with the bad; and it is better
still to sit with the good than alone. It better to speak to a seeker of
knowledge than to remain silent; but silence is better than idle words.
                        - Imam Bukhari
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: