--- /dev/null
+Return-Path: <dmitry.kurochkin@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 96D32429E3C\r
+ for <notmuch@notmuchmail.org>; Wed, 25 May 2011 15:10:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, 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 XSrtvxLc5k3J for <notmuch@notmuchmail.org>;\r
+ Wed, 25 May 2011 15:10:17 -0700 (PDT)\r
+Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
+ [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id E3A89429E3B\r
+ for <notmuch@notmuchmail.org>; Wed, 25 May 2011 15:10:16 -0700 (PDT)\r
+Received: by mail-fx0-f53.google.com with SMTP id 8so217139fxm.26\r
+ for <notmuch@notmuchmail.org>; Wed, 25 May 2011 15:10:16 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer\r
+ :in-reply-to:references;\r
+ bh=N2n7BufUgTHwruq8jNqVC16Yb0QuARkoeCKQDRTFzs4=;\r
+ b=UB9rAihNyFdwaCGUzxC9mU2Qe5BRqdVi/Jh2VV29TM+pyWCj4ny4fZYBBY1OV+Iogg\r
+ A48B2IJHQNa5yM2iuIG5O1tfgkyfeEJL/Ra0v5f3oU7jXXawEiWnkX++CJ3TbafokVTF\r
+ N/GCDxfhsKfFx6SEh+nEjqbzuooIStSmZk5p8=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ b=Mvq60YAq0n3XjxJqCSehyoNquiv+AZWMi+y3O/ZK/QECA1/Dr/zrWQc1j1czs21E+f\r
+ a0aN+mMSP8d3/McGWuh9bRwuFgwzC94mZLzLzv7WkGjN1GWu3HywQD+z4ngNDsjihBZI\r
+ k7LDM7vagbCAJXwWqLAfv5471vTt9zPuZDL7Q=\r
+Received: by 10.223.56.24 with SMTP id w24mr93495fag.131.1306361416499;\r
+ Wed, 25 May 2011 15:10:16 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+ by mx.google.com with ESMTPS id q14sm31667faa.27.2011.05.25.15.10.15\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Wed, 25 May 2011 15:10:16 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/5] Fix hiding a message while some citations are shown in\r
+ notmuch-show view.\r
+Date: Thu, 26 May 2011 02:10:14 +0400\r
+Message-Id: <1306361416-5019-4-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.5.1\r
+In-Reply-To: <1306361416-5019-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1306361416-5019-1-git-send-email-dmitry.kurochkin@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: Wed, 25 May 2011 22:10:18 -0000\r
+\r
+Before the change, message and citation invisibility overlays\r
+conflicted: if some citation is made visible and then the whole\r
+message is hidden, that citation remained visible. This happened\r
+because the citation's overlay has an invisible property which\r
+takes priority over the message overlay. The message\r
+invisibility spec does not affect citation visibility, it is\r
+determined solely by the citation overlay invisibility spec.\r
+Hence, if citation is made visible, it is not hidden by message\r
+invisibility spec.\r
+\r
+The patch changes citation overlay invisibility property to be a\r
+list which contains both the citation and the message\r
+invisibility specs. This makes the citation invisible if either\r
+of them is added to the `buffer-invisibility-spec'. Note that\r
+all citation visibility states are "restored" when the message\r
+hidden and shown again.\r
+---\r
+ emacs/notmuch-wash.el | 12 +++++++-----\r
+ 1 files changed, 7 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
+index 7d87e85..bd521ba 100644\r
+--- a/emacs/notmuch-wash.el\r
++++ b/emacs/notmuch-wash.el\r
+@@ -107,7 +107,8 @@ collapse the remaining lines into a button.")\r
+ :supertype 'notmuch-wash-button-invisibility-toggle-type)\r
+ \r
+ (defun notmuch-wash-region-isearch-show (overlay)\r
+- (remove-from-invisibility-spec (overlay-get overlay 'invisible)))\r
++ (dolist (invis-spec (overlay-get overlay 'invisible))\r
++ (remove-from-invisibility-spec invis-spec)))\r
+ \r
+ (defun notmuch-wash-button-label (overlay)\r
+ (let* ((type (overlay-get overlay 'type))\r
+@@ -118,7 +119,7 @@ collapse the remaining lines into a button.")\r
+ (lines-count (count-lines (overlay-start overlay) (overlay-end overlay))))\r
+ (format label-format lines-count)))\r
+ \r
+-(defun notmuch-wash-region-to-button (beg end type prefix)\r
++(defun notmuch-wash-region-to-button (msg beg end type prefix)\r
+ "Auxilary function to do the actual making of overlays and buttons\r
+ \r
+ BEG and END are buffer locations. TYPE should a string, either\r
+@@ -131,11 +132,12 @@ insert before the button, probably for indentation."\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 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 'type type)\r
+ (goto-char (1+ end))\r
+@@ -166,7 +168,7 @@ insert before the button, probably for indentation."\r
+ (goto-char cite-end)\r
+ (forward-line (- notmuch-wash-citation-lines-suffix))\r
+ (notmuch-wash-region-to-button\r
+- hidden-start (point-marker)\r
++ msg hidden-start (point-marker)\r
+ "citation" "\n")))))\r
+ (if (and (not (eobp))\r
+ (re-search-forward notmuch-wash-signature-regexp nil t))\r
+@@ -180,7 +182,7 @@ insert before the button, probably for indentation."\r
+ (set-marker sig-end-marker (point-max))\r
+ (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 'message-cited-text)\r
+ (notmuch-wash-region-to-button\r
+- sig-start-marker sig-end-marker\r
++ msg sig-start-marker sig-end-marker\r
+ "signature" "\n"))))))\r
+ \r
+ ;;\r
+-- \r
+1.7.5.1\r
+\r