[Stefano Zacchiroli] Bug#628018: [PATCH] notmuch-mutt utility for notmuch/contrib/
authorDavid Bremner <david@tethera.net>
Mon, 26 Mar 2012 10:37:20 +0000 (07:37 +2100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:44 +0000 (09:45 -0800)
47/3638e759ad28f8ea96201f7173532e54bd5d22 [new file with mode: 0644]

diff --git a/47/3638e759ad28f8ea96201f7173532e54bd5d22 b/47/3638e759ad28f8ea96201f7173532e54bd5d22
new file mode 100644 (file)
index 0000000..78f34aa
--- /dev/null
@@ -0,0 +1,723 @@
+Return-Path: <bremner@unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 637C9431FBD\r
+       for <notmuch@notmuchmail.org>; Mon, 26 Mar 2012 03:37:29 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id aI0TTzHDlbuS for <notmuch@notmuchmail.org>;\r
+       Mon, 26 Mar 2012 03:37:27 -0700 (PDT)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A2C53431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 26 Mar 2012 03:37:27 -0700 (PDT)\r
+Received: from fctnnbsc30w-142166230117.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+       ([142.166.230.117] helo=zancas.localnet)\r
+       by tesseract.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32)\r
+       (Exim 4.72) (envelope-from <bremner@unb.ca>)\r
+       id 1SC7Ij-00085s-NM; Mon, 26 Mar 2012 07:37:26 -0300\r
+Received: from bremner by zancas.localnet with local (Exim 4.77)\r
+       (envelope-from <bremner@unb.ca>)\r
+       id 1SC7Ie-0005BK-DO; Mon, 26 Mar 2012 07:37:20 -0300\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Stefano Zacchiroli] Bug#628018: [PATCH] notmuch-mutt utility for\r
+       notmuch/contrib/\r
+In-Reply-To: <87haxbr6tv.fsf@zancas.localnet>\r
+User-Agent: Notmuch/0.12 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 26 Mar 2012 07:37:20 -0300\r
+Message-ID: <87ehsfr6lb.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: message/rfc822\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: 8bit\r
+X-Spam_bar: -\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 26 Mar 2012 10:37:29 -0000\r
+\r
+Return-path: <bounces+20120326-bremner=debian.org@packages.qa.debian.org>\r
+Envelope-to: david@tethera.net\r
+Delivery-date: Mon, 26 Mar 2012 06:39:14 -0300\r
+Received: from yantan.tethera.net ([67.202.105.224])\r
+       by tesseract.cs.unb.ca with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\r
+       (Exim 4.72)\r
+       (envelope-from <bounces+20120326-bremner=debian.org@packages.qa.debian.org>)\r
+       id 1SC6OO-00083z-Gx\r
+       for david@tethera.net; Mon, 26 Mar 2012 06:39:14 -0300\r
+Received: from quantz.debian.org ([206.12.19.122])\r
+       by yantan.tethera.net with esmtp (Exim 4.72)\r
+       (envelope-from <bounces+20120326-bremner=debian.org@packages.qa.debian.org>)\r
+       id 1SC6OL-00028f-Rv\r
+       for david@tethera.net; Mon, 26 Mar 2012 06:39:10 -0300\r
+Received: from qa by quantz.debian.org with local (Exim 4.72)\r
+       (envelope-from <bounces+20120326-bremner=debian.org@packages.qa.debian.org>)\r
+       id 1SC6OK-0007gg-HH\r
+       for david@tethera.net; Mon, 26 Mar 2012 09:39:08 +0000\r
+Received: from busoni.debian.org ([140.211.15.34])     from C=NA,ST=NA,\r
+ L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=busoni.debian.org,\r
+ EMAIL=hostmaster@busoni.debian.org (verified) by quantz.debian.org with\r
+ esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)       (Exim 4.72)     (envelope-from\r
+ <debbugs@busoni.debian.org>)  id 1SC6OK-0007g8-4K     for\r
+ notmuch@packages.qa.debian.org; Mon, 26 Mar 2012 09:39:08 +0000\r
+Received: from debbugs by busoni.debian.org with local (Exim 4.72)\r
+ (envelope-from <debbugs@busoni.debian.org>)   id 1SC6OJ-0003wK-8d; Mon,\r
+ 26 Mar 2012 09:39:07 +0000\r
+X-Loop: owner@bugs.debian.org\r
+Subject: Bug#628018: [PATCH] notmuch-mutt utility for notmuch/contrib/\r
+Reply-To: Stefano Zacchiroli <zack@debian.org>, 628018@bugs.debian.org\r
+Resent-From: Stefano Zacchiroli <zack@debian.org>\r
+Resent-To: debian-bugs-dist@lists.debian.org\r
+Resent-CC: Carl Worth <cworth@debian.org>\r
+X-Loop: owner@bugs.debian.org\r
+Resent-Date: Mon, 26 Mar 2012 09:39:05 +0000\r
+Resent-Message-ID: <handler.628018.B628018.133275457414603@bugs.debian.org>\r
+X-Debian-PR-Message: followup 628018\r
+X-Debian-PR-Package: notmuch\r
+X-Debian-PR-Keywords: patch\r
+X-Debian-PR-Source: notmuch\r
+Received: via spool by 628018-submit@bugs.debian.org\r
+ id=B628018.133275457414603          (code B ref 628018); Mon,\r
+ 26 Mar 2012 09:39:05 +0000\r
+Received: (at 628018) by bugs.debian.org; 26 Mar 2012 09:36:14 +0000\r
+X-Spam-Checker-Version: SpamAssassin 3.3.1-bugs.debian.org_2005_01_02\r
+       (2010-03-16) on busoni.debian.org\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-8.4 required=4.0\r
+ tests=BAYES_00,FOURLA,FROMDEVELOPER,\r
+       IMPRONONCABLE_2,MONEY,MURPHY_DRUGS_REL8,PGPSIGNATURE,STOCKLIKE autolearn=ham\r
+       version=3.3.1-bugs.debian.org_2005_01_02\r
+X-Spam-Bayes: score:0.0000 Tokens: new, 19; hammy, 151; neutral, 575;\r
+ spammy,       0. spammytokens: hammytokens:0.000-+--H*c:pgp-sha256,\r
+ 0.000-+--manpage,     0.000-+--H*u:1.5.21, 0.000-+--H*UA:1.5.21,\r
+ 0.000-+--H*u:2010-09-15\r
+Received: from upsilon.hackadomia.org ([91.121.245.170])       by\r
+ busoni.debian.org with esmtp (Exim 4.72)      (envelope-from <zack@upsilon.cc>)\r
+ id 1SC6LU-0003mg-9Y   for 628018@bugs.debian.org; Mon, 26 Mar 2012 09:36:14\r
+ +0000\r
+Received: from usha.takhisis.invalid (zack.inria.fr [128.93.60.82])    by\r
+ upsilon.hackadomia.org (Postfix) with ESMTPSA id C4CD81012D   for\r
+ <628018@bugs.debian.org>; Mon, 26 Mar 2012 11:36:06 +0200 (CEST)\r
+Received: by usha.takhisis.invalid (Postfix, from userid 1000) id\r
+ AC24F6811BA; Mon, 26 Mar 2012 11:36:06 +0200 (CEST)\r
+Date: Mon, 26 Mar 2012 11:36:06 +0200\r
+From: Stefano Zacchiroli <zack@debian.org>\r
+To: 628018@bugs.debian.org\r
+Message-ID: <20120326093606.GA3086@upsilon.cc>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha256;\r
+ protocol="application/pgp-signature";\r
+ boundary="R3G7APHDIzY6R/pk"\r
+Content-Disposition: inline\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+Delivered-To: notmuch@packages.qa.debian.org\r
+Precedence: list\r
+X-Loop: notmuch@packages.qa.debian.org\r
+X-Debian: PTS\r
+X-Debian-Package: notmuch\r
+X-PTS-Package: notmuch\r
+X-PTS-Keyword: bts\r
+List-Unsubscribe: <mailto:pts@qa.debian.org?body=unsubscribe%20notmuch>\r
+Resent-Sender: Debian QA <qa@quantz.debian.org>\r
+X-Spam-Score: 0.0\r
+X-Spam_bar: /\r
+\r
+\r
+--R3G7APHDIzY6R/pk\r
+Content-Type: multipart/mixed; boundary="82I3+IH0IqGh5yIs"\r
+Content-Disposition: inline\r
+\r
+\r
+--82I3+IH0IqGh5yIs\r
+Content-Type: text/plain; charset=iso-8859-1\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Here is an updated patch set that ships the notmuch-mutt utility and\r
+updated the Debian packaging for it. It is now better integrated with\r
+notmuch: it has been renamed to "notmuch-mutt" (to match the naming\r
+convention of other notmuch interfaces) and stores all its data under\r
+~/.cache/notmuch/mutt/ to avoid polluting user $HOME with other\r
+directories. I've also fixed the Debian packaging to generate the\r
+manpage during build.\r
+\r
+The first patch in the set adds notmuch-mutt to contrib/, the second\r
+updates debian/ to build a new "notmuch-mutt" binary package.\r
+\r
+The full story is available at http://bugs.debian.org/628018\r
+\r
+David: I'm still unable to get through the moderation queue of the\r
+notmuch mailing list. Would you be so kind to forward this mail there,\r
+for patch review?\r
+\r
+TIA,\r
+Cheers.\r
+--=20\r
+Stefano Zacchiroli     zack@{upsilon.cc,pps.jussieu.fr,debian.org} . o .\r
+Ma=EEtre de conf=E9rences   ......   http://upsilon.cc/zack   ......   . . o\r
+Debian Project Leader    .......   @zack on identi.ca   .......    o o o\r
+=AB the first rule of tautology club is the first rule of tautology club =BB\r
+\r
+--82I3+IH0IqGh5yIs\r
+Content-Type: text/x-diff; charset=iso-8859-1\r
+Content-Disposition: attachment; filename="0001-contrib-new-mutt-notmuch-utility-for-Mutt-integratio.patch"\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+=46rom cbb43be7d163e7662c0aa4fcb69f173074bb947d Mon Sep 17 00:00:00 2001\r
+=46rom: Stefano Zacchiroli <zack@upsilon.cc>\r
+Date: Mon, 26 Mar 2012 10:45:58 +0200\r
+Subject: [PATCH 1/2] contrib: new mutt-notmuch utility for Mutt integration\r
+\r
+---\r
+ contrib/notmuch-mutt/.gitignore      |    2 +\r
+ contrib/notmuch-mutt/Makefile        |   12 ++\r
+ contrib/notmuch-mutt/README          |   59 +++++++++\r
+ contrib/notmuch-mutt/notmuch-mutt    |  234 ++++++++++++++++++++++++++++++=\r
+++++\r
+ contrib/notmuch-mutt/notmuch-mutt.rc |    9 ++\r
+ 5 files changed, 316 insertions(+), 0 deletions(-)\r
+ create mode 100644 contrib/notmuch-mutt/.gitignore\r
+ create mode 100644 contrib/notmuch-mutt/Makefile\r
+ create mode 100644 contrib/notmuch-mutt/README\r
+ create mode 100755 contrib/notmuch-mutt/notmuch-mutt\r
+ create mode 100644 contrib/notmuch-mutt/notmuch-mutt.rc\r
+\r
+diff --git a/contrib/notmuch-mutt/.gitignore b/contrib/notmuch-mutt/.gitign=\r
+ore\r
+new file mode 100644\r
+index 0000000..682a577\r
+--- /dev/null\r
++++ b/contrib/notmuch-mutt/.gitignore\r
+@@ -0,0 +1,2 @@\r
++notmuch-mutt.1\r
++README.html\r
+diff --git a/contrib/notmuch-mutt/Makefile b/contrib/notmuch-mutt/Makefile\r
+new file mode 100644\r
+index 0000000..87f9031\r
+--- /dev/null\r
++++ b/contrib/notmuch-mutt/Makefile\r
+@@ -0,0 +1,12 @@\r
++NAME =3D notmuch-mutt\r
++\r
++all: $(NAME) $(NAME).1\r
++\r
++$(NAME).1: $(NAME)\r
++      pod2man $< > $@\r
++\r
++README.html: README\r
++      markdown $< > $@\r
++\r
++clean:\r
++      rm -f notmuch-mutt.1 README.html\r
+diff --git a/contrib/notmuch-mutt/README b/contrib/notmuch-mutt/README\r
+new file mode 100644\r
+index 0000000..382ac91\r
+--- /dev/null\r
++++ b/contrib/notmuch-mutt/README\r
+@@ -0,0 +1,59 @@\r
++notmuch-mutt: Notmuch (of a) helper for Mutt\r
++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=\r
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\r
++\r
++notmuch-mutt provide integration among the [Mutt] [1] mail user agent and =\r
+the\r
++[Notmuch] [2] mail indexer.\r
++\r
++notmuch-mutt offer two main integration features. The first one is the abi=\r
+lity\r
++of stating a **search query interactively** and then jump to a fresh Maild=\r
+ir\r
++containing its search results only. The second one is the ability to\r
++**reconstruct threads on the fly** starting from the currently highlighted\r
++mail, which comes handy when a thread has been split across different mail=\r
+dirs,\r
++archived, or the like.\r
++\r
++notmuch-mutt enables to trigger mail searches via a Mutt macro (usually F8=\r
+) and\r
++reconstruct threads via another (usually F9). Check the manpage for the 2-=\r
+liner\r
++configuration snippet for your Mutt configuration files (~/.muttrc,\r
++/etc/Muttrc, or a /etc/Muttrc.d snippet).\r
++\r
++A [blog style introduction] [3] to notmuch-mutt is available and includes =\r
+some\r
++more rationale for its existence.\r
++\r
++Arguably, some of the logics of notmuch-mutt could disappear by adding sup=\r
+port\r
++for a --output=3Dsymlinks flag to notmuch.\r
++\r
++\r
++[1]: http://www.mutt.org/\r
++[2]: http://notmuchmail.org/\r
++[3]: http://upsilon.cc/~zack/blog/posts/2011/01/how_to_use_Notmuch_with_Mu=\r
+tt/\r
++\r
++\r
++Requirements\r
++------------\r
++\r
++To *run* notmuch-mutt you will need Perl with the following libraries:\r
++\r
++- Mail::Box <http://search.cpan.org/~markov/Mail-Box/>\r
++  (Debian package: libmail-box-perl)\r
++- Mail::Internet <http://search.cpan.org/~markov/MailTools/>\r
++  (Debian package: libmailtools-perl)\r
++- String::ShellQuote <http://search.cpan.org/~rosch/String-ShellQuote/Shel=\r
+lQuote.pm>\r
++  (Debian package: libstring-shellquote-perl)\r
++- Term::ReadLine <http://search.cpan.org/~hayashi/Term-ReadLine-Gnu/>\r
++  (Debian package: libterm-readline-gnu-perl)\r
++\r
++To *build* notmuch-mutt documentation you will need:\r
++\r
++- pod2man (coming with Perl) to generate the manpage\r
++- markdown to generate README.html out of this file\r
++\r
++\r
++License\r
++-------\r
++\r
++notmuch-mutt is copyright (C) 2011-2012 Stefano Zacchiroli <zack@upsilon.c=\r
+c>.\r
++\r
++notmuch-mutt is released under the terms of the GNU General Public License\r
++(GPL), version 3 or above. A copy of the license is available online at\r
++<http://www.gnu.org/licenses/>.\r
++\r
+diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmu=\r
+ch-mutt\r
+new file mode 100755\r
+index 0000000..29674ec\r
+--- /dev/null\r
++++ b/contrib/notmuch-mutt/notmuch-mutt\r
+@@ -0,0 +1,234 @@\r
++#!/usr/bin/perl -w\r
++#\r
++# notmuch-mutt - notmuch (of a) helper for Mutt\r
++#\r
++# Copyright: =A9 2011-2012 Stefano Zacchiroli <zack@upsilon.cc>=20\r
++# License: GNU General Public License (GPL), version 3 or above\r
++#\r
++# See the bottom of this file for more documentation.\r
++# A manpage can be obtained by running "pod2man notmuch-mutt > notmuch-mut=\r
+t.1"\r
++\r
++use strict;\r
++use warnings;\r
++\r
++use File::Path;\r
++use Getopt::Long qw(:config no_getopt_compat);\r
++use Mail::Internet;\r
++use Mail::Box::Maildir;\r
++use Pod::Usage;\r
++use String::ShellQuote;\r
++use Term::ReadLine;\r
++\r
++\r
++my $cache_dir =3D "$ENV{HOME}/.cache/notmuch/mutt";\r
++\r
++\r
++# create an empty maildir (if missing) or empty an existing maildir"\r
++sub empty_maildir($) {\r
++    my ($maildir) =3D (@_);\r
++    rmtree($maildir) if (-d $maildir);\r
++    my $folder =3D new Mail::Box::Maildir(folder =3D> $maildir,\r
++                                      create =3D> 1);\r
++    $folder->close();\r
++}\r
++\r
++# search($maildir, $query)\r
++# search mails according to $query with notmuch; store results in $maildir\r
++sub search($$) {\r
++    my ($maildir, $query) =3D @_;\r
++    $query =3D shell_quote($query);\r
++\r
++    empty_maildir($maildir);\r
++    system("notmuch search --output=3Dfiles $query"\r
++         . " | sed -e 's: :\\\\ :g'"\r
++         . " | xargs --no-run-if-empty ln -s -t $maildir/cur/");\r
++}\r
++\r
++sub prompt($$) {\r
++    my ($text, $default) =3D @_;\r
++    my $query =3D "";\r
++    my $term =3D Term::ReadLine->new( "notmuch-mutt" );\r
++    my $histfile =3D "$cache_dir/history";\r
++\r
++    $term->ornaments( 0 );\r
++    $term->unbind_key( ord( "\t" ) );\r
++    $term->MinLine( 3 );\r
++    $histfile =3D $ENV{MUTT_NOTMUCH_HISTFILE} if $ENV{MUTT_NOTMUCH_HISTFIL=\r
+E};\r
++    $term->ReadHistory($histfile) if (-r $histfile);\r
++    while (1) {\r
++      chomp($query =3D $term->readline($text, $default));\r
++      if ($query eq "?") {\r
++          system("man", "notmuch");\r
++      } else {\r
++          $term->WriteHistory($histfile);\r
++          return $query;\r
++      }\r
++    }\r
++}\r
++\r
++sub get_message_id() {\r
++    my $mail =3D Mail::Internet->new(\*STDIN);\r
++    $mail->head->get("message-id") =3D~ /^<(.*)>$/;   # get message-id\r
++    return $1;\r
++}\r
++\r
++sub search_action($$@) {\r
++    my ($interactive, $results_dir, @params) =3D @_;\r
++\r
++    if (! $interactive) {\r
++      search($results_dir, join(' ', @params));\r
++    } else {\r
++      my $query =3D prompt("search ('?' for man): ", join(' ', @params));\r
++      if ($query ne "") {\r
++          search($results_dir,$query);\r
++      }\r
++    }\r
++}\r
++\r
++sub thread_action(@) {\r
++    my ($results_dir, @params) =3D @_;\r
++    my $mid =3D get_message_id();\r
++    my $tid =3D `notmuch search --output=3Dthreads id:$mid`;# get thread id\r
++    chomp($tid);\r
++\r
++    search($results_dir, $tid);\r
++}\r
++\r
++sub tag_action(@) {\r
++    my $mid =3D get_message_id();\r
++\r
++    system("notmuch tag "\r
++         . shell_quote(join(' ', @_))\r
++         . " id:$mid");\r
++}\r
++\r
++sub die_usage() {\r
++    my %podflags =3D ( "verbose" =3D> 1,\r
++                  "exitval" =3D> 2 );\r
++    pod2usage(%podflags);\r
++}\r
++\r
++sub main() {\r
++    mkpath($cache_dir) unless (-d $cache_dir);\r
++\r
++    my $results_dir =3D "$cache_dir/results";\r
++    my $interactive =3D 0;\r
++    my $help_needed =3D 0;\r
++\r
++    my $getopt =3D GetOptions(\r
++      "h|help" =3D> \$help_needed,\r
++      "o|output-dir=3Ds" =3D> \$results_dir,\r
++      "p|prompt" =3D> \$interactive);\r
++    if (! $getopt || $#ARGV < 0) { die_usage() };\r
++    my ($action, @params) =3D ($ARGV[0], @ARGV[1..$#ARGV]);\r
++\r
++    foreach my $param (@params) {\r
++      $param =3D~ s/folder:=3D/folder:/g;\r
++    }\r
++\r
++    if ($help_needed) {\r
++      die_usage();\r
++    } elsif ($action eq "search" && $#ARGV =3D=3D 0 && ! $interactive) {\r
++      print STDERR "Error: no search term provided\n\n";\r
++      die_usage();\r
++    } elsif ($action eq "search") {\r
++      search_action($interactive, $results_dir, @params);\r
++    } elsif ($action eq "thread") {\r
++      thread_action($results_dir, @params);\r
++    } elsif ($action eq "tag") {\r
++      tag_action(@params);\r
++    } else {\r
++      die_usage();\r
++    }\r
++}\r
++\r
++main();\r
++\r
++__END__\r
++\r
++=3Dhead1 NAME\r
++\r
++notmuch-mutt - notmuch (of a) helper for Mutt\r
++\r
++=3Dhead1 SYNOPSIS\r
++\r
++=3Dover\r
++\r
++=3Ditem B<notmuch-mutt> [I<OPTION>]... search [I<SEARCH-TERM>]...\r
++\r
++=3Ditem B<notmuch-mutt> [I<OPTION>]... thread < I<MAIL>\r
++\r
++=3Ditem B<notmuch-mutt> [I<OPTION>]... tag [I<TAGS>]... < I<MAIL>\r
++\r
++=3Dback\r
++\r
++=3Dhead1 DESCRIPTION\r
++\r
++notmuch-mutt is a frontend to the notmuch mail indexer capable of populati=\r
+ng\r
++maildir with search results.\r
++\r
++=3Dhead1 OPTIONS\r
++\r
++=3Dover 4\r
++\r
++=3Ditem -o DIR\r
++\r
++=3Ditem --output-dir DIR\r
++\r
++Store search results as (symlink) messages under maildir DIR. Beware: DIR =\r
+will\r
++be overwritten. (Default: F<~/.cache/notmuch/mutt/results/>)\r
++\r
++=3Ditem -p\r
++\r
++=3Ditem --prompt\r
++\r
++Instead of using command line search terms, prompt the user for them (only=\r
+ for\r
++"search").\r
++\r
++=3Ditem -h\r
++\r
++=3Ditem --help\r
++\r
++Show usage information and exit.\r
++\r
++=3Dback\r
++\r
++=3Dhead1 INTEGRATION WITH MUTT\r
++\r
++notmuch-mutt can be used to integrate notmuch with the Mutt mail user agent\r
++(unsurprisingly, given the name). To that end, you should define macros li=\r
+ke\r
++the following in your Mutt configuration (usually one of: F<~/.muttrc>,\r
++F</etc/Muttrc>, or a configuration snippet under F</etc/Muttrc.d/>):\r
++\r
++    macro index <F8> \\r
++          "<enter-command>unset wait_key<enter><shell-escape>notmuch-mutt =\r
+--prompt search<enter><change-folder-readonly>~/.cache/notmuch/mutt/results=\r
+<enter>" \\r
++          "notmuch: search mail"\r
++    macro index <F9> \\r
++          "<enter-command>unset wait_key<enter><pipe-message>notmuch-mutt =\r
+thread<enter><change-folder-readonly>~/.cache/notmuch/mutt/results<enter><e=\r
+nter-command>set wait_key<enter>" \\r
++          "notmuch: reconstruct thread"\r
++    macro index <F6> \\r
++          "<enter-command>unset wait_key<enter><pipe-message>notmuch-mutt =\r
+tag -inbox<enter>" \\r
++          "notmuch: remove message from inbox"\r
++\r
++The first macro (activated by <F8>) prompts the user for notmuch search te=\r
+rms\r
++and then jump to a temporary maildir showing search results. The second ma=\r
+cro\r
++(activated by <F9>) reconstructs the thread corresponding to the current m=\r
+ail\r
++and show it as search results. The third macro (activated by <F6>) removes=\r
+ the\r
++tag C<inbox> from the current message; by changing C<-inbox> this macro ma=\r
+y be\r
++customised to add or remove tags appropriate to the users notmuch work-flo=\r
+w.\r
++\r
++To keep notmuch index current you should then periodically run C<notmuch\r
++new>. Depending on your local mail setup, you might want to do that via cr=\r
+on,\r
++as a hook triggered by mail retrieval, etc.\r
++\r
++=3Dhead1 SEE ALSO\r
++\r
++mutt(1), notmuch(1)\r
++\r
++=3Dhead1 AUTHOR\r
++\r
++Copyright: (C) 2011-2012 Stefano Zacchiroli <zack@upsilon.cc>\r
++\r
++License: GNU General Public License (GPL), version 3 or higher\r
++\r
++=3Dcut\r
+diff --git a/contrib/notmuch-mutt/notmuch-mutt.rc b/contrib/notmuch-mutt/no=\r
+tmuch-mutt.rc\r
+new file mode 100644\r
+index 0000000..269f03f\r
+--- /dev/null\r
++++ b/contrib/notmuch-mutt/notmuch-mutt.rc\r
+@@ -0,0 +1,9 @@\r
++macro index <F8> \\r
++      "<enter-command>unset wait_key<enter><shell-escape>notmuch-mutt --pr=\r
+ompt search<enter><change-folder-readonly>~/.cache/notmuch/mutt/results<ent=\r
+er>" \\r
++      "notmuch: search mail"\r
++macro index <F9> \\r
++      "<enter-command>unset wait_key<enter><pipe-message>notmuch-mutt thre=\r
+ad<enter><change-folder-readonly>~/.cache/notmuch/mutt/results<enter><enter=\r
+-command>set wait_key<enter>" \\r
++      "notmuch: reconstruct thread"\r
++macro index <F6> \\r
++      "<enter-command>unset wait_key<enter><pipe-message>notmuch-mutt tag =\r
+-inbox<enter>" \\r
++      "notmuch: remove message from inbox"\r
+--=20\r
+1.7.9.1\r
+\r
+\r
+--82I3+IH0IqGh5yIs\r
+Content-Type: text/x-diff; charset=us-ascii\r
+Content-Disposition: attachment; filename="0002-debian-packaging-new-binary-package-notmuch-mutt.patch"\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+=46rom c342af0fa2b9d936753f57cd8fa232ca246079d1 Mon Sep 17 00:00:00 2001\r
+=46rom: Stefano Zacchiroli <zack@upsilon.cc>\r
+Date: Mon, 26 Mar 2012 10:51:44 +0200\r
+Subject: [PATCH 2/2] debian packaging: new binary package notmuch-mutt\r
+\r
+---\r
+ debian/changelog             |    6 ++++++\r
+ debian/control               |   16 ++++++++++++++++\r
+ debian/notmuch-mutt.docs     |    1 +\r
+ debian/notmuch-mutt.install  |    2 ++\r
+ debian/notmuch-mutt.manpages |    1 +\r
+ debian/rules                 |    2 ++\r
+ 6 files changed, 28 insertions(+), 0 deletions(-)\r
+ create mode 100644 debian/notmuch-mutt.docs\r
+ create mode 100644 debian/notmuch-mutt.install\r
+ create mode 100644 debian/notmuch-mutt.manpages\r
+\r
+diff --git a/debian/changelog b/debian/changelog\r
+index d0eec37..bd70d08 100644\r
+--- a/debian/changelog\r
++++ b/debian/changelog\r
+@@ -1,3 +1,9 @@\r
++notmuch (0.12-2) UNRELEASED; urgency=3Dlow\r
++\r
++  * new binary package "notmuch-mutt" for Mutt integration\r
++\r
++ -- Stefano Zacchiroli <zack@debian.org>  Mon, 26 Mar 2012 10:47:29 +0200\r
++\r
+ notmuch (0.12-1) unstable; urgency=3Dlow\r
+=20\r
+   * New upstream release\r
+diff --git a/debian/control b/debian/control\r
+index ed27c58..ada9d3d 100644\r
+--- a/debian/control\r
++++ b/debian/control\r
+@@ -105,3 +105,19 @@ Description: thread-based email index, search and tagg=\r
+ing (vim interface)\r
+  This package provides a vim based mail user agent based on\r
+  notmuch.\r
+=20\r
++Package: notmuch-mutt\r
++Architecture: all\r
++Depends: notmuch, libmail-box-perl, libmailtools-perl,\r
++ libstring-shellquote-perl, libterm-readline-gnu-perl,\r
++ ${misc:Depends}\r
++Recommends: mutt\r
++Enhances: notmuch, mutt\r
++Description: thread-based email index, search and tagging (Mutt interface)\r
++ notmuch-mutt provides integration among the Mutt mail user agent and\r
++ the Notmuch mail indexer.\r
++ .\r
++ notmuch-mutt offer two main integration features. The first one is\r
++ the ability of stating a search query interactively and then jump to\r
++ a fresh Maildir containing its search results only. The second one is\r
++ the ability to reconstruct threads on the fly starting from the\r
++ current highlighted mail.\r
+diff --git a/debian/notmuch-mutt.docs b/debian/notmuch-mutt.docs\r
+new file mode 100644\r
+index 0000000..f3d25cd\r
+--- /dev/null\r
++++ b/debian/notmuch-mutt.docs\r
+@@ -0,0 +1 @@\r
++contrib/notmuch-mutt/README\r
+diff --git a/debian/notmuch-mutt.install b/debian/notmuch-mutt.install\r
+new file mode 100644\r
+index 0000000..9141c26\r
+--- /dev/null\r
++++ b/debian/notmuch-mutt.install\r
+@@ -0,0 +1,2 @@\r
++contrib/notmuch-mutt/notmuch-mutt     usr/bin\r
++contrib/notmuch-mutt/notmuch-mutt.rc  etc/Muttrc.d\r
+diff --git a/debian/notmuch-mutt.manpages b/debian/notmuch-mutt.manpages\r
+new file mode 100644\r
+index 0000000..3f6b8ab\r
+--- /dev/null\r
++++ b/debian/notmuch-mutt.manpages\r
+@@ -0,0 +1 @@\r
++contrib/notmuch-mutt/notmuch-mutt.1\r
+diff --git a/debian/rules b/debian/rules\r
+index 956f3f2..603b3ab 100755\r
+--- a/debian/rules\r
++++ b/debian/rules\r
+@@ -9,10 +9,12 @@ override_dh_auto_configure:\r
+ override_dh_auto_build:\r
+       dh_auto_build\r
+       dh_auto_build --sourcedirectory bindings/python\r
++      $(MAKE) -C contrib/notmuch-mutt\r
+=20\r
+ override_dh_auto_clean:\r
+       dh_auto_clean\r
+       dh_auto_clean --sourcedirectory bindings/python\r
++      $(MAKE) -C contrib/notmuch-mutt clean\r
+=20\r
+ override_dh_auto_install:\r
+       dh_auto_install\r
+--=20\r
+1.7.9.1\r
+\r
+\r
+--82I3+IH0IqGh5yIs--\r
+\r
+--R3G7APHDIzY6R/pk\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: Digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.12 (GNU/Linux)\r
+\r
+iQIVAwUBT3A4gJwxUDxthmOWAQhoFxAAjELiHQHDPMQA3EDK02/IuJFuSFQm2wtm\r
+FO0IHaI/fDUlZrXOUEeo8wAwih9MI0ILTgwuWFVq6YmHUqvye7clFoFc9uRUg4kZ\r
+ic62tbtRx23vPljBj8tI1F2/tlLZclL1rUt4pKoLPezul7XiIw56v1I4MQNrr1HM\r
+RhWpzp1mQ0499osM1cRqlkFoOPT5sGrC/t8h6Dy+HiWkFvuwvuaV7jvbkwNKHKAF\r
++f/vzkHecNb3imRsl6odXNrQf6+CEAUI+t/gzgEJ8yHdEGegEkeCei21KosvtRSo\r
+pDlfc5VcUUtHIUfrqFDV69lqfq1OkeQ9Oe7P6UNlT/Lubd74ebqzTg5yvmK6WjCh\r
+lU3GY7aK4Gbxr1pAxUPVFAQf4WVuNEXjbFB1RgyCdMTIcNj9H9HsbunezjWEw1EL\r
+Qcr1hhYVY0rQAtpq9Ndd1V1CmqGhsvYoAJpM53Z+H9WAXEW1ngUhoy0RKGNBS004\r
+h6LtrB1LdLr/ta4kNPEcD8tlMQmr1f2ZeKpYv/DJvHyG9uplzcLpqcVCdMc2DQlA\r
+EyUC8wfCPY+2kpVxdJzI66Q7MHr0NUFDAJqIh4mgzWjKKKlDhSYmJKi+PezqJAad\r
+tAbyV18j8VpFy0d2DLs3Plryibu/ANco2h/QUCoEHdz0emRETomssEEcD4ORjYwD\r
+z95twQ09fJ8=\r
+=A/JP\r
+-----END PGP SIGNATURE-----\r
+\r
+--R3G7APHDIzY6R/pk--\r
+\r
+\r
+\r