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")
                    (point)))
             (start (save-excursion
                      (skip-chars-backward "^, \t\n")
                      (point))))
         (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)
           (notmuch-address-harvest-trigger))
         `(,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 . ,#'kea/notmuch-address-message-capf))))
   (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 -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to