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 B9A7A41ED7F for ; Sat, 14 Jan 2012 16:36:24 -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 eQ2OJCKlPiWU for ; Sat, 14 Jan 2012 16:36:23 -0800 (PST) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id A7E4D41ED72 for ; Sat, 14 Jan 2012 16:36:23 -0800 (PST) X-AuditID: 12074422-b7fd66d0000008f9-8d-4f121f87de7d Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id 2A.C3.02297.78F121F4; Sat, 14 Jan 2012 19:36:23 -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 q0F0aNwJ001178; Sat, 14 Jan 2012 19:36:23 -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 q0F0aKLv028990 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 14 Jan 2012 19:36:21 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1RmE53-0002MA-Cg; Sat, 14 Jan 2012 19:36:17 -0500 Date: Sat, 14 Jan 2012 19:36:17 -0500 From: Austin Clements To: notmuch@notmuchmail.org, Pieter Praet Subject: The overloading of show (was Re: [PATCH] Output unmodified Content-Type header value for JSON format.) Message-ID: <20120115003617.GH1801@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgleLIzCtJLcpLzFFi42IRYrdT122XF/I3eL1ZyOLq1n52iz37vCyu 35zJbPH79Q1mBxaPu6e5PHbOusvu8WzVLWaPjn2XWQNYorhsUlJzMstSi/TtErgyTk/uZy64 r1xxYWMHWwPjCZkuRg4OCQETiasN1l2MnECmmMSFe+vZuhi5OIQE9jFKTGpoYYZwNjBKzLj9 H8o5ySTx+M1uJghnCaPE/ym72ED6WQRUJRauPc4OYrMJaEhs27+cEcQWEbCRuDZjGguIzSyQ J3G+YQkriC0sUCgxdcFzdpAzeAW0JRZeqgEJ8woISpyc+QSqXEvixr+XTCAlzALSEsv/cYCE RQVUJKac3MY2gVFgFpKOWUg6ZiF0LGBkXsUom5JbpZubmJlTnJqsW5ycmJeXWqRrqpebWaKX mlK6iREcyC5KOxh/HlQ6xCjAwajEw1uYI+AvxJpYVlyZe4hRkoNJSZT3g5yQvxBfUn5KZUZi cUZ8UWlOavEhRgkOZiUR3gWsQDnelMTKqtSifJiUNAeLkjivutY7PyGB9MSS1OzU1ILUIpis DAeHkgTvF5ChgkWp6akVaZk5JQhpJg5OkOE8QMPfgtTwFhck5hZnpkPkTzHqcpxce+UcoxBL Xn5eqpQ47yGQIgGQoozSPLg5sAT0ilEc6C1h3q0gVTzA5AU36RXQEiagJWUpfCBLShIRUlIN jFOORggwhsxznJ23rkzrp4Vw5JL5CsZaGlHeB3NzMqY3dz7uLL67sVFcTODuMR2RwrBdV1I/ 392xMnen3v/L9rN6J6srBbFtN9w4J7eluru1w+xJ2oeFh20+M1zYOjv56JsTgtJvs3VLDonJ S816JeV9+ODf2KcMByX+tjv4Fvw/Kv/F4NmL10osxRmJhlrMRcWJADB5/ZkbAwAA 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: Sun, 15 Jan 2012 00:36:24 -0000 (was in reply to id:87ehv2proa.fsf@praet.org, but I wanted to start a new top-level thread) Quoth Pieter Praet on Jan 14 at 10:19 am: > On Thu, 12 Jan 2012 12:28:40 -0500, Austin Clements wrote: > > Quoth Pieter Praet on Jan 12 at 6:07 pm: > > > On Tue, 22 Nov 2011 22:40:21 -0500, Austin Clements wrote: > > > > Quoth Jameson Graef Rollins on Nov 20 at 12:10 pm: > > > > > The open question seems to be how we handle the content encoding > > > > > parameters. My argument is that those should either be used by notmuch > > > > > to properly encode the content for the consumer. If that's not > > > > > possible, then just those parameters needed by the consumer to decode > > > > > the content should be output. > > > > > > > > If notmuch is going to include part content in the JSON output (which > > > > perhaps it shouldn't, as per recent IRC discussions), then it must > > > > handle content encodings because JSON must be Unicode and therefore > > > > the content strings in the JSON must be Unicode. > > > > > > Having missed the IRC discussions: what is the rationale for not > > > including (specific types of?) part content in the JSON output ? > > > Eg. how about inline attached text/x-patch ? > > > > Technically the IRC discussion was about not including *any* part > > content in the JSON output, and always using show --format=raw or > > similar to retrieve desired parts. Currently, notmuch includes part > > content in the JSON only for text/*, *except* when it's text/html. I > > assume non-text parts are omitted because binary data is hard to > > represent in JSON and text/html is omitted because some people don't > > need it. However, this leads to some peculiar asymmetry in the Emacs > > code where sometimes it pulls part content out of the JSON and > > sometimes it retrieves it using show --format=raw. This in turn leads > > to asymmetry in content encoding handling, since notmuch handles > > content encoding for parts included in the JSON (and there's no good > > way around that since JSON is Unicode), but not for parts retrieved as > > raw. > > > > The idea discussed on IRC was to remove all part content from the JSON > > output and to always use show to retrieve it, possibly beefing up > > show's support for content decoding (and possibly introducing a way to > > retrieve multiple raw parts at once to avoid re-parsing). This would > > get the JSON format out of the business of guessing what consumers > > need, simplify the Emacs code, and normalize content encoding > > handling. > > Full ACK. > > One concern though (IIUC): Due to the prevalence of retarded MUA's, not > outputting 'text/plain' and/or 'text/html' parts is unfortunately all > too often equivalent to not outputting anything at all, so wouldn't we, > in essence, be reducing `show --format=json' to an ever-so-slightly > augmented `search --format=json' ? I'm not sure I fully understand what you're saying, but there are several levels of structure here: 1. Threads (query results) 2. Thread structure 3. Message structure (MIME) 4. Part content Currently, search returns 1; show --format=json returns 2, 3, and sometimes 4 (but sometimes not); and show --format=raw returns 4. Notably, 1 does not require opening message files (neither does 2), which I consider an important distinction between search and show. Some of the discussion has been about putting 4 squarely in the realm of show --format=raw. One counterargument (which has grown on me since this discussion) is that the part content included in --format=json can be thought of as pre-fetching content that clients are likely to need in order to avoid re-parsing the message in most circumstances. I believe this is not the *intent* of the current code, though without a specification of the JSON format it's hard to tell. Other discussion (more interesting, in my mind) has been about separating retrieving thread structure, 2, from retrieving message structure, 3. To me, splitting these feels much more natural than what we do now, which seems to be inflexibly bound to the specific way the Emacs show mode currently works. The thread structure is readily available from the database, so I think separating these would open up some new UI opportunities, particularly easy and fast thread outlining and navigation. I believe it would also simplify the code and address some irritating asymmetries in the way notmuch show handles the --part argument.