[PATCH 5/5] Simplify message and headers visibility code in notmuch-show view.
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 25 May 2011 22:10:16 +0000 (02:10 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:21 +0000 (09:38 -0800)
fa/f402db35e8b3757aff2e6a1bcf5b7e3fa43393 [new file with mode: 0644]

diff --git a/fa/f402db35e8b3757aff2e6a1bcf5b7e3fa43393 b/fa/f402db35e8b3757aff2e6a1bcf5b7e3fa43393
new file mode 100644 (file)
index 0000000..1691369
--- /dev/null
@@ -0,0 +1,120 @@
+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 9EE65429E3D\r
+       for <notmuch@notmuchmail.org>; Wed, 25 May 2011 15:10:30 -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 h8Iumt2vjYr7 for <notmuch@notmuchmail.org>;\r
+       Wed, 25 May 2011 15:10:29 -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 137B4429E44\r
+       for <notmuch@notmuchmail.org>; Wed, 25 May 2011 15:10:24 -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:24 -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=7PGK3epIXMCCuCcfGgt9UJZt88pE4ZDA1Fb6TWufGFc=;\r
+       b=B1AUaDAQsEp+pFw6r+d9IICIFnyBdxwNccwRE+NuZMqkIe1rl96nL9juVbfGoiSxe/\r
+       Hf9hGTlrdKpiJwU8bskUcUg2/+3uZfMJXhrp3758R5VMDDAr+biYDP7FwNaJ6xoQpOAP\r
+       XtLnx+WEiCZZIuAZolSvq/H57Jv3xQx6Pto5k=\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=UXNf/7Jf0NOldeqzYEN7guJlI4E2vmsglajVrgGc/ZXJvYlcqO+m9VmNTtac/suBkr\r
+       lmTuzNxwVcX+2PQr0uRalJV0GopblRUA9vrxgXV6wT7pxOLBiicKQ2Zw14TRX9GfCene\r
+       ms8wY9p4BWFa3v5H/ovFHohbvam/dYiLqPhE4=\r
+Received: by 10.223.57.5 with SMTP id a5mr106251fah.90.1306361424751;\r
+       Wed, 25 May 2011 15:10:24 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id b25sm31705fab.4.2011.05.25.15.10.23\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 25 May 2011 15:10:24 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 5/5] Simplify message and headers visibility code in\r
+       notmuch-show view.\r
+Date: Thu, 26 May 2011 02:10:16 +0400\r
+Message-Id: <1306361416-5019-6-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:30 -0000\r
+\r
+Before the change, headers and message visibility functions took\r
+extra care to correctly set `buffer-invisibility-spec'.  This was\r
+needed because headers overlay `invisible' property had only\r
+headers' invisibility spec.  So visibility of headers was\r
+determined only by the headers invisibility spec.  The patch sets\r
+headers overlay `invisible' property a list with both the headers\r
+and the message invisibility spec.  This makes headers invisible\r
+if either of them is added to the `buffer-invisibility-spec' and\r
+allows to simplify the code.\r
+---\r
+ emacs/notmuch-show.el |   18 +++++-------------\r
+ 1 files changed, 5 insertions(+), 13 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index e1846bc..2f7154e 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -733,8 +733,9 @@ current buffer, if possible."\r
+     ;; message.\r
+     (put-text-property message-start message-end :notmuch-message-extent (cons message-start message-end))\r
\r
+-    (let ((headers-overlay (make-overlay headers-start headers-end)))\r
+-      (overlay-put headers-overlay 'invisible headers-invis-spec)\r
++    (let ((headers-overlay (make-overlay headers-start headers-end))\r
++          (invis-specs (list headers-invis-spec message-invis-spec)))\r
++      (overlay-put headers-overlay 'invisible invis-specs)\r
+       (overlay-put headers-overlay 'priority 10))\r
+     (overlay-put (make-overlay body-start body-end) 'invisible message-invis-spec)\r
\r
+@@ -974,20 +975,11 @@ All currently available key bindings:\r
+       (add-to-invisibility-spec spec))))\r
\r
+ (defun notmuch-show-message-visible (props visible-p)\r
+-  (if visible-p\r
+-      ;; When making the message visible, the headers may or not be\r
+-      ;; visible. So we check that property separately.\r
+-      (let ((headers-visible (plist-get props :headers-visible)))\r
+-      (notmuch-show-element-visible props headers-visible :headers-invis-spec)\r
+-      (notmuch-show-element-visible props t :message-invis-spec))\r
+-    (notmuch-show-element-visible props nil :headers-invis-spec)\r
+-    (notmuch-show-element-visible props nil :message-invis-spec))\r
+-\r
++  (notmuch-show-element-visible props visible-p :message-invis-spec)\r
+   (notmuch-show-set-prop :message-visible visible-p props))\r
\r
+ (defun notmuch-show-headers-visible (props visible-p)\r
+-  (if (plist-get props :message-visible)\r
+-      (notmuch-show-element-visible props visible-p :headers-invis-spec))\r
++  (notmuch-show-element-visible props visible-p :headers-invis-spec)\r
+   (notmuch-show-set-prop :headers-visible visible-p props))\r
\r
+ ;; Functions for setting and getting attributes of the current\r
+-- \r
+1.7.5.1\r
+\r