Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id EE1A9431FAF for ; Sat, 4 Feb 2012 13:20:22 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4ZpwR2zsWCsI for ; Sat, 4 Feb 2012 13:20:22 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id 0C168431FAE for ; Sat, 4 Feb 2012 13:20:21 -0800 (PST) X-AuditID: 1209190d-b7fbf6d0000008ba-52-4f2da11591e1 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 7A.FC.02234.511AD2F4; Sat, 4 Feb 2012 16:20:21 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q14LKKod013317; Sat, 4 Feb 2012 16:20:20 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q14LKFDY004469 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 4 Feb 2012 16:20:16 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Rtn0n-0003T7-Bd; Sat, 04 Feb 2012 16:19:09 -0500 Date: Sat, 4 Feb 2012 16:19:09 -0500 From: Austin Clements To: Dmitry Kurochkin Subject: Re: [PATCH 1/2] show: Convert text format to the new self-recursive style Message-ID: <20120204211909.GN10898@mit.edu> References: <1327560926-22401-1-git-send-email-amdragon@mit.edu> <1327560926-22401-2-git-send-email-amdragon@mit.edu> <87obtkojpd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87obtkojpd.fsf@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPKsWRmVeSWpSXmKPExsUixG6nriu6UNff4MlaWYurW/vZLZqmO1vs 2edlcf3mTGaLNyvnsTqwetw9zeWxc9Zddo/DXxeyeNy6/5rd49mqW8wBrFFcNimpOZllqUX6 dglcGWd3TmMq+C5asXFWB1sD40uBLkZODgkBE4lfR3rYIGwxiQv31gPZXBxCAvsYJW79aWUH SQgJrGeUOPbfCSJxgkni0dF2ZghnCVDV1jmsIFUsAioSV16uBhvFJqAhsW3/ckYQW0TAUOLW xVfMIDazQKrE/w1NTCC2sECIxM3l28FqeAV0JKYuvwM1dAqjRN+hb1AJQYmTM5+wQDRrSdz4 9xKomQPIlpZY/o8DJMwpoC4xu28nWLko0A1TTm5jm8AoNAtJ9ywk3bMQuhcwMq9ilE3JrdLN TczMKU5N1i1OTszLSy3SNdLLzSzRS00p3cQIigdOSd4djO8OKh1iFOBgVOLh3aCn4y/EmlhW XJl7iFGSg0lJlNdwga6/EF9SfkplRmJxRnxRaU5q8SFGCQ5mJRFeRzegHG9KYmVValE+TEqa g0VJnFdV652fkEB6YklqdmpqQWoRTFaGg0NJgtcPZKhgUWp6akVaZk4JQpqJgxNkOA/Q8GCQ Gt7igsTc4sx0iPwpRkUpcV49kIQASCKjNA+uF5auXjGKA70izKsNUsUDTHVw3a+ABjMBDd7H Bja4JBEhJdXA2CfiGXXgaXnAN9k9j3hPdxsyr+pl2mi+U3L51sCFl/Kr765cq6jfWn1MXOm3 96w/ec1/DAWNWDakBqhM0pA7vjvMvnatfr/RrjDHRPVJ/xM2yRQz2uy7uezq6tkx3crbb0c9 KX0/Ya/ay1azkPKwaOELi0UN7sSe0CyaJelUxcipsiwsxvqoEktxRqKhFnNRcSIAreWY6zID AAA= Cc: tomi.ollila@iki.fi, notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2012 21:20:23 -0000 Quoth Dmitry Kurochkin on Jan 31 at 3:26 am: > On Thu, 26 Jan 2012 01:55:25 -0500, Austin Clements wrote: > > This is all code movement and a smidgen of glue. This moves the > > existing text formatter code into one self-recursive function, but > > doesn't change any of the logic. The next patch will actually take > > advantage of what the new structure has to offer. > > > > Note that this patch retains format_headers_message_part_text because > > it is also used by the raw format. > > --- > > notmuch-show.c | 270 +++++++++++++++++++++++++++++--------------------------- > > 1 files changed, 139 insertions(+), 131 deletions(-) > > > > diff --git a/notmuch-show.c b/notmuch-show.c > > index dec799c..6a890b2 100644 > > --- a/notmuch-show.c > > +++ b/notmuch-show.c > > @@ -21,40 +21,17 @@ > > #include "notmuch-client.h" > > > > static void > > -format_message_text (unused (const void *ctx), > > - notmuch_message_t *message, > > - int indent); > > -static void > > -format_headers_text (const void *ctx, > > - notmuch_message_t *message); > > - > > -static void > > format_headers_message_part_text (GMimeMessage *message); > > > > static void > > -format_part_start_text (GMimeObject *part, > > - int *part_count); > > - > > -static void > > -format_part_content_text (GMimeObject *part); > > - > > -static void > > -format_part_end_text (GMimeObject *part); > > +format_part_text (const void *ctx, mime_node_t *node, > > + int indent, const notmuch_show_params_t *params); > > > > static const notmuch_show_format_t format_text = { > > - "", NULL, > > - "\fmessage{ ", format_message_text, > > - "\fheader{\n", format_headers_text, format_headers_message_part_text, "\fheader}\n", > > - "\fbody{\n", > > - format_part_start_text, > > - NULL, > > - NULL, > > - format_part_content_text, > > - format_part_end_text, > > - "", > > - "\fbody}\n", > > - "\fmessage}\n", "", > > - "" > > + .message_set_start = "", > > + .part = format_part_text, > > + .message_set_sep = "", > > + .message_set_end = "" > > I guess I missed this during the first review. I think we should > support NULL values for message_set_* members (in a separate patch, I > guess). This would allow us to explicitly initialize only part member > in the above code. I wouldn't want to support this without supporting it for all of the string members of notmuch_show_format_t, which turns out to be a fairly big change. At the end of the show rewrite, all of these other string members will go away, so I'll add support for just these being NULL at that point. > Looks good otherwise. > > Regards, > Dmitry