[PATCH] notmuch-mutt: replace gnu sed and xargs with perl
authorTaylor Carpenter <taylor@codecafe.com>
Thu, 12 Apr 2012 00:29:53 +0000 (19:29 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:16 +0000 (09:46 -0800)
2e/51f2b61a3277095d17ac7da5e938fb35ed2566 [new file with mode: 0644]

diff --git a/2e/51f2b61a3277095d17ac7da5e938fb35ed2566 b/2e/51f2b61a3277095d17ac7da5e938fb35ed2566
new file mode 100644 (file)
index 0000000..d8b5a9d
--- /dev/null
@@ -0,0 +1,108 @@
+Return-Path: <taylor@codecafe.com>\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 1F666431FAF\r
+       for <notmuch@notmuchmail.org>; Wed, 11 Apr 2012 17:29:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 g67iQUM2Xv6G for <notmuch@notmuchmail.org>;\r
+       Wed, 11 Apr 2012 17:29:56 -0700 (PDT)\r
+Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com\r
+       [209.85.214.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 803DE431FAE\r
+       for <notmuch@notmuchmail.org>; Wed, 11 Apr 2012 17:29:56 -0700 (PDT)\r
+Received: by obbwd20 with SMTP id wd20so2187452obb.26\r
+       for <notmuch@notmuchmail.org>; Wed, 11 Apr 2012 17:29:56 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=date:from:to:subject:message-id:mime-version:content-type\r
+       :content-disposition:user-agent:x-gm-message-state;\r
+       bh=dUU69oB4BOWR6CEKJ5ItjAJygKSVJo3v7m/Ja6ISXSg=;\r
+       b=UvWXqlSm5rgB1uMyRlhZExK/1wgc+eSKsQCDxKku/Aq4CYGx+/9oVgAwN4VJGFVrqz\r
+       d/3Mox1PC9MzVkiwk8tQZJCP51QJzesZ99rt4hzP0AsfKX6ZLYBOjxIT/M5/fqtlOfnZ\r
+       4swY5msK4amX4VowtZAbJ4juHXe/wbuQkAuf+RqWz9r1H3lCp06EbxSAg/68zcAM6Fav\r
+       0+OS2OjbLsRZU7KaHR/egpipdbVM0FrTu8RHtPafQPPqxYbeuGChe69CmQAQytIlXexf\r
+       l7R66XMdEXiT6KJjpFO4bgQfb8oEC+aYUQ9nSm8EkDAGJJEQootnrfP1E3XqL7ME6yaF\r
+       ZWzA==\r
+Received: by 10.182.122.36 with SMTP id lp4mr455656obb.64.1334190595936;\r
+       Wed, 11 Apr 2012 17:29:55 -0700 (PDT)\r
+Received: from localhost (cpe-173-174-57-204.austin.res.rr.com.\r
+       [173.174.57.204])\r
+       by mx.google.com with ESMTPS id yw3sm4676970obb.7.2012.04.11.17.29.54\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 11 Apr 2012 17:29:55 -0700 (PDT)\r
+Date: Wed, 11 Apr 2012 19:29:53 -0500\r
+From: Taylor Carpenter <taylor@codecafe.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] notmuch-mutt: replace gnu sed and xargs with perl\r
+Message-ID: <20120412002953.GA27056@codecafe.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Gm-Message-State:\r
+ ALoCoQl4ZQ5paBJUzlpikzBVgYeIZyzynqG6mvzWhCelq4VMXO3L2uEKbvAAfevjVNAwM5dbjsGN\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: Thu, 12 Apr 2012 00:29:58 -0000\r
+\r
+External software dependencies removed: sed and xargs.\r
+\r
+Sed shell escaping is handled automatically with perl symlink function.\r
+\r
+The xargs usage is specific to gnu xargs (fails on bsd xargs, etc).\r
+\r
+NOTE: The current query pulls the list of files into an array all at\r
+once.  The larger the list the more memory used.\r
+---\r
+ contrib/notmuch-mutt/notmuch-mutt |    9 ++++++---\r
+ 1 files changed, 6 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt\r
+index 424f9a3..c995022 100755\r
+--- a/contrib/notmuch-mutt/notmuch-mutt\r
++++ b/contrib/notmuch-mutt/notmuch-mutt\r
+@@ -12,6 +12,7 @@ use strict;\r
+ use warnings;\r
+ \r
+ use File::Path;\r
++use File::Basename;\r
+ use Getopt::Long qw(:config no_getopt_compat);\r
+ use Mail::Internet;\r
+ use Mail::Box::Maildir;\r
+@@ -41,9 +42,11 @@ sub search($$) {\r
+     $query = shell_quote($query);\r
+ \r
+     empty_maildir($maildir);\r
+-    system("notmuch search --output=files $query"\r
+-         . " | sed -e 's: :\\\\ :g'"\r
+-         . " | xargs --no-run-if-empty ln -s -t $maildir/cur/");\r
++    my @filelist = `notmuch search --output=files $query`;\r
++    foreach(@filelist) {\r
++        chomp;\r
++        symlink($_, "$maildir/cur/" . basename($_));\r
++    }\r
+ }\r
+ \r
+ sub prompt($$) {\r
+-- \r
+1.7.7.4\r
+\r