This patch fixes three issues with "notmuch-mutt tag":

1. The message-id was not shell quoted.
   Thanks to Jason Miller for the bug report and patch.

2. The tags passed into tag_action() were not being properly quoted.
   The "join before shell_quote" was combining multiple tags into a
   single argument to notmuch tag: '+one -two -three' instead of
   '+one' '-two' '-three'.  Note that shell_quote() will join array
   arguments with a space after quoting each, so a join afterwards was
   not needed.

3. A "--" was added between the tags and search-term as shown in the
   current notmuch-tag man page.
---
 contrib/notmuch-mutt/notmuch-mutt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt 
b/contrib/notmuch-mutt/notmuch-mutt
index c69b35c..e5d6848 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -114,8 +114,9 @@ sub tag_action(@) {
     defined $mid or die "notmuch-mutt: cannot find Message-Id, abort.\n";

     system("notmuch tag "
-          . shell_quote(join(' ', @_))
-          . " id:$mid");
+          . shell_quote(@_)
+          . " -- "
+          . shell_quote("id:$mid"));
 }

 sub die_usage() {
-- 
1.8.4.rc3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20130906/b38807b3/attachment.pgp>

Reply via email to