Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 64 / 332feb2f6933d64683c3fab0a89ebaaa467fe1
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 28D8B431FCB\r
6         for <notmuch@notmuchmail.org>; Tue, 22 Apr 2014 13:12:14 -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 448xH2R6yVh3 for <notmuch@notmuchmail.org>;\r
18         Tue, 22 Apr 2014 13:12:12 -0700 (PDT)\r
19 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
20         [209.85.212.173]) (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 95338431FC2\r
23         for <notmuch@notmuchmail.org>; Tue, 22 Apr 2014 13:12:10 -0700 (PDT)\r
24 Received: by mail-wi0-f173.google.com with SMTP id z2so3903894wiv.0\r
25         for <notmuch@notmuchmail.org>; Tue, 22 Apr 2014 13:12:09 -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:in-reply-to:references;\r
28         bh=tcWOUiPa0t2iWTfMBp54srjI2fxmmQmzNUsJzEJmKmw=;\r
29         b=FueXz3sSMvipKnaK9NLMoYOPFNXqXsyD6oL4ToLRo8BzXDSSXy4asfNXlZLNgzf9nu\r
30         TwiyGh3XIjlvixZSrhPIS3LEuHuWyGIY5kpoHVw1uvoUEmRQSsLitxWo4ijzzRNNPEhR\r
31         333i0sE1c1DwK73BilBDV/WTfIvrDujExXABHo4736qc/Ad3ysN3iTYz1AelVk7D3RGJ\r
32         or2ofANyq4r4T4bC1UXo8ZmdwpdI1OS4XMOZlsxHK0ZuKtSDVCGdXLfQo8ReVcn2aZo3\r
33         wDj6vijFekZ52wOAWpueXXWDGivvizEd+LkRx+jC8AppGPd85LrNOemy9SthSwQU+ciu\r
34         sSBA==\r
35 X-Received: by 10.194.59.43 with SMTP id w11mr4049809wjq.65.1398197529549;\r
36         Tue, 22 Apr 2014 13:12:09 -0700 (PDT)\r
37 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
38         by mx.google.com with ESMTPSA id jd2sm24558632wic.9.2014.04.22.13.12.08\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Tue, 22 Apr 2014 13:12:09 -0700 (PDT)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [WIP PATCH 3/4] emacs: search: split foreach-result into list and\r
45         region variants\r
46 Date: Tue, 22 Apr 2014 21:11:49 +0100\r
47 Message-Id: <1398197510-28224-4-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.10.4\r
49 In-Reply-To: <1398197510-28224-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1398197510-28224-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Tue, 22 Apr 2014 20:12:14 -0000\r
64 \r
65 ---\r
66  emacs/notmuch.el |   20 +++++++++++++++++++-\r
67  1 file changed, 19 insertions(+), 1 deletion(-)\r
68 \r
69 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
70 index 7b06458..e1ece47 100644\r
71 --- a/emacs/notmuch.el\r
72 +++ b/emacs/notmuch.el\r
73 @@ -380,7 +380,20 @@ (defun notmuch-search-result-end (&optional pos)\r
74      (next-single-property-change (or pos (point)) 'notmuch-search-result\r
75                                  nil (point-max))))\r
76  \r
77 -(defun notmuch-search-foreach-result (beg end thread-list function)\r
78 +(defun notmuch-search-foreach-result-in-list (thread-list function)\r
79 +  "Invoke function for each thread in list."\r
80 +  (lexical-let ((thread-list (copy-sequence thread-list)))\r
81 +    (save-excursion\r
82 +      (goto-char (point-min))\r
83 +      (while (and (notmuch-search-get-result)\r
84 +                 thread-list)\r
85 +       (let ((thread (notmuch-search-find-thread-id)))\r
86 +         (when (member thread thread-list)\r
87 +           (funcall function)\r
88 +           (setq thread-list (delete thread thread-list))))\r
89 +       (notmuch-search-next-thread)))))\r
90 +\r
91 +(defun notmuch-search-foreach-result-in-region (beg end function)\r
92    "Invoke FUNCTION for each result between BEG and END.\r
93  \r
94  FUNCTION should take no arguments.  It will be applied at the\r
95 @@ -401,6 +414,11 @@ (defun notmuch-search-foreach-result (beg end thread-list function)\r
96           (funcall function)\r
97           (notmuch-search-next-thread))))))\r
98  \r
99 +(defun notmuch-search-foreach-result (beg end thread-list function)\r
100 +  (if thread-list\r
101 +      (notmuch-search-foreach-result-in-list thread-list function)\r
102 +    (notmuch-search-foreach-result-in-region beg end function)))\r
103 +\r
104  ;; Unindent the function argument of notmuch-search-foreach-result so\r
105  ;; the indentation of callers doesn't get out of hand.\r
106  (put 'notmuch-search-foreach-result 'lisp-indent-function 2)\r
107 -- \r
108 1.7.10.4\r
109 \r