Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 05 / 505a268d29b02de067c042bb616b6a1529bee7
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id CDE87429E41\r
6         for <notmuch@notmuchmail.org>; Fri, 14 Jun 2013 00:38:07 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id CLJ3Rr96uVlU for <notmuch@notmuchmail.org>;\r
18         Fri, 14 Jun 2013 00:38:00 -0700 (PDT)\r
19 Received: from mail-we0-f170.google.com (mail-we0-f170.google.com\r
20         [74.125.82.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 1D374431FC2\r
23         for <notmuch@notmuchmail.org>; Fri, 14 Jun 2013 00:37:59 -0700 (PDT)\r
24 Received: by mail-we0-f170.google.com with SMTP id w57so188347wes.1\r
25         for <notmuch@notmuchmail.org>; Fri, 14 Jun 2013 00:37:58 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
28         :mime-version:content-type:content-transfer-encoding;\r
29         bh=gRT8SnnoIz4++qpuHXKdocgzEyqLCygvGYeZdU3SZVo=;\r
30         b=e7OIyflnR0v54dqrWEgJLAKqHmy+BFqyf+t3B8MJLjpgHCF6AWUhfkgYnOwEsaJlXf\r
31         R+l/z/oeJU2MaICr6wXu2gdqw+cKHLrr4ArXsjklAZkP0HXRvwJVEIILMlqkaKXPQFqi\r
32         8hGCi7mC1i8At0HxD7HN67xAXu3WSnqgujkVmpjk+GrLK04DsoRl+OxJuJz0gQFiUBhj\r
33         tYGJalYWzScGkPF4xCWjVwlVauVyiOwUCYQONRwelkDpZ2ivZZMUnz9/d6M9eYRX1FdD\r
34         v4kLneRvmQ9C/g0TL72oN0/pn/ixHkDjylul1nqNxsOdtOwTd7x6lfuvV2JVUy6bnXat\r
35         Sfmg==\r
36 X-Received: by 10.194.123.9 with SMTP id lw9mr632485wjb.24.1371195478882;\r
37         Fri, 14 Jun 2013 00:37:58 -0700 (PDT)\r
38 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
39         by mx.google.com with ESMTPSA id ay7sm1169657wib.9.2013.06.14.00.37.57\r
40         for <multiple recipients>\r
41         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
42         Fri, 14 Jun 2013 00:37:58 -0700 (PDT)\r
43 From: Mark Walters <markwalters1009@gmail.com>\r
44 To: notmuch@notmuchmail.org\r
45 Subject: [PATCH v3 1/2] contrib: pick: add thread based utility functions\r
46 Date: Fri, 14 Jun 2013 08:37:51 +0100\r
47 Message-Id: <1371195472-441-2-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 In-Reply-To: <1371195472-441-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1371195472-441-1-git-send-email-markwalters1009@gmail.com>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=UTF-8\r
53 Content-Transfer-Encoding: 8bit\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Fri, 14 Jun 2013 07:38:08 -0000\r
67 \r
68 Previously notmuch-pick had no thread based functionality. This adds a\r
69 macro to iterate through all messages in a thread. To simplify this it\r
70 adds a text-property marker to the first message of each thread.\r
71 ---\r
72  contrib/notmuch-pick/notmuch-pick.el |   24 ++++++++++++++++++++++++\r
73  1 files changed, 24 insertions(+), 0 deletions(-)\r
74 \r
75 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
76 index 10a2bf7..af117ba 100644\r
77 --- a/contrib/notmuch-pick/notmuch-pick.el\r
78 +++ b/contrib/notmuch-pick/notmuch-pick.el\r
79 @@ -583,6 +583,29 @@ than only the current message."\r
80           (message (format "Command '%s' exited abnormally with code %d"\r
81                            shell-command exit-code)))))))\r
82  \r
83 +(defun notmuch-pick-thread-top ()\r
84 +  (when (notmuch-pick-get-message-properties)\r
85 +    (while (not (or (notmuch-pick-get-prop :first) (eobp)))\r
86 +      (forward-line -1))))\r
87 +\r
88 +(defun notmuch-pick-thread-mapcar (function)\r
89 +  "Iterate through all messages in the current thread\r
90 + and call FUNCTION for side effects."\r
91 +  (save-excursion\r
92 +    (notmuch-pick-thread-top)\r
93 +    (loop collect (funcall function)\r
94 +         do (forward-line)\r
95 +         while (and (notmuch-pick-get-message-properties)\r
96 +                    (not (notmuch-pick-get-prop :first))))))\r
97 +\r
98 +(defun notmuch-pick-get-messages-ids-thread-search ()\r
99 +  "Return a search string for all message ids of messages in the current thread."\r
100 +  (mapconcat 'identity\r
101 +            (notmuch-pick-thread-mapcar 'notmuch-pick-get-message-id)\r
102 +            " or "))\r
103 +\r
104 +;; Functions below here display the pick buffer itself.\r
105 +\r
106  (defun notmuch-pick-clean-address (address)\r
107    "Try to clean a single email ADDRESS for display. Return\r
108  AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return\r
109 @@ -680,6 +703,7 @@ unchanged ADDRESS if parsing fails."\r
110         (push "├" tree-status)))\r
111  \r
112        (push (concat (if replies "┬" "─") "►") tree-status)\r
113 +      (plist-put msg :first (and first (eq 0 depth)))\r
114        (notmuch-pick-goto-and-insert-msg (plist-put msg :tree-status tree-status))\r
115        (pop tree-status)\r
116        (pop tree-status)\r
117 -- \r
118 1.7.9.1\r
119 \r