unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Alexander Adolf <alexander.adolf@condition-alpha.com>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [Emacs] Using notmuch-address with EUDC, and completion-at-point
Date: Tue, 02 Aug 2022 17:26:51 +0200	[thread overview]
Message-ID: <a9ee88d939a1fedee389b37fbc6f4a64@condition-alpha.com> (raw)
In-Reply-To: <878roa7p45.fsf@tethera.net>

Hello David,

thanks for your comments and questions.

David Bremner <david@tethera.net> writes:

> Alexander Adolf <alexander.adolf@condition-alpha.com> writes:
>
>> As I wanted email address completion via completion-at-point in
>> message-mode too, I implemented a new EUDC function to go into
>> completion-at-point-functions [3].
>>
>> [1] https://company-mode.github.io
>> [2] https://github.com/minad/corfu
>> [3] https://github.com/emacs-mirror/emacs/blob/master/lisp/net/eudc-capf.el
>>
>
> I will have to leave to others to test this, since I'm personally still
> running emacs 27 (and that is likely to continue for a while, at least
> on some machines).

You could do

     (require 'eudcb-notmuch-address)
     (eudc-notmuch-address-set-server "localhost")

and bind the function eudc-expand-inline to a key chord of your choice
in message-mode-map.

Then you'd no longer have to tweak message-completion-alist.

This assumes that eudc-expand-inline is present in Emacs 27, of course,
which I admittedly haven't checked.

What you'd probably lose (or no longer need, whichever way you view it)
is any company-mode integration.

>> To close the loop, I also wrote an EUDC back-end to get candidates from
>> notmuch-address (which attached).
>
> Is this something that you think should be included with notmuch?

Good question. From my point of view: why not?

Its added value would be "separation of concerns", i.e. you could drop
any company-mode integration (and resort to whatever UI
completion-at-point uses), you could stop modifying
message-completion-alist, and notmuch-address-command could stay set to
'internal in all configurations.

BUT, using the full potential depends on some core Emacs infrastructure,
which will not be released until Emacs 29.

Thus, from your point of view, it could be a two step process.

In the first step, you could describe in the documentation how to bind
eudc-expand-inline in message-mode-map, and how to set notmuch-address
as the eudc-server. Just as I described above for your Emacs 27 setup.
This would allow you to refrain from modifying message-completion-alist,
and you could also drop any company mode integration from
notmuch-address.el

In the second step, when Emacs 29 will be released, the need for using
eudc-expan-inline will be removed, and adding notmuch-address as an EUDC
server alone will be enough.

> If so, is it testable without requiring any extra packages?

The short answer is yes.

On an Emacs prior to version 29, there will be two restrictions: there
won't be any way of having EUDC contribute to completion-at-point, and
there won't be any multi-server query support in EUDC either. That said,
you can still use it in a less versatile way as I have described above
for your Emacs 27 setup.

On an Emacs 29 or better, both gaps are filled (EUDC multi-server query,
and completion-at-point), and message.el is updated to give the EUDC
completion-at-point function a "foot in the door", i.e. it will be
called _before_ message-completion-function when completion-at-point is
invoked. Thus, if you add notmuch-address to eudc-server-hotlist,
completion candidates from normuch-address will automagically show up
without any further tweaking of message-mode on your part.


Many thanks and looking forward to your thoughts,

  --alexander

  reply	other threads:[~2022-08-02 15:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 14:50 [Emacs] Using notmuch-address with EUDC, and completion-at-point Alexander Adolf
2022-07-30 12:37 ` David Bremner
2022-08-02 15:26   ` Alexander Adolf [this message]
2022-08-12 10:28     ` David Bremner
2022-08-16 17:35       ` Alexander Adolf
2022-08-18 14:57         ` David Bremner
2022-08-18 21:31           ` Alexander Adolf

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

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9ee88d939a1fedee389b37fbc6f4a64@condition-alpha.com \
    --to=alexander.adolf@condition-alpha.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /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 public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).