--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 52AAC431FBD\r
+ for <notmuch@notmuchmail.org>; Mon, 12 May 2014 15:16:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] 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 0INoLzRKDcVw for <notmuch@notmuchmail.org>;\r
+ Mon, 12 May 2014 15:16:32 -0700 (PDT)\r
+Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
+ [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 63049431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 12 May 2014 15:16:32 -0700 (PDT)\r
+Received: by mail-wi0-f175.google.com with SMTP id f8so5304879wiw.2\r
+ for <notmuch@notmuchmail.org>; Mon, 12 May 2014 15:16:31 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+ :mime-version:content-type;\r
+ bh=5nysejPNH/ejsl168bRP1peAljKUmhzPa4ucnb9p/K4=;\r
+ b=NT5rZAbz0w0Aj6XFYR486lQGFSnRw3mSQpdroddo2HUV5mLxkoXbmZa/CnA0Y7sGfX\r
+ mfIF709+XVsDlTxd5M3C+qR6Kh6PbITWQ8cYEC2je0c1rs8MnnFElGY13xDMn1tZLvS8\r
+ M7f8oZZHugiQ3FrbPLEK7JT/CiSJLdxfSP0FN+i5uOT5rpmyhfr0q9e+U4RuRnHDXvzO\r
+ zxbAiiNIkIJyBbs/NGdpdTfD9XqdUAk0zCZ4Abxg1xnXxDSlon8FhPjmabDZmm4qoUii\r
+ nWTozkrIVsuUmNSvVSjTmdvwILRJisRog7RhwjYxU9glz+SkN1ZZ5+UC9TVS70vEq3Gp\r
+ WweA==\r
+X-Received: by 10.180.107.97 with SMTP id hb1mr17841660wib.20.1399932991337;\r
+ Mon, 12 May 2014 15:16:31 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by mx.google.com with ESMTPSA id ek4sm18392049wib.9.2014.05.12.15.16.30\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Mon, 12 May 2014 15:16:30 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3 3/9] emacs/show: Accommodate the lack of part header\r
+ buttons\r
+In-Reply-To: <1399897769-26809-4-git-send-email-dme@dme.org>\r
+References: <87sixdujkv.fsf@qmul.ac.uk>\r
+ <1399897769-26809-1-git-send-email-dme@dme.org>\r
+ <1399897769-26809-4-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 12 May 2014 23:16:28 +0100\r
+Message-ID: <87mwemk5hf.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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, 12 May 2014 22:16:38 -0000\r
+\r
+\r
+On Mon, 12 May 2014, David Edmondson <dme@dme.org> wrote:\r
+> Various pieces of code assumed (reasonably) that part header buttons\r
+> are present. Modify them to avoid problems if no part headers were\r
+> inserted.\r
+\r
+Despite your reservations on irc this looks fine to me.\r
+\r
+MW\r
+\r
+> ---\r
+> emacs/notmuch-show.el | 88 ++++++++++++++++++++++++++++-----------------------\r
+> 1 file changed, 48 insertions(+), 40 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index f78a0ab..e511655 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -494,36 +494,37 @@ message at DEPTH in the current thread."\r
+> \r
+> (defun notmuch-show-toggle-part-invisibility (&optional button)\r
+> (interactive)\r
+> - (let* ((button (or button (button-at (point))))\r
+> - (overlay (button-get button 'overlay))\r
+> - (lazy-part (button-get button :notmuch-lazy-part)))\r
+> - ;; We have a part to toggle if there is an overlay or if there is a lazy part.\r
+> - ;; If neither is present we cannot toggle the part so we just return nil.\r
+> - (when (or overlay lazy-part)\r
+> - (let* ((show (button-get button :notmuch-part-hidden))\r
+> - (new-start (button-start button))\r
+> - (button-label (button-get button :base-label))\r
+> - (old-point (point))\r
+> - (properties (text-properties-at (button-start button)))\r
+> - (inhibit-read-only t))\r
+> - ;; Toggle the button itself.\r
+> - (button-put button :notmuch-part-hidden (not show))\r
+> - (goto-char new-start)\r
+> - (insert "[ " button-label (if show " ]" " (hidden) ]"))\r
+> - (set-text-properties new-start (point) properties)\r
+> - (let ((old-end (button-end button)))\r
+> - (move-overlay button new-start (point))\r
+> - (delete-region (point) old-end))\r
+> - (goto-char (min old-point (1- (button-end button))))\r
+> - ;; Return nil if there is a lazy-part, it is empty, and we are\r
+> - ;; trying to show it. In all other cases return t.\r
+> - (if lazy-part\r
+> - (when show\r
+> - (button-put button :notmuch-lazy-part nil)\r
+> - (notmuch-show-lazy-part lazy-part button))\r
+> - ;; else there must be an overlay.\r
+> - (overlay-put overlay 'invisible (not show))\r
+> - t)))))\r
+> + (let ((button (or button (button-at (point)))))\r
+> + (when button\r
+> + (let ((overlay (button-get button 'overlay))\r
+> + (lazy-part (button-get button :notmuch-lazy-part)))\r
+> + ;; We have a part to toggle if there is an overlay or if there is a lazy part.\r
+> + ;; If neither is present we cannot toggle the part so we just return nil.\r
+> + (when (or overlay lazy-part)\r
+> + (let* ((show (button-get button :notmuch-part-hidden))\r
+> + (new-start (button-start button))\r
+> + (button-label (button-get button :base-label))\r
+> + (old-point (point))\r
+> + (properties (text-properties-at (button-start button)))\r
+> + (inhibit-read-only t))\r
+> + ;; Toggle the button itself.\r
+> + (button-put button :notmuch-part-hidden (not show))\r
+> + (goto-char new-start)\r
+> + (insert "[ " button-label (if show " ]" " (hidden) ]"))\r
+> + (set-text-properties new-start (point) properties)\r
+> + (let ((old-end (button-end button)))\r
+> + (move-overlay button new-start (point))\r
+> + (delete-region (point) old-end))\r
+> + (goto-char (min old-point (1- (button-end button))))\r
+> + ;; Return nil if there is a lazy-part, it is empty, and we are\r
+> + ;; trying to show it. In all other cases return t.\r
+> + (if lazy-part\r
+> + (when show\r
+> + (button-put button :notmuch-lazy-part nil)\r
+> + (notmuch-show-lazy-part lazy-part button))\r
+> + ;; else there must be an overlay.\r
+> + (overlay-put overlay 'invisible (not show))\r
+> + t)))))))\r
+> \r
+> ;; MIME part renderers\r
+> \r
+> @@ -632,14 +633,17 @@ message at DEPTH in the current thread."\r
+> t)\r
+> \r
+> (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)\r
+> - (button-put button 'face 'notmuch-crypto-part-header)\r
+> - ;; add signature status button if sigstatus provided\r
+> + (when button\r
+> + (button-put button 'face 'notmuch-crypto-part-header))\r
+> + ;; Add signature status button if sigstatus provided.\r
+> (if (plist-member part :sigstatus)\r
+> (let* ((from (notmuch-show-get-header :From msg))\r
+> (sigstatus (car (plist-get part :sigstatus))))\r
+> (notmuch-crypto-insert-sigstatus-button sigstatus from))\r
+> - ;; if we're not adding sigstatus, tell the user how they can get it\r
+> - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))\r
+> + ;; If we're not adding the signature status, tell the user how\r
+> + ;; they can get it.\r
+> + (when button\r
+> + (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))\r
+> \r
+> (let ((inner-parts (plist-get part :content))\r
+> (start (point)))\r
+> @@ -653,17 +657,20 @@ message at DEPTH in the current thread."\r
+> t)\r
+> \r
+> (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)\r
+> - (button-put button 'face 'notmuch-crypto-part-header)\r
+> - ;; add encryption status button if encstatus specified\r
+> + (when button\r
+> + (button-put button 'face 'notmuch-crypto-part-header))\r
+> + ;; Add encryption status button if encryption status is specified.\r
+> (if (plist-member part :encstatus)\r
+> (let ((encstatus (car (plist-get part :encstatus))))\r
+> (notmuch-crypto-insert-encstatus-button encstatus)\r
+> - ;; add signature status button if sigstatus specified\r
+> + ;; Add signature status button if signature status is\r
+> + ;; specified.\r
+> (if (plist-member part :sigstatus)\r
+> (let* ((from (notmuch-show-get-header :From msg))\r
+> (sigstatus (car (plist-get part :sigstatus))))\r
+> (notmuch-crypto-insert-sigstatus-button sigstatus from))))\r
+> - ;; if we're not adding encstatus, tell the user how they can get it\r
+> + ;; If we're not adding the encryption status, tell the user how\r
+> + ;; they can get it.\r
+> (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))\r
+> \r
+> (let ((inner-parts (plist-get part :content))\r
+> @@ -930,8 +937,9 @@ useful for quoting in replies)."\r
+> \r
+> (if show-part\r
+> (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)\r
+> - (button-put button :notmuch-lazy-part\r
+> - (list msg part mime-type nth depth button)))\r
+> + (when button\r
+> + (button-put button :notmuch-lazy-part\r
+> + (list msg part mime-type nth depth button))))\r
+> \r
+> ;; Some of the body part handlers leave point somewhere up in the\r
+> ;; part, so we make sure that we're down at the end.\r
+> -- \r
+> 2.0.0.rc0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r