Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3EFDD431FBD for ; Tue, 21 Jan 2014 14:31:17 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BG2oT7Rs2mrJ for ; Tue, 21 Jan 2014 14:31:11 -0800 (PST) X-Greylist: delayed 859 seconds by postgrey-1.32 at olra; Tue, 21 Jan 2014 14:31:11 PST Received: from mailchk-m05.uwaterloo.ca (mailservices.uwaterloo.ca [129.97.128.141]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A9C1D431FAF for ; Tue, 21 Jan 2014 14:31:11 -0800 (PST) Received: from connect.uwaterloo.ca (connhub2.connect.uwaterloo.ca [129.97.149.119]) by mailchk-m05.uwaterloo.ca (8.14.4/8.14.4) with ESMTP id s0LMGXSb013415 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) for ; Tue, 21 Jan 2014 17:16:50 -0500 Received: from uwaterloo.ca (10.20.190.150) by connhub2.connect.uwaterloo.ca (129.97.149.119) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 21 Jan 2014 17:16:46 -0500 From: Sebastian Fischmeister To: Subject: ido address lookup for notmuch User-Agent: Notmuch/0.17+27~gae47d61 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Homepage: http://esg.uwaterloo.ca Date: Tue, 21 Jan 2014 17:13:16 -0500 Message-ID: <87a9ep0yrn.fsf@uwaterloo.ca> MIME-Version: 1.0 Content-Type: text/plain X-Miltered: at mailchk-m05 with ID 52DEF1C1.006 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Virus-Scanned: clamav-milter 0.98 at mailchk-m05 X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mailchk-m05.uwaterloo.ca [129.97.128.141]); Tue, 21 Jan 2014 17:16:50 -0500 (EST) X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 22:31:17 -0000 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")))))))