Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 22 / f51efafeef27e20c47fef2ecf322f4ca8b570a
1 Return-Path: <dme@dme.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 CB55B429E28\r
6         for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 04:35:34 -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 EF6vs-pbQCxg for <notmuch@notmuchmail.org>;\r
16         Wed, 21 Dec 2011 04:35:34 -0800 (PST)\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 32D05431FB6\r
21         for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 04:35:34 -0800 (PST)\r
22 Received: by werm12 with SMTP id m12so3310882wer.26\r
23         for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 04:35:31 -0800 (PST)\r
24 Received: by 10.216.131.223 with SMTP id m73mr8785155wei.52.1324470931323;\r
25         Wed, 21 Dec 2011 04:35:31 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id\r
29         en20sm13113526wid.10.2011.12.21.04.35.29\r
30         (version=TLSv1/SSLv3 cipher=OTHER);\r
31         Wed, 21 Dec 2011 04:35:30 -0800 (PST)\r
32 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
33         id 68BB0A024F; Wed, 21 Dec 2011 12:35:28 +0000 (GMT)\r
34 From: David Edmondson <dme@dme.org>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH] emacs: Don't prompt the user to choose from zero matching\r
37         addresses.\r
38 Date: Wed, 21 Dec 2011 12:35:27 +0000\r
39 Message-Id: <1324470927-15353-1-git-send-email-dme@dme.org>\r
40 X-Mailer: git-send-email 1.7.7.3\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Wed, 21 Dec 2011 12:35:34 -0000\r
54 \r
55 If the address matching function generates no matches, don't prompt\r
56 the user to choose between them (!). Instead, generate a message to\r
57 report that there were no matches.\r
58 ---\r
59  emacs/notmuch-address.el |   21 ++++++++++++++-------\r
60  1 files changed, 14 insertions(+), 7 deletions(-)\r
61 \r
62 diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
63 index 1a7c577..8eba7a0 100644\r
64 --- a/emacs/notmuch-address.el\r
65 +++ b/emacs/notmuch-address.el\r
66 @@ -54,15 +54,22 @@ line."\r
67          (completion-ignore-case t)\r
68          (options (notmuch-address-options orig))\r
69          (num-options (length options))\r
70 -        (chosen (if (eq num-options 1)\r
71 -                    (car options)\r
72 +        (chosen (cond\r
73 +                 ((eq num-options 0)\r
74 +                  nil)\r
75 +                 ((eq num-options 1)\r
76 +                  (car options))\r
77 +                 (t\r
78                    (completing-read (format "Address (%s matches): " num-options)\r
79                                     (cdr options) nil nil (car options)\r
80 -                                   'notmuch-address-history))))\r
81 -    (when chosen\r
82 -      (push chosen notmuch-address-history)\r
83 -      (delete-region beg end)\r
84 -      (insert chosen))))\r
85 +                                   'notmuch-address-history)))))\r
86 +    (if chosen\r
87 +       (progn\r
88 +         (push chosen notmuch-address-history)\r
89 +         (delete-region beg end)\r
90 +         (insert chosen))\r
91 +      (message "No matches.")\r
92 +      (ding))))\r
93  \r
94  ;; Copied from `w3m-which-command'.\r
95  (defun notmuch-address-locate-command (command)\r
96 -- \r
97 1.7.7.3\r
98 \r