Hi,

This is a function that I find really useful. I adapted it a bit based
on the original from Jacek Generowicz. Maybe others will find it helpful
as well.

  Sebastian

;; original 
https://groups.google.com/group/mu-discuss/browse_thread/thread/551b7a6487a0aeb3

(setq notmuch-compose-complete-ignore-address-regexp (regexp-opt '("failed" "DO 
NOT REPLY" "donotreply" "no-reply" "noreply" "Google Drive")))

(defun jmg/ido-select-recipient ()
  "Inserts a contact from the addrlookup cache.
Uses ido to select the contact from all those present in the database."
  (interactive)
  (insert
   (ido-completing-read
    "Recipient: "
    (mapcar (lambda (contact-string)
              (let* ((data (split-string contact-string "       "))
                     (address (car data))
                     (name (when (> (length (cadr data)) 0) (cadr data)))
                     )
                (if name
                    (format "%s <%s>" name address)
                  address)))
            (remove-if (lambda (string) (string-match 
notmuch-compose-complete-ignore-address-regexp string))
                       (remove-if (lambda (string) (= 0 (length string)))
                                  (split-string (shell-command-to-string 
(concat "addrlookup " (thing-at-point 'word) )) "\n")))))))



Reply via email to