Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 52 / 94465b4ce67113dde9a57510872854413486fa
1 Return-Path: <jani@nikula.org>\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 978A6431FD2\r
6         for <notmuch@notmuchmail.org>; Tue, 27 Jan 2015 11:48:35 -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: 1.738\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.738 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id AwuNpSZFspjv for <notmuch@notmuchmail.org>;\r
17         Tue, 27 Jan 2015 11:48:32 -0800 (PST)\r
18 Received: from mail-we0-f177.google.com (mail-we0-f177.google.com\r
19         [74.125.82.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 29F11431FD9\r
22         for <notmuch@notmuchmail.org>; Tue, 27 Jan 2015 11:48:18 -0800 (PST)\r
23 Received: by mail-we0-f177.google.com with SMTP id l61so16823263wev.8\r
24         for <notmuch@notmuchmail.org>; Tue, 27 Jan 2015 11:48:16 -0800 (PST)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=1e100.net; s=20130820;\r
27         h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
28         :references;\r
29         bh=nVNvqY03ODraSJk5c24gwxvw3/U7rRdhTJQQ6EKwvGE=;\r
30         b=c6QwIBM1s7KGNsdMKN1/eyLRaWp8LLgnBJ/I3RzGyoWSQyH9LHSXEF1tSycugL+Bnm\r
31         eq+aqZUDioPLzHgVvN3+Lt7LitGWawsKjXMkw581y+/0koETDX5We3ILagb3dAB5D/e3\r
32         u1vjFlVSAslTmlRL2ZS/njCpHCFIUtSXAWzST7alyygQ8oaNHd0wVBy5bklKl2URzpcO\r
33         UR5TfUEZa+bnZ4Veo13WaVeZuTMn/l/El9SSdKPKr5DepRwJt+6cYGuWduL2F5V8sjQM\r
34         iOZFJN0dO8cPAdkTzgihnP5c4EspB5gwIzVUmtRF2qpqTps0PdhhHyd7VNMSMIstOeA4\r
35         NTEw==\r
36 X-Gm-Message-State:\r
37  ALoCoQmvvpl6RvPEhjUausb07QM/x80BD06Q3FQfDRRvYC7/xC/CnMJhiv9DX0veyz8KCd4wi3Vj\r
38 X-Received: by 10.194.190.162 with SMTP id gr2mr1249168wjc.13.1422388095900;\r
39         Tue, 27 Jan 2015 11:48:15 -0800 (PST)\r
40 Received: from localhost (mobile-internet-5d6ab0-235.dhcp.inet.fi.\r
41         [93.106.176.235])\r
42         by mx.google.com with ESMTPSA id v7sm19439267wib.5.2015.01.27.11.48.14\r
43         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
44         Tue, 27 Jan 2015 11:48:15 -0800 (PST)\r
45 From: Jani Nikula <jani@nikula.org>\r
46 To: notmuch@notmuchmail.org\r
47 Subject: [PATCH 5/5] completion: complete addresses in from:/to: search terms\r
48 Date: Tue, 27 Jan 2015 21:48:18 +0200\r
49 Message-Id: <1422388098-16333-5-git-send-email-jani@nikula.org>\r
50 X-Mailer: git-send-email 2.1.4\r
51 In-Reply-To: <1422388098-16333-1-git-send-email-jani@nikula.org>\r
52 References: <1422388098-16333-1-git-send-email-jani@nikula.org>\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Tue, 27 Jan 2015 19:48:36 -0000\r
66 \r
67 Use the new notmuch address command to do completion for addresses in\r
68 from: and to:.\r
69 \r
70 ---\r
71 \r
72 This patch is more of an RFC. The to: completion is sloooow because\r
73 typically there are more matches to begin with, and then producing the\r
74 results requires reading the messages. Maybe it would be better to use\r
75 the same mechanism as from: for both, even if it's not accurate for\r
76 to:?\r
77 ---\r
78  completion/notmuch-completion.bash | 30 +++++++++++++++++++++++++-----\r
79  1 file changed, 25 insertions(+), 5 deletions(-)\r
80 \r
81 diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash\r
82 index e0498903f22f..db49294fc58c 100644\r
83 --- a/completion/notmuch-completion.bash\r
84 +++ b/completion/notmuch-completion.bash\r
85 @@ -27,10 +27,30 @@\r
86  # on completion.\r
87  #\r
88  \r
89 -_notmuch_user_emails()\r
90 +# $1: current input of the form prefix:partialinput, where prefix is\r
91 +# to or from.\r
92 +_notmuch_email()\r
93  {\r
94 -    notmuch config get user.primary_email\r
95 -    notmuch config get user.other_email\r
96 +    local output prefix cur\r
97 +\r
98 +    prefix="${1%%:*}"\r
99 +    cur="${1#*:}"\r
100 +\r
101 +    # Cut the input to be completed at punctuation because\r
102 +    # (apparently) Xapian does not support the trailing wildcard '*'\r
103 +    # operator for input with punctuation. We let compgen handle the\r
104 +    # extra filtering required.\r
105 +    cur="${cur%%[^a-zA-Z0-9]*}"\r
106 +\r
107 +    case "$prefix" in\r
108 +       to) output=recipients;;\r
109 +       from) output=sender;;\r
110 +       *) return;;\r
111 +    esac\r
112 +\r
113 +    # Only emit plain, lower case, unique addresses.\r
114 +    notmuch address --output=$output $prefix:"${cur}*" | \\r
115 +       sed 's/[^<]*<\([^>]*\)>/\1/' | tr "[:upper:]" "[:lower:]" | sort -u\r
116  }\r
117  \r
118  _notmuch_search_terms()\r
119 @@ -44,10 +64,10 @@ _notmuch_search_terms()\r
120             COMPREPLY=( $(compgen -P "tag:" -W "`notmuch search --output=tags \*`" -- ${cur##tag:}) )\r
121             ;;\r
122         to:*)\r
123 -           COMPREPLY=( $(compgen -P "to:" -W "`_notmuch_user_emails`" -- ${cur##to:}) )\r
124 +           COMPREPLY=( $(compgen -P "to:" -W "`_notmuch_email ${cur}`" -- ${cur##to:}) )\r
125             ;;\r
126         from:*)\r
127 -           COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_user_emails`" -- ${cur##from:}) )\r
128 +           COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_email ${cur}`" -- ${cur##from:}) )\r
129             ;;\r
130         path:*)\r
131             local path=`notmuch config get database.path`\r
132 -- \r
133 2.1.4\r
134 \r