1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id C7EFC431FAF
\r
6 for <notmuch@notmuchmail.org>; Thu, 12 Apr 2012 00:07:57 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id bIriozQ2d-Ng for <notmuch@notmuchmail.org>;
\r
16 Thu, 12 Apr 2012 00:07:57 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 2D708431FAE
\r
19 for <notmuch@notmuchmail.org>; Thu, 12 Apr 2012 00:07:57 -0700 (PDT)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 6C47468055; Thu, 12 Apr 2012 10:07:54 +0300 (EEST)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: Taylor Carpenter <taylor@codecafe.com>, notmuch@notmuchmail.org
\r
24 Subject: Re: [PATCH] notmuch-mutt: replace gnu sed and xargs with perl
\r
25 In-Reply-To: <20120412002953.GA27056@codecafe.com>
\r
26 References: <20120412002953.GA27056@codecafe.com>User-Agent:
\r
27 Notmuch/0.12+77~gee11800 (http://notmuchmail.org) Emacs/23.3.1
\r
28 (x86_64-unknown-linux-gnu)
\r
29 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
30 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
31 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
32 Date: Thu, 12 Apr 2012 10:07:54 +0300
\r
33 Message-ID: <m2r4vtjulx.fsf@guru.guru-group.fi>
\r
35 Content-Type: text/plain; charset=us-ascii
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Thu, 12 Apr 2012 07:07:57 -0000
\r
50 On Thu, Apr 12 2012, Taylor Carpenter wrote:
\r
52 > External software dependencies removed: sed and xargs.
\r
54 > Sed shell escaping is handled automatically with perl symlink function.
\r
56 > The xargs usage is specific to gnu xargs (fails on bsd xargs, etc).
\r
58 > NOTE: The current query pulls the list of files into an array all at
\r
59 > once. The larger the list the more memory used.
\r
64 It is not too hard to read the filelist from pipe; Check the example
\r
65 I sent in id:"m2hawr4klm.fsf@guru.guru-group.fi"
\r
68 Btw: what if there are same filenames in different directories that
\r
69 match. With basename there will be collision. Alternatives:
\r
71 * instead of basename convert '/':s to '_':s
\r
72 * take md5 or sha1 sum of the filename
\r
73 * take md5 or sha1 sum of dirname of the filename and concatenate...
\r
77 > contrib/notmuch-mutt/notmuch-mutt | 9 ++++++---
\r
78 > 1 files changed, 6 insertions(+), 3 deletions(-)
\r
80 > diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
\r
81 > index 424f9a3..c995022 100755
\r
82 > --- a/contrib/notmuch-mutt/notmuch-mutt
\r
83 > +++ b/contrib/notmuch-mutt/notmuch-mutt
\r
84 > @@ -12,6 +12,7 @@ use strict;
\r
88 > +use File::Basename;
\r
89 > use Getopt::Long qw(:config no_getopt_compat);
\r
90 > use Mail::Internet;
\r
91 > use Mail::Box::Maildir;
\r
92 > @@ -41,9 +42,11 @@ sub search($$) {
\r
93 > $query = shell_quote($query);
\r
95 > empty_maildir($maildir);
\r
96 > - system("notmuch search --output=files $query"
\r
97 > - . " | sed -e 's: :\\\\ :g'"
\r
98 > - . " | xargs --no-run-if-empty ln -s -t $maildir/cur/");
\r
99 > + my @filelist = `notmuch search --output=files $query`;
\r
100 > + foreach(@filelist) {
\r
102 > + symlink($_, "$maildir/cur/" . basename($_));
\r
110 > _______________________________________________
\r
111 > notmuch mailing list
\r
112 > notmuch@notmuchmail.org
\r
113 > http://notmuchmail.org/mailman/listinfo/notmuch
\r