unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jesse Rosenthal <jrosenthal@jhu.edu>
To: notmuch@notmuchmail.org
Subject: Using notmuch as an address book for tab-completion
Date: Sat, 20 Mar 2010 22:35:42 -0400	[thread overview]
Message-ID: <87fx3uflkx.fsf@jhu.edu> (raw)

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

             reply	other threads:[~2010-03-21  2:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-21  2:35 Jesse Rosenthal [this message]
2010-03-21  2:41 ` Using notmuch as an address book for tab-completion Jesse Rosenthal
2010-03-21 20:18 ` Sebastian Spaeth
2010-03-21 20:30   ` Sandra Snan
2010-03-21 23:13   ` Michal Sojka
2010-03-22  9:04     ` Sebastian Spaeth
2010-03-22 10:14 ` Ruben Pollan
2010-03-22 12:40   ` Sebastian Spaeth
2010-03-23 12:37 ` Sebastian Spaeth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fx3uflkx.fsf@jhu.edu \
    --to=jrosenthal@jhu.edu \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).