Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 0e / 9e0204a2be019a253cb3ee8ddb449f3dc4e2d1
1 Return-Path: <amthrax@drake.mit.edu>\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 1BDB7429E39\r
6         for <notmuch@notmuchmail.org>; Sun, 27 Nov 2011 18:21:48 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id RjVSnE9CHj+P for <notmuch@notmuchmail.org>;\r
16         Sun, 27 Nov 2011 18:21:47 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id 8E968429E3B\r
20         for <notmuch@notmuchmail.org>; Sun, 27 Nov 2011 18:21:36 -0800 (PST)\r
21 X-AuditID: 1209190c-b7f806d0000008d6-82-4ed2f0301236\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 37.57.02262.030F2DE4; Sun, 27 Nov 2011 21:21:36 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id pAS2LZ1M017091; \r
27         Sun, 27 Nov 2011 21:21:35 -0500\r
28 Received: from drake.mit.edu\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pAS2LXru020659\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sun, 27 Nov 2011 21:21:34 -0500 (EST)\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.76)\r
36         (envelope-from <amthrax@drake.mit.edu>)\r
37         id 1RUqqb-0003vX-Ll; Sun, 27 Nov 2011 21:21:33 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 3/4] Utility function to seek in MIME trees in depth-first\r
41         order.\r
42 Date: Sun, 27 Nov 2011 21:21:10 -0500\r
43 Message-Id: <1322446871-14986-4-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.5.4\r
45 In-Reply-To: <1322446871-14986-1-git-send-email-amdragon@mit.edu>\r
46 References: <1322446871-14986-1-git-send-email-amdragon@mit.edu>\r
47 X-Brightmail-Tracker:\r
48  H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsUixG6nrmvw4ZKfwe+D3Bat3Z+ZLK5u7We3\r
49         2LPPy+L6zZnMDiweZ7vbWT3unuby2DnrLrvHs1W3mANYorhsUlJzMstSi/TtErgy9nf/ZCyY\r
50         zFtx+n4vawPjWq4uRk4OCQETiQ1b+pggbDGJC/fWs3UxcnEICexjlJi/9yYThLOBUaL7+UZm\r
51         kCohgftMErceBELY8xklbmzlA7HZBDQktu1fzghiiwhIS+y8O5sVxGYWqJPo3HiGHcQWFgiU\r
52         +D7nFdg2FgFViSsv9rOB2LwCDhKdH++wQVyhIPHryCqwXk4BR4m5TVug9jpIrFt2lHUCI/8C\r
53         RoZVjLIpuVW6uYmZOcWpybrFyYl5ealFuoZ6uZkleqkppZsYQcHGKcmzg/HNQaVDjAIcjEo8\r
54         vBsvX/ITYk0sK67MPcQoycGkJMr74h1QiC8pP6UyI7E4I76oNCe1+BCjBAezkghvz1GgHG9K\r
55         YmVValE+TEqag0VJnPfgDgc/IYH0xJLU7NTUgtQimKwMB4eSBG/Se6BGwaLU9NSKtMycEoQ0\r
56         EwcnyHAeoOEhIDW8xQWJucWZ6RD5U4y6HAuuXD/NKMSSl5+XKiXOmwNSJABSlFGaBzcHliRe\r
57         MYoDvSXMGw5SxQNMMHCTXgEtYQJawjHzAsiSkkSElFQD4yrFuXqNr7o4SzdcbZ+t8CzyR+2m\r
58         7Z1B3SwvNaTkRdzVp/wTf9fSrOyxdtoCu2kFU1ukpSKfhn+MWKV0miW67Bl/UHHHweUuypMq\r
59         ZG7PTGV+JH5w6ycBlTfJRYExRX+tJuXJxs1lsn1xQb/r2Hpu5+s5jJEM9hEZFR/ral+3hy39\r
60         qVpd4npfiaU4I9FQi7moOBEAiyill+0CAAA=\r
61 Cc: dkg@fifthhorseman.net\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.13\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66         <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Mon, 28 Nov 2011 02:21:48 -0000\r
75 \r
76 This function matches how we number parts for the --part argument to\r
77 show.  It will allow us to jump directly to the desired part, rather\r
78 than traversing the entire tree and carefully tracking whether or not\r
79 we're "in the zone".\r
80 ---\r
81  mime-node.c      |   25 +++++++++++++++++++++++++\r
82  notmuch-client.h |    5 +++++\r
83  2 files changed, 30 insertions(+), 0 deletions(-)\r
84 \r
85 diff --git a/mime-node.c b/mime-node.c\r
86 index 942738b..40fff75 100644\r
87 --- a/mime-node.c\r
88 +++ b/mime-node.c\r
89 @@ -232,3 +232,28 @@ mime_node_child (const mime_node_t *parent, int child)\r
90                         g_type_name (G_OBJECT_TYPE (parent->part)));\r
91      }\r
92  }\r
93 +\r
94 +static mime_node_t *\r
95 +_mime_node_seek_dfs_walk (mime_node_t *node, int *n)\r
96 +{\r
97 +    mime_node_t *ret = NULL;\r
98 +    int i;\r
99 +\r
100 +    if (*n <= 0)\r
101 +       return node;\r
102 +\r
103 +    *n = *n - 1;\r
104 +    for (i = 0; i < node->children && !ret; i++) {\r
105 +       mime_node_t *child = mime_node_child (node, i);\r
106 +       ret = _mime_node_seek_dfs_walk (child, n);\r
107 +       if (!ret)\r
108 +           talloc_free (child);\r
109 +    }\r
110 +    return ret;\r
111 +}\r
112 +\r
113 +mime_node_t *\r
114 +mime_node_seek_dfs (mime_node_t *node, int n)\r
115 +{\r
116 +    return _mime_node_seek_dfs_walk (node, &n);\r
117 +}\r
118 diff --git a/notmuch-client.h b/notmuch-client.h\r
119 index 58bd21c..8b1454f 100644\r
120 --- a/notmuch-client.h\r
121 +++ b/notmuch-client.h\r
122 @@ -318,4 +318,9 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
123  mime_node_t *\r
124  mime_node_child (const mime_node_t *parent, int child);\r
125  \r
126 +/* Return the nth child of node in a depth-first traversal.  If n is\r
127 + * 0, returns node itself.  Returns NULL if there is no such part. */\r
128 +mime_node_t *\r
129 +mime_node_seek_dfs (mime_node_t *node, int n);\r
130 +\r
131  #endif\r
132 -- \r
133 1.7.5.4\r
134 \r