--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 F34B9431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Jun 2013 08:22:57 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 9swfv9fY-feB for <notmuch@notmuchmail.org>;\r
+ Mon, 10 Jun 2013 08:22:50 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 61EB5431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Jun 2013 08:22:50 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id E58F7100044;\r
+ Mon, 10 Jun 2013 18:22:45 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org,\r
+ Austin Clements <aclements@csail.mit.edu>\r
+Subject: Re: [PATCH v5 0/6] emacs: show: lazy handling of hidden parts\r
+In-Reply-To: <1370840233-23258-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1370840233-23258-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.15.2+181~gfb53171 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 10 Jun 2013 18:22:45 +0300\r
+Message-ID: <m2fvwq6ldm.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Mon, 10 Jun 2013 15:22:58 -0000\r
+\r
+On Mon, Jun 10 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+\r
+> This is version 5 of this patch set. Version 4 is at\r
+> id:1370074547-24677-1-git-send-email-markwalters1009@gmail.com.\r
+>\r
+> This version fixes the two bugs pointed out in Austin's review\r
+> id:20130610023952.GC22196@mit.edu.\r
+>\r
+> I decided to add the :notmuch-part text property separately from\r
+> create-overlays as they have slightly different regions (one includes\r
+> the button one does not) and are applied at slightly different times\r
+> (we do not create overlays for lazy parts).\r
+>\r
+> I was not sure whether we created two overlays for hidden lazy parts\r
+> in v4 (it might not have done as the part was empty and we do not\r
+> create overlays for empty parts) but that is stupidly fragile. Thus we\r
+> explicitly do not create overlays for lazy parts until they are\r
+> inserted.\r
+>\r
+> The diff from v4 is below.\r
+\r
+As far as I understood the code looked good. I also checked lazy\r
+rendering by using w3m-standalone as mm-text-html-renderer and by\r
+writing a wrapper w3m which appended command line to a file before\r
+running w3m and then `tail -f`d the file...\r
+\r
+... and w3m was run at the time [text/html (hidden)] was pressed.\r
+\r
+So, +1\r
+\r
+> Best wishes\r
+>\r
+> Mark\r
+\r
+Tomi\r
+\r
+PS: anyone interested the command lines were:\r
+\r
+-dump -T text/html -I UTF-8 -O UTF-8\r
+-dump -T text/html -I UTF-8 -O UTF-8\r
+-dump -T text/html -I iso-8859-1 -O iso-8859-1\r
+\r
+(based on original encoding, emacs then did conversions when needed)\r
+\r
+> Mark Walters (6):\r
+> emacs: show: fake wash parts are handled at insert-bodypart level\r
+> emacs: show: move the insertion of the header button to the top level\r
+> emacs: show: pass button to create-overlays\r
+> emacs: show: modify the way hidden state is recorded.\r
+> emacs: show move addition of :notmuch-part to separate function\r
+> emacs: show: implement lazy hidden part handling\r
+>\r
+> emacs/notmuch-show.el | 241 ++++++++++++++++++++++++++++++-------------------\r
+> 1 files changed, 146 insertions(+), 95 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index b963859..d030ea3 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -817,6 +817,27 @@ message at DEPTH in the current thread."\r
+> ;; Return true if we created an overlay.\r
+> t))\r
+> \r
+> +(defun notmuch-show-record-part-information (part beg end)\r
+> + "Store PART as a text property from BEG to END"\r
+> +\r
+> + ;; Record part information. Since we already inserted subparts,\r
+> + ;; don't override existing :notmuch-part properties.\r
+> + (notmuch-map-text-property beg end :notmuch-part\r
+> + (lambda (v) (or v part)))\r
+> + ;; Make :notmuch-part front sticky and rear non-sticky so it stays\r
+> + ;; applied to the beginning of each line when we indent the\r
+> + ;; message. Since we're operating on arbitrary renderer output,\r
+> + ;; watch out for sticky specs of t, which means all properties are\r
+> + ;; front-sticky/rear-nonsticky.\r
+> + (notmuch-map-text-property beg end 'front-sticky\r
+> + (lambda (v) (if (listp v)\r
+> + (pushnew :notmuch-part v)\r
+> + v)))\r
+> + (notmuch-map-text-property beg end 'rear-nonsticky\r
+> + (lambda (v) (if (listp v)\r
+> + (pushnew :notmuch-part v)\r
+> + v))))\r
+> +\r
+> (defun notmuch-show-lazy-part (part-args button)\r
+> ;; Insert the lazy part after the button for the part. We would just\r
+> ;; move to the start of the new line following the button and insert\r
+> @@ -843,6 +864,9 @@ message at DEPTH in the current thread."\r
+> (indent-rigidly part-beg part-end depth))\r
+> (goto-char part-end)\r
+> (delete-char 1)\r
+> + (notmuch-show-record-part-information (second part-args)\r
+> + (button-start button)\r
+> + part-end)\r
+> ;; Create the overlay. If the lazy-part turned out to be empty/not\r
+> ;; showable this returns nil.\r
+> (notmuch-show-create-part-overlays button part-beg part-end))))\r
+> @@ -876,27 +900,13 @@ If HIDE is non-nil then initially hide this part."\r
+> ;; Ensure that the part ends with a carriage return.\r
+> (unless (bolp)\r
+> (insert "\n"))\r
+> - (notmuch-show-create-part-overlays button content-beg (point))\r
+> - (when hide\r
+> + ;; We do not create the overlay for hidden (lazy) parts until\r
+> + ;; they are inserted.\r
+> + (if (not hide)\r
+> + (notmuch-show-create-part-overlays button content-beg (point))\r
+> (save-excursion\r
+> (notmuch-show-toggle-part-invisibility button)))\r
+> - ;; Record part information. Since we already inserted subparts,\r
+> - ;; don't override existing :notmuch-part properties.\r
+> - (notmuch-map-text-property beg (point) :notmuch-part\r
+> - (lambda (v) (or v part)))\r
+> - ;; Make :notmuch-part front sticky and rear non-sticky so it stays\r
+> - ;; applied to the beginning of each line when we indent the\r
+> - ;; message. Since we're operating on arbitrary renderer output,\r
+> - ;; watch out for sticky specs of t, which means all properties are\r
+> - ;; front-sticky/rear-nonsticky.\r
+> - (notmuch-map-text-property beg (point) 'front-sticky\r
+> - (lambda (v) (if (listp v)\r
+> - (pushnew :notmuch-part v)\r
+> - v)))\r
+> - (notmuch-map-text-property beg (point) 'rear-nonsticky\r
+> - (lambda (v) (if (listp v)\r
+> - (pushnew :notmuch-part v)\r
+> - v)))))\r
+> + (notmuch-show-record-part-information part beg (point))))\r
+> \r
+> (defun notmuch-show-insert-body (msg body depth)\r
+> "Insert the body BODY at depth DEPTH in the current thread."\r
+>\r
+>\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r