Is there a way to auto-complete email addresses in the mu4e compose window using Ido or Helm rather than the standard *Completions* buffer?
mu4e~contacts-for-completion stores a list of contacts that
mu4e knows about. The contacts are conveniently stored as
"name <email>" strings, which is the same thing you want to insert.
Here's an example function that uses the variable together with
ido to select and insert a contact:
(defun select-and-insert-contact () (interactive) (insert (ido-completing-read "Contact: " mu4e~contacts-for-completion)))
Here's a more elaborate version which will use the partial contact before point (if any) as the initial input when completing. (Most of the code is directly from
(defun select-and-insert-contact (&optional start) (interactive) (let ((mail-abbrev-mode-regexp mu4e~compose-address-fields-regexp) (eoh ;; end-of-headers (save-excursion (goto-char (point-min)) (search-forward-regexp mail-header-separator nil t)))) (when (and eoh (> eoh (point)) (mail-abbrev-in-expansion-header-p)) (let* ((end (point)) (start (or start (save-excursion (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (goto-char (match-end 0)) (point)))) (contact (ido-completing-read "Contact: " mu4e~contacts-for-completion nil nil (buffer-substring-no-properties start end)))) (unless (equal contact "") (kill-region start end) (insert contact))))))
Disclaimer: I don't use mu4e anymore, so this is not a copy/paste or tested answer.
mu4e~compose-complete-contact seems to provide a list of contacts available for completion :
You could just feed the list to
(ido-completing-read "Complete contact: " (mu4e~compose-complete-contact)))))