--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 3C2E2431FCF\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 01:11:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 6eMmIpPch8JB for <notmuch@notmuchmail.org>;\r
+ Sat, 24 Aug 2013 01:11:24 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 92B7D431FBF\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 01:11:23 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1VD8wH-00052i-4G; Sat, 24 Aug 2013 09:11:17 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1VD8wG-00014e-KV; Sat, 24 Aug 2013 09:11:16 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, Jani Nikula <jani@nikula.org>,\r
+ John Lenz <lenz@math.uic.edu>, notmuch@notmuchmail.org\r
+Subject: Re: cli: add --include-html option to notmuch show\r
+In-Reply-To: <m2wqni7swv.fsf@guru.guru-group.fi>\r
+References: <notmuch-web-1372724382.450184839@www.wuzzeb.org>\r
+ <m27ggj1x29.fsf@guru.guru-group.fi>\r
+ <notmuch-web-1374719771.1588310986@www.wuzzeb.org>\r
+ <m2zjsxs0g1.fsf@guru.guru-group.fi>\r
+ <notmuch-web-1376754748.336647450@www.wuzzeb.org>\r
+ <87k3jjutpf.fsf@nikula.org> <m2wqni7swv.fsf@guru.guru-group.fi>\r
+User-Agent: Notmuch/0.15.2+192~g8222af3 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sat, 24 Aug 2013 09:11:15 +0100\r
+Message-ID: <87txifzexo.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 7bb4f6896cbb7a1b1549b7813d4b0f3e (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored 0.0 points. Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * 0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Sat, 24 Aug 2013 08:11:28 -0000\r
+\r
+\r
+Hi\r
+\r
+Overall I like this patch.\r
+\r
+On Sun, 18 Aug 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Sun, Aug 18 2013, Jani Nikula <jani@nikula.org> wrote:\r
+>\r
+>> On Sat, 17 Aug 2013, John Lenz <lenz@math.uic.edu> wrote:\r
+>>> On Sun Aug 4 14:47 -0500 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+>>>> The next question is should we have new option as\r
+>>>> \r
+>>>> --include-html\r
+>>>> \r
+>>>> or as\r
+>>>> \r
+>>>> --include-html=(true|false)\r
+>>>> \r
+>>>> or even\r
+>>>> \r
+>>>> --body=(true|false|text-and-html)\r
+>>>> \r
+>>>> See --exclude option in http://notmuchmail.org/manpages/notmuch-search-1/\r
+>>>> and --body option in http://notmuchmail.org/manpages/notmuch-show-1/\r
+>>>> for comparison...\r
+>>>> \r
+>>>\r
+>>> I have no preference here, although I guess I would vote for\r
+>>> --include-html=(true|false) since adding it to --body makes the --body\r
+>>> options confusing: to make sense the body options should be\r
+>>> --body=(text|text-and-html|none) but of course you can't change that and\r
+>>> break the command line API. Well, maybe you could add all three\r
+>>> --body=(text|text-and-html|none) and still accept true/false for\r
+>>> compatibility.\r
+>>\r
+>> Hi John & Tomi -\r
+>>\r
+>> We could trivially amend the argument parser to |= the keyword values\r
+>> (instead of =) to allow specifying keywords arguments multiple times on\r
+>> the command line. With the keyword values specified as bit flags, we\r
+>> could then have 'notmuch show --body=text --body=html ...' return both\r
+>> text and html, and allow trivial future extension too.\r
+>>\r
+>> --body=true and --body=false could be handled specially for backwards\r
+>> compatibility, for example by forcing text only or no parts,\r
+>> respectively. Since the default is currently text, --body=none might be\r
+>> a suitable synonym for --body=false, while the boolean alternatives\r
+>> could be deprecated.\r
+>>\r
+>> A little less trivially it's also possible to support e.g. comma\r
+>> separated keyword values, such as --body=text,html but I do prefer the\r
+>> (implementation) simplicity of the above.\r
+>\r
+> I've also thought along these lines (except this possibility to give \r
+> argument multiple times)...\r
+>\r
+> But when I wrote my first reply I did not realise that the default\r
+> behaviour is to include all text/* parts *except* text/html. i.e.\r
+> text/html is excluded as as special case (and non-excluded parts\r
+> contain text/plain, text/calendar, text/whatnot etc...). \r
+>\r
+> How to do clean interface/implementation using --body is not trivial\r
+> (if possible). I played with options like\r
+> false/none -- true/text/plain -- all/textall/* and came to a conclusion\r
+> that maybe --include-html is the best option after all.\r
+>\r
+> Now, if we have --include-html should it be like that or \r
+> --include-html=(true|false). Currently we have both cases, adding\r
+> --verify, --decrypt, --create-folder, --batch, -no-hooks to the\r
+> set... I cannot get a clear opinion (without wast^H^H^H^H spending\r
+> excessive amount of time figuring these out) how this should be,\r
+> therefore I'm inclined to the opinion that\r
+>\r
+> the current patch from John with simple --include-html could be applied,\r
+> and in the future (if it is of anyone's interest) we update the parser\r
+> allowing boolean --arg equal --arg=true. Then it is just how we decide\r
+> to document these...\r
+\r
+I agree with Tomi on all of these points.\r
+\r
+I think that with several patches floating around in this thread (the\r
+original, some test, Tomi's modified tests) it would be good to have a\r
+new candidate series submitted. I think it would get my +1.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+>\r
+> Tomi\r
+>\r
+>>\r
+>> Untested patch to the argument parser below.\r
+>>\r
+>> Cheers,\r
+>> Jani.\r
+>>\r
+>>\r
+>> diff --git a/command-line-arguments.c b/command-line-arguments.c\r
+>> index bf9aeca..c426054 100644\r
+>> --- a/command-line-arguments.c\r
+>> +++ b/command-line-arguments.c\r
+>> @@ -23,7 +23,10 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char\r
+>> while (keywords->name) {\r
+>> if (strcmp (arg_str, keywords->name) == 0) {\r
+>> if (arg_desc->output_var) {\r
+>> - *((int *)arg_desc->output_var) = keywords->value;\r
+>> + if (arg_desc->opt_type == NOTMUCH_OPT_KEYWORD_FLAGS)\r
+>> + *((int *)arg_desc->output_var) |= keywords->value;\r
+>> + else\r
+>> + *((int *)arg_desc->output_var) = keywords->value;\r
+>> }\r
+>> return TRUE;\r
+>> }\r
+>> @@ -146,6 +149,7 @@ parse_option (const char *arg,\r
+>> \r
+>> switch (try->opt_type) {\r
+>> case NOTMUCH_OPT_KEYWORD:\r
+>> + case NOTMUCH_OPT_KEYWORD_FLAGS:\r
+>> return _process_keyword_arg (try, next, value);\r
+>> break;\r
+>> case NOTMUCH_OPT_BOOLEAN:\r
+>> diff --git a/command-line-arguments.h b/command-line-arguments.h\r
+>> index de1734a..085a492 100644\r
+>> --- a/command-line-arguments.h\r
+>> +++ b/command-line-arguments.h\r
+>> @@ -8,6 +8,7 @@ enum notmuch_opt_type {\r
+>> NOTMUCH_OPT_BOOLEAN, /* --verbose */\r
+>> NOTMUCH_OPT_INT, /* --frob=8 */\r
+>> NOTMUCH_OPT_KEYWORD, /* --format=raw|json|text */\r
+>> + NOTMUCH_OPT_KEYWORD_FLAGS, /* the above with values OR'd together */\r
+>> NOTMUCH_OPT_STRING, /* --file=/tmp/gnarf.txt */\r
+>> NOTMUCH_OPT_POSITION /* notmuch dump pos_arg */\r
+>> };\r
+>>\r
+>>\r
+>>\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r