--- /dev/null
+Return-Path: <dme@dme.org>\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 14772429E36\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:45:36 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 eypciul20usm for <notmuch@notmuchmail.org>;\r
+ Wed, 25 Jan 2012 07:45:35 -0800 (PST)\r
+Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
+ [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 9AA8F431FBC for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:45:34 -0800\r
+ (PST)\r
+Received: by wgbdt12 with SMTP id dt12so4941148wgb.2\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:45:33 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.216.139.223 with SMTP id c73mr3144582wej.1.1327506333461;\r
+ Wed, 25 Jan 2012 07:45:33 -0800 (PST)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+ (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
+ by mx.google.com with ESMTPS id n5sm2655383wiw.7.2012.01.25.07.45.31\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Wed, 25 Jan 2012 07:45:31 -0800 (PST)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+ id E04099FFA4; Wed, 25 Jan 2012 15:45:29 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/4 v2] emacs: Take more care when hiding regions with\r
+ buttons.\r
+Date: Wed, 25 Jan 2012 15:45:28 +0000\r
+Message-Id: <1327506328-22126-5-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.8.3\r
+In-Reply-To: <1327506328-22126-1-git-send-email-dme@dme.org>\r
+References: <1327503908-17226-1-git-send-email-dme@dme.org>\r
+ <1327506328-22126-1-git-send-email-dme@dme.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlmEyQKdVun6QAZeiQoZ6BzMHsXrixeS/0IQgdll+Ja0bYQfmBR6lRlv/rdmq+NcOVPo6Z3\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: Wed, 25 Jan 2012 15:45:36 -0000\r
+\r
+If the region to be hidden with a button by\r
+`notmuch-wash-region-to-button' starts at the beginning of the buffer,\r
+the invisible region will include the inserted button. This is\r
+unfortunate, as it means that it is not possible to see the button to\r
+be pressed.\r
+\r
+Make a little space at the start of the buffer before inserting the\r
+button to avoid this, not forgetting to remove the inserted space upon\r
+completion.\r
+\r
+Mark the relevant test as no longer broken.\r
+---\r
+ emacs/notmuch-wash.el | 57 ++++++++++++++++++++++-----------\r
+ test/emacs-original-message-hiding.sh | 1 -\r
+ 2 files changed, 38 insertions(+), 20 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
+index 5c1e830..4afd3b3 100644\r
+--- a/emacs/notmuch-wash.el\r
++++ b/emacs/notmuch-wash.el\r
+@@ -147,25 +147,44 @@ insert before the button, probably for indentation."\r
+ ;; symbols because of the way the button code works. Note that\r
+ ;; replacing intern-soft with make-symbol will cause this to fail,\r
+ ;; since the newly created symbol has no plist.\r
+-\r
+- (let ((overlay (make-overlay beg end))\r
+- (message-invis-spec (plist-get msg :message-invis-spec))\r
+- (invis-spec (make-symbol (concat "notmuch-" type "-region")))\r
+- (button-type (intern-soft (concat "notmuch-wash-button-"\r
+- type "-toggle-type"))))\r
+- (add-to-invisibility-spec invis-spec)\r
+- (overlay-put overlay 'invisible (list invis-spec message-invis-spec))\r
+- (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)\r
+- (overlay-put overlay 'priority 10)\r
+- (overlay-put overlay 'type type)\r
+- (goto-char (1+ end))\r
+- (save-excursion\r
+- (goto-char (1- beg))\r
+- (insert prefix)\r
+- (insert-button (notmuch-wash-button-label overlay)\r
+- 'invisibility-spec invis-spec\r
+- 'overlay overlay\r
+- :type button-type))))\r
++ (save-excursion\r
++ ;; If the beginning of the region to be converted to a button is the\r
++ ;; beginning of the buffer we must move forward a little to avoid\r
++ ;; creating an overlay that will hide the button intended to be used\r
++ ;; to reveal the hidden region.\r
++ (let (scene-of-crime)\r
++ (when (eq beg (point-min))\r
++ (goto-char (point-min))\r
++ (insert "\n")\r
++ (setq scene-of-crime (point-min)\r
++ beg (point)))\r
++\r
++ ;; This uses some slightly tricky conversions between strings and\r
++ ;; symbols because of the way the button code works. Note that\r
++ ;; replacing intern-soft with make-symbol will cause this to fail,\r
++ ;; since the newly created symbol has no plist.\r
++\r
++ (let ((overlay (make-overlay beg end))\r
++ (message-invis-spec (plist-get msg :message-invis-spec))\r
++ (invis-spec (make-symbol (concat "notmuch-" type "-region")))\r
++ (button-type (intern-soft (concat "notmuch-wash-button-"\r
++ type "-toggle-type"))))\r
++ (add-to-invisibility-spec invis-spec)\r
++ (overlay-put overlay 'invisible (list invis-spec message-invis-spec))\r
++ (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)\r
++ (overlay-put overlay 'priority 10)\r
++ (overlay-put overlay 'type type)\r
++\r
++ (goto-char (1- beg))\r
++ (insert prefix)\r
++ (insert-button (notmuch-wash-button-label overlay)\r
++ 'invisibility-spec invis-spec\r
++ 'overlay overlay\r
++ :type button-type))\r
++\r
++ (when scene-of-crime\r
++ (goto-char scene-of-crime)\r
++ (delete-char 1)))))\r
+ \r
+ (defun notmuch-wash-excerpt-citations (msg depth)\r
+ "Excerpt citations and up to one signature."\r
+diff --git a/test/emacs-original-message-hiding.sh b/test/emacs-original-message-hiding.sh\r
+index 01cf98d..038ef4f 100755\r
+--- a/test/emacs-original-message-hiding.sh\r
++++ b/test/emacs-original-message-hiding.sh\r
+@@ -13,7 +13,6 @@ add_message \\r
+ '[body]="-----Original Message-----\r
+ Text here.\r
+ "'\r
+-test_subtest_known_broken\r
+ test_emacs_expect_t \\r
+ '(load "emacs-original-message-hiding.el") (notmuch-test-original-message-hiding)'\r
+ \r
+-- \r
+1.7.8.3\r
+\r