--- /dev/null
+Return-Path: <alex.boterolowry@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 DFE00431FC3\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 WlQzG8XU5rFM for <notmuch@notmuchmail.org>;\r
+ Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
+Received: from mail-gx0-f225.google.com (mail-gx0-f225.google.com\r
+ [209.85.217.225])\r
+ by olra.theworths.org (Postfix) with ESMTP id 70F79431FC0\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
+Received: by gxk25 with SMTP id 25so5944187gxk.0\r
+ for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=domainkey-signature:received:received:received:from:to:cc:subject\r
+ :date:message-id:x-mailer:in-reply-to:references;\r
+ bh=qRfrCGP55+BJ1M1Sx581PzEMIxdwfn+dqhSOrNP4Ixw=;\r
+ b=ZAmfXFEoBuek50laFlZ1iR724VUc4HRuyhjDVSMZKwfUArGC9N+keyF44Z7mPIMz55\r
+ gq3k9KNP2+V33ZZojFDRSRcqczxD0pQNrGtwdzOIT0HyxSVbIkd38i9mOtBgcE0msRTd\r
+ QAOYuLxnyXlUjoRQusGpDAbJn7SJhZR84a7n4=\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=slhXuxTbkhxh1e6oZlwzed52Dl97FY09IF40TcKJKlyEyMO54hBNEuotm7ZMBjOPz4\r
+ QbH7AhGu7TE71HzCg1+zKkmFUZK2TPfcwjd6kFEow68LvrdTNncreiTnLWk0fnRd6Ko7\r
+ S6ESoMxr2T2kdHmQyyWjGnAvld4rQrxAnIMww=\r
+Received: by 10.150.3.14 with SMTP id 14mr5802306ybc.228.1259048722072;\r
+ Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
+Received: from fortitudo (70-36-144-85.dsl.dynamic.sonic.net [70.36.144.85])\r
+ by mx.google.com with ESMTPS id 13sm2537484gxk.13.2009.11.23.23.45.20\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Mon, 23 Nov 2009 23:45:21 -0800 (PST)\r
+Received: from alexbl (uid 1001) (envelope-from alexbl@fortitudo) id 7059\r
+ by fortitudo (DragonFly Mail Agent) Mon, 23 Nov 2009 23:45:25 -0800\r
+From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Date: Mon, 23 Nov 2009 23:45:05 -0800\r
+Message-Id: <1259048707-3062-3-git-send-email-alex.boterolowry@gmail.com>\r
+X-Mailer: git-send-email 1.6.5.2\r
+In-Reply-To: <1259048707-3062-2-git-send-email-alex.boterolowry@gmail.com>\r
+References: <1259048707-3062-1-git-send-email-alex.boterolowry@gmail.com>\r
+ <1259048707-3062-2-git-send-email-alex.boterolowry@gmail.com>\r
+Subject: [notmuch] [PATCH 3/5] make a nice function for generating\r
+ invisibility toggle buttons\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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: Tue, 24 Nov 2009 07:45:23 -0000\r
+\r
+I realized I was replicating this code over and over again, so this\r
+way if I change my mind about something I only have to do it on one\r
+place.\r
+---\r
+ notmuch.el | 45 ++++++++++++++++-----------------------------\r
+ 1 files changed, 16 insertions(+), 29 deletions(-)\r
+\r
+diff --git a/notmuch.el b/notmuch.el\r
+index ed1f7cb..23a07cc 100644\r
+--- a/notmuch.el\r
++++ b/notmuch.el\r
+@@ -497,6 +497,13 @@ which this thread was originally shown."\r
+ (force-window-update)\r
+ (redisplay t))\r
+ \r
++(defun notmuch-configure-invisibility-button (btn invis-spec help-msg)\r
++ (button-put btn 'invisibility-spec invis-spec)\r
++ (button-put btn 'action 'notmuch-toggle-invisible-action)\r
++ (button-put btn 'follow-link t)\r
++ (button-put btn 'help-echo (concat "mouse-1, RET: " help-msg))\r
++)\r
++\r
+ (defun notmuch-show-markup-citations-region (beg end depth)\r
+ (goto-char beg)\r
+ (beginning-of-line)\r
+@@ -512,22 +519,13 @@ which this thread was originally shown."\r
+ (invis-spec (make-symbol "notmuch-citation-region")))\r
+ (add-to-invisibility-spec invis-spec)\r
+ (overlay-put overlay 'invisible invis-spec)\r
+- (let (\r
+- (p (point))\r
++ (let ((p (point))\r
+ (cite-button-text\r
+ (concat "[" (number-to-string (count-lines beg-sub (point)))\r
+- "-line citation.]"))\r
+- )\r
++ "-line citation.]")))\r
+ (goto-char (- beg-sub 1))\r
+ (insert (concat "\n" indent))\r
+- (let ((cite-button (insert-button cite-button-text)))\r
+- (button-put cite-button 'invisibility-spec invis-spec)\r
+- (button-put cite-button 'action 'notmuch-toggle-invisible-action)\r
+- (button-put cite-button 'follow-link t)\r
+- (button-put cite-button 'help-echo\r
+- "mouse-1, RET: Show citation")\r
+-\r
+- )\r
++ (notmuch-configure-invisibility-button (insert-button cite-button-text) invis-spec "Show citation")\r
+ (insert "\n")\r
+ (goto-char (+ (length cite-button-text) p))\r
+ ))))\r
+@@ -543,16 +541,9 @@ which this thread was originally shown."\r
+ \r
+ (goto-char (- beg-sub 1))\r
+ (insert (concat "\n" indent))\r
+- (let ((sig-button (insert-button \r
+- (concat "[" (number-to-string sig-lines)\r
+- "-line signature.]"))))\r
+- (button-put sig-button 'invisibility-spec invis-spec)\r
+- (button-put sig-button 'action\r
+- 'notmuch-toggle-invisible-action)\r
+- (button-put sig-button 'follow-link t)\r
+- (button-put sig-button 'help-echo\r
+- "mouse-1, RET: Show signature")\r
+- )\r
++ (notmuch-configure-invisibility-button\r
++ (insert-button (concat "[" (number-to-string sig-lines)\r
++ "-line signature.]")) invis-spec "Show signature")\r
+ (insert "\n")\r
+ (goto-char end))))))\r
+ (forward-line))))\r
+@@ -623,13 +614,9 @@ which this thread was originally shown."\r
+ 'invisible invis-spec)\r
+ (goto-char beg)\r
+ (forward-line)\r
+- (let ((header-button (make-button (line-beginning-position) (line-end-position))))\r
+- (button-put header-button 'invisibility-spec (cons invis-spec t))\r
+- (button-put header-button 'action 'notmuch-toggle-invisible-action)\r
+- (button-put header-button 'follow-link t)\r
+- (button-put header-button 'help-echo\r
+- "mouse-1, RET: Show headers")\r
+- ))\r
++ (notmuch-configure-invisibility-button\r
++ (make-button (line-beginning-position) (line-end-position))\r
++ (cons invis-spec t) "Show headers"))\r
+ (goto-char end)\r
+ (insert "\n")\r
+ (set-marker beg nil)\r
+-- \r
+1.6.5.2\r
+\r