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 4C1AE4196F0 for ; Sat, 20 Mar 2010 19:35:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.5 X-Spam-Level: X-Spam-Status: No, score=-1.5 tagged_above=-999 required=5 tests=[BAYES_50=0.8, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham 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 zAsnS5vhaDHF for ; Sat, 20 Mar 2010 19:35:38 -0700 (PDT) Received: from ipex3.johnshopkins.edu (ipex3.johnshopkins.edu [128.220.161.140]) by olra.theworths.org (Postfix) with ESMTP id 04C17431FC1 for ; Sat, 20 Mar 2010 19:35:37 -0700 (PDT) X-IronPort-AV: E=Sophos;i="4.51,281,1267419600"; d="scan'208";a="364693379" Received: from c-69-255-36-229.hsd1.md.comcast.net (HELO lucky) ([69.255.36.229]) by ipex3.johnshopkins.edu with ESMTP/TLS/AES256-SHA; 20 Mar 2010 22:35:37 -0400 Received: from jkr by lucky with local (Exim 4.69) (envelope-from ) id 1NtB0w-0007M9-Vj; Sat, 20 Mar 2010 22:35:42 -0400 From: Jesse Rosenthal To: notmuch@notmuchmail.org Date: Sat, 20 Mar 2010 22:35:42 -0400 Message-ID: <87fx3uflkx.fsf@jhu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [notmuch] Using notmuch as an address book for tab-completion 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: Sun, 21 Mar 2010 02:35:39 -0000 Dear All, There was some talk on IRC ages ago about using notmuch as an address-book for tab-completion in emacs message mode. Thanks to some great recent work (Ingmar Vanhassel's shared lib and Sebastians's cnotmuch python lib) I have been able to take a first step in that direction. I've written a python script (with some help and suggestions from spaetz) which can perform the address-book functionality, and a backend for emacs's EUDC address-lookup functionality to access the script. They are available by the following commands: git clone http://jkr.acm.jhu.edu/git/notmuch_addresses.git git clone http://jkr.acm.jhu.edu/git/notmuch_eudc.git Remember, neither of these will do you much good with the shared lib and cnotmuch installed. At the moment, the script works by search addresses that you have written to (or CC'd or BCC'd) in the past. This seems like a good utility-speed tradeoff, but it would be easy to hack the script to search a different set of messages. Give three letters (it looks through first names, last names, and email addresses) it returns results from my 12K messages in well under a second. The responses are sorted by frequency, and each email address is associated with the most frequently used real name (null real-names are avoided, unless they're the only option). The script can be run from the command line by: $ python notmuch_addresses.py query To get tab completion from emacs, you have to install the script into your path, make it executable, and then put my eudcb-notmuch.el file into your load path (you should byte-compile it too). DON'T CHANGE THE TITLE OF THE .EL FILE! EUDC looks for a specific title based on protocol. Then add the following to your .emacs: (eudc-set-server "localhost" 'notmuch t) (setq eudc-server-hotlist '(("localhost" . notmuch))) (setq eudc-inline-expansion-servers 'hotlist) if you wish to use BBDB too (likely before you use notmuch), then you should use something like this: (eudc-set-server "localhost" 'bbdb t) (eudc-protocol-set 'eudc-inline-expansion-format '("%s %s <%s>" firstname lastname net) 'bbdb) (eudc-set-server "localhost" 'notmuch t) (setq eudc-server-hotlist '(("localhost" . bbdb) ("localhost" . notmuch))) (setq eudc-inline-expansion-servers 'hotlist) That should do it. Please let me know if it works for you. (For those of you who care, eudcb-notmuch.el has a few hacky bits to hide the fact that notmuch really isn't an address book. That is, it doesn't know the difference between names and email addresses. So everything you enter just goes in as one string, which I call "name." Back-end stuff, but if you're looking through the code, that might make a few things clearer.) Best, Jesse