[PATCH v5 5/6] emacs: show move addition of :notmuch-part to separate function
authorMark Walters <markwalters1009@gmail.com>
Mon, 10 Jun 2013 04:57:12 +0000 (05:57 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:55:31 +0000 (09:55 -0800)
a5/67d292bfb2159e202d30094e43d0b6370e2fc5 [new file with mode: 0644]

diff --git a/a5/67d292bfb2159e202d30094e43d0b6370e2fc5 b/a5/67d292bfb2159e202d30094e43d0b6370e2fc5
new file mode 100644 (file)
index 0000000..2ead5c4
--- /dev/null
@@ -0,0 +1,132 @@
+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 7CDE7431FBD\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Jun 2013 21:57:39 -0700 (PDT)\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 TDntXN-XA0Mx for <notmuch@notmuchmail.org>;\r
+       Sun,  9 Jun 2013 21:57:33 -0700 (PDT)\r
+Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 830D7431FAE\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Jun 2013 21:57:28 -0700 (PDT)\r
+Received: by mail-ea0-f181.google.com with SMTP id a15so2677002eae.40\r
+       for <notmuch@notmuchmail.org>; Sun, 09 Jun 2013 21:57:27 -0700 (PDT)\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=wBG1+1pCLZMzHDVDNynoav9nTrCQGJm1HWvowPQcPRM=;\r
+       b=MqLHFBXw/d7lt6KnuOu6CAeix1oGpHoJLJP5wjeoumD4zT4w/O3HvjvW6U8gJ+o3Dr\r
+       DIOtnu36FpGjaqatSkBm9dJQqXISofHJlxJq/rNI4d8PT86MbtkiG8pJl88d8C62TkQn\r
+       s47LluvNgNCiYdeOXOCDQyJI5kttG1uLlT53s448VfgBCb0Fcz0jiLuF8zc6GbC99hW8\r
+       sP75A7kEe6s1r8fTkFC57ayNJS4DQDk29LAWuuIeJ/RhSb/skRw6y5bzK6uBhjS10lpX\r
+       zAGOB5nLWVkm1N9yIwt/oQaQUibnm6BdVmGEVrSfZ12lW4TedOIcW2gVNuLzCXWiYIOF\r
+       I3uQ==\r
+X-Received: by 10.15.23.194 with SMTP id h42mr8823594eeu.123.1370840247451;\r
+       Sun, 09 Jun 2013 21:57:27 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id bk1sm20281322eeb.5.2013.06.09.21.57.26\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 09 Jun 2013 21:57:27 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+       Austin Clements <aclements@csail.mit.edu>\r
+Subject: [PATCH v5 5/6] emacs: show move addition of :notmuch-part to separate\r
+       function\r
+Date: Mon, 10 Jun 2013 05:57:12 +0100\r
+Message-Id: <1370840233-23258-6-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1370840233-23258-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1370840233-23258-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: Mon, 10 Jun 2013 04:57:39 -0000\r
+\r
+This separates out the adding of the :notmuch-part text property to a\r
+separate function to simplify calling from the lazy part insertion\r
+code.\r
+---\r
+ emacs/notmuch-show.el |   39 ++++++++++++++++++++++-----------------\r
+ 1 files changed, 22 insertions(+), 17 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 43aa88b..6ec70c9 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -807,6 +807,27 @@ message at DEPTH in the current thread."\r
+     ;; Return true if we created an overlay.\r
+     t))\r
\r
++(defun notmuch-show-record-part-information (part beg end)\r
++  "Store PART as a text property from BEG to END"\r
++\r
++  ;; Record part information.  Since we already inserted subparts,\r
++  ;; don't override existing :notmuch-part properties.\r
++  (notmuch-map-text-property beg end :notmuch-part\r
++                           (lambda (v) (or v part)))\r
++  ;; Make :notmuch-part front sticky and rear non-sticky so it stays\r
++  ;; applied to the beginning of each line when we indent the\r
++  ;; message.  Since we're operating on arbitrary renderer output,\r
++  ;; watch out for sticky specs of t, which means all properties are\r
++  ;; front-sticky/rear-nonsticky.\r
++  (notmuch-map-text-property beg end 'front-sticky\r
++                           (lambda (v) (if (listp v)\r
++                                           (pushnew :notmuch-part v)\r
++                                         v)))\r
++  (notmuch-map-text-property beg end 'rear-nonsticky\r
++                           (lambda (v) (if (listp v)\r
++                                           (pushnew :notmuch-part v)\r
++                                         v))))\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
\r
+@@ -836,23 +857,7 @@ If HIDE is non-nil then initially hide this part."\r
+     (when hide\r
+       (save-excursion\r
+       (notmuch-show-toggle-part-invisibility button)))\r
+-    ;; Record part information.  Since we already inserted subparts,\r
+-    ;; don't override existing :notmuch-part properties.\r
+-    (notmuch-map-text-property beg (point) :notmuch-part\r
+-                             (lambda (v) (or v part)))\r
+-    ;; Make :notmuch-part front sticky and rear non-sticky so it stays\r
+-    ;; applied to the beginning of each line when we indent the\r
+-    ;; message.  Since we're operating on arbitrary renderer output,\r
+-    ;; watch out for sticky specs of t, which means all properties are\r
+-    ;; front-sticky/rear-nonsticky.\r
+-    (notmuch-map-text-property beg (point) 'front-sticky\r
+-                             (lambda (v) (if (listp v)\r
+-                                             (pushnew :notmuch-part v)\r
+-                                           v)))\r
+-    (notmuch-map-text-property beg (point) 'rear-nonsticky\r
+-                             (lambda (v) (if (listp v)\r
+-                                             (pushnew :notmuch-part v)\r
+-                                           v)))))\r
++    (notmuch-show-record-part-information part beg (point))))\r
\r
+ (defun notmuch-show-insert-body (msg body depth)\r
+   "Insert the body BODY at depth DEPTH in the current thread."\r
+-- \r
+1.7.9.1\r
+\r