Re: Address Completion in Emacs

Subject: Re: Address Completion in Emacs

Date: Sat, 9 Dec 2023 00:26:33 -0800



From: Keith Amidon

This thread inspired me to look a little more deeply into the address 
completion issues I've been having since switching to corfu as well. It 
was a rather long and twisted journey but I ended up getting completion 
using corfu working with the following in my init file:

    ;; Make corfu-based address completion work
    (defun kea/notmuch-address-message-capf ()
      "Return completion data for email addresses in notmuch-address.

Meant for use in `message-completion-alist'."
      (when (and (bound-and-true-p notmuch-address-completions))
        (let ((now (float-time))
              (end (save-excursion
                     (skip-chars-forward "^, \t\n")
              (start (save-excursion
                       (skip-chars-backward "^, \t\n")
          (when (> (- now notmuch-address-last-harvest) 86400)
            ;; Synchronously get completions now and update addresses in
            ;; background. Handles startup case where there might not be
            ;; anything in notmuch-address-completions because
            ;; notmuch-address-last-harvest will be 0.
            (notmuch-address-harvest (buffer-substring-no-properties 
start end) t)
          `(,start ,end ,notmuch-address-completions 'mail))))
    (defun kea/setup-notmuch-message-mode ()
      (setq notmuch-address-use-company nil)
      (setq message-completion-alist
            `((,message-newgroups-header-regexp . ,#'message-expand-group)
              (,message-email-recipient-header-regexp . 
    (add-hook 'notmuch-message-mode-hook #'kea/setup-notmuch-message-mode)

Note that I set mail-user-agent to notmuch-user-agent.

Cheers!   --- Keith

notmuch mailing list --
To unsubscribe send an email to