--- /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 78D84431FC0\r
+ for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 01:12:21 -0800 (PST)\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 WCWnAxJtweKq for <notmuch@notmuchmail.org>;\r
+ Thu, 13 Dec 2012 01:12:19 -0800 (PST)\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 6EB9D431FBF\r
+ for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 01:12:18 -0800 (PST)\r
+Received: by mail-wi0-f175.google.com with SMTP id hm11so3659139wib.2\r
+ for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 01:12:18 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=fSXf2rQa75Y/qkN5cbCbNmJK4KxyfcUqpDBnIe2C9+g=;\r
+ b=xdJLoPKpVc+591+bWl1Mwmil1Y3Yzp2a8rd/st4UV0o9aqYPfkTzA0fuvMXYQaMXTD\r
+ oX9yTLoqEYPB98A7b9AI2syh9mV5dwj3cvWCTYqNC3KigJvm2QBmlPkECSrYZ98zn78X\r
+ Qx48lbaKHzVVNmDTqWMv/MA1gVMB7UFmoqFKSqI7ecolQwv3tktLb41sFl2O4JnQlkFS\r
+ U9p/GtJcmdmTCSCEb8jJj6JxBsZVo/Ci4fXFL8gnVCnNpOXqVQyjVNJZPai9RYs6GpDG\r
+ rWBKvPLx7jLI/UBgyze1S1F5JHletEFqXMHOPqdTG7kk16Nt2gECP9opM5q8sY06Ax4S\r
+ okKQ==\r
+Received: by 10.194.81.73 with SMTP id y9mr5787507wjx.31.1355389938127;\r
+ Thu, 13 Dec 2012 01:12:18 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPS id gz3sm6847384wib.2.2012.12.13.01.12.16\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Thu, 13 Dec 2012 01:12:17 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 3/5] emacs: show: add invisibility button action\r
+Date: Thu, 13 Dec 2012 09:12:02 +0000\r
+Message-Id: <1355389924-3718-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1355389924-3718-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1355389924-3718-1-git-send-email-markwalters1009@gmail.com>\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: Thu, 13 Dec 2012 09:12:22 -0000\r
+\r
+This adds a button action to show hidden parts. In this version "t"\r
+toggles the visibility of a part. In addition "RET" on a non-shown\r
+part shows it.\r
+\r
+The button is used to hide parts when appropriate (eg text/html in\r
+multipart/alternative).\r
+---\r
+ emacs/notmuch-show.el | 36 ++++++++++++++++++++++++++++++++++--\r
+ 1 files changed, 34 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 3f2f277..202258f 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -478,6 +478,7 @@ message at DEPTH in the current thread."\r
+ (define-key map "v" 'notmuch-show-part-button-view)\r
+ (define-key map "o" 'notmuch-show-part-button-interactively-view)\r
+ (define-key map "|" 'notmuch-show-part-button-pipe)\r
++ (define-key map "t" 'notmuch-show-toggle-invisible-part-action)\r
+ map)\r
+ "Submap for button commands")\r
+ (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)\r
+@@ -554,6 +555,28 @@ message at DEPTH in the current thread."\r
+ (let ((handle (mm-make-handle (current-buffer) (list content-type))))\r
+ (mm-pipe-part handle))))\r
+ \r
++;; This is taken from notmuch-wash: maybe it should be unified?\r
++(defun notmuch-show-toggle-invisible-part-action (&optional button)\r
++ (interactive)\r
++ (let* ((button (or button (button-at (point))))\r
++ (overlay (button-get button 'overlay))\r
++ (invis-spec (button-get button 'invisibility-spec))\r
++ (show (invisible-p invis-spec)))\r
++ (when overlay\r
++ (if show\r
++ (remove-from-invisibility-spec invis-spec)\r
++ (add-to-invisibility-spec invis-spec))\r
++ (let* ((new-start (button-start button))\r
++ (button-label (button-get button :base-label))\r
++ (old-point (point))\r
++ (inhibit-read-only t))\r
++ (goto-char new-start)\r
++ (insert "[ " button-label (if show " ]" " (hidden) ]"))\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
++\r
+ (defun notmuch-show-multipart/*-to-list (part)\r
+ (mapcar (lambda (inner-part) (plist-get inner-part :content-type))\r
+ (plist-get part :content)))\r
+@@ -863,7 +886,13 @@ message at DEPTH in the current thread."\r
+ (cons invis-spec (overlay-get inner 'invisible)))))\r
+ \r
+ (button-put button 'invisibility-spec invis-spec)\r
+- (button-put button 'overlay overlay)))))\r
++ (button-put button 'overlay overlay))\r
++\r
++ ;; We toggle the button for hidden parts as that gets the\r
++ ;; button label right.\r
++ (save-excursion\r
++ (when hide\r
++ (notmuch-show-toggle-invisible-part-action button))))))\r
+ \r
+ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
+ "Insert the body part PART at depth DEPTH in the current thread.\r
+@@ -1992,7 +2021,10 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
+ \r
+ (defun notmuch-show-part-button-default (&optional button)\r
+ (interactive)\r
+- (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))\r
++ (let ((button (or button (button-at (point)))))\r
++ (if (button-get button 'invisibility-spec)\r
++ (notmuch-show-toggle-invisible-part-action button)\r
++ (notmuch-show-part-button-internal button notmuch-show-part-button-default-action))))\r
+ \r
+ (defun notmuch-show-part-button-save (&optional button)\r
+ (interactive)\r
+-- \r
+1.7.9.1\r
+\r