Re: compile error of current git on F15
[notmuch-archives.git] / 40 / a6e8a2f00786c47f5b71ff2972797415c146b7
1 Return-Path: <schnouki@schnouki.net>\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 DB865429E2D\r
6         for <notmuch@notmuchmail.org>; Fri, 27 May 2011 02:15:24 -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.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\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 QUaziOEaIq0n for <notmuch@notmuchmail.org>;\r
17         Fri, 27 May 2011 02:15:24 -0700 (PDT)\r
18 Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
19         by olra.theworths.org (Postfix) with ESMTP id D35BE429E2B\r
20         for <notmuch@notmuchmail.org>; Fri, 27 May 2011 02:15:23 -0700 (PDT)\r
21 Received: from localhost.localdomain (thor.loria.fr [152.81.12.250])\r
22         by ks3536.kimsufi.com (Postfix) with ESMTPSA id D459D6A06AD;\r
23         Fri, 27 May 2011 11:15:22 +0200 (CEST)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
25         s=key-schnouki; t=1306487722;\r
26         bh=4ZGWJpwZPAz5OkQ8JPB5PqQoStQFjzjJ3rs6zrr6hOc=;\r
27         h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
28         b=UuqqhFuxp/k6pioi/PTBKZSyKB5A2wVeZ87OXzoojuoeKnODm7t8UhFbBc6D8HvtZ\r
29         qUMig7IMtvZ3VGImgMQJFybePyxuHkrcfn9u+EWHXCAQQwWtbtAkDZJb0LXbn4o4uG\r
30         XuShxYaDUyNmJzNDtv7NeCMo95EPfXdF702ceahA=\r
31 From: Thomas Jost <schnouki@schnouki.net>\r
32 To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
33         Carl Worth <cworth@cworth.org>, Stewart Smith <stewart@flamingspork.com>,\r
34         notmuch <notmuch@notmuchmail.org>\r
35 Subject: [PATCH 2/2] emacs: Cleaner interface when prompting for sender\r
36  address\r
37 Date: Fri, 27 May 2011 11:15:00 +0200\r
38 Message-Id: <1306487700-21358-2-git-send-email-schnouki@schnouki.net>\r
39 X-Mailer: git-send-email 1.7.5.2\r
40 In-Reply-To: <1306487700-21358-1-git-send-email-schnouki@schnouki.net>\r
41 References: <87mxi9ytvt.fsf@servo.factory.finestructure.net>\r
42         <1306487700-21358-1-git-send-email-schnouki@schnouki.net>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Fri, 27 May 2011 09:15:25 -0000\r
56 \r
57 Most of the time, every entry in the list of identities has the same user name\r
58 part. It can then be filled in automatically, and the user can only be prompted\r
59 for the email address, which makes the interface much cleaner.\r
60 ---\r
61 Hi Jameson,\r
62 \r
63 Once again, a very good suggestion. I had doubts at first (because I sometimes\r
64 send mails using a nickname or on behalf of a group using that group's name),\r
65 but then I noticed I already had only one name in notmuch-identities :) So\r
66 here's a patch.\r
67 \r
68 It handle 3 different cases:\r
69 - notmuch-identities is not set --> only one name\r
70 - notmuch-identities set with only one name\r
71 - notmuch-identities set with several different names\r
72 \r
73 I tried to make it as compact and readable as possible, so the first two cases\r
74 are handled by a single call to ido-completing-read. But there is probably still\r
75 room for improvements: reviews, comments and suggestions are welcome.\r
76 \r
77 Regards,\r
78 Thomas\r
79 \r
80  emacs/notmuch-mua.el |   33 +++++++++++++++++++++++----------\r
81  1 files changed, 23 insertions(+), 10 deletions(-)\r
82 \r
83 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
84 index 556d2bf..274c5da 100644\r
85 --- a/emacs/notmuch-mua.el\r
86 +++ b/emacs/notmuch-mua.el\r
87 @@ -162,20 +162,33 @@ the From: header is already filled in by notmuch."\r
88    :group 'notmuch\r
89    :type 'boolean)\r
90  \r
91 -(defun notmuch-mua-sender-collection ()\r
92 -  (if notmuch-identities\r
93 -      notmuch-identities\r
94 -    (mapcar (lambda (address)\r
95 -             (concat (notmuch-user-name) " <" address ">"))\r
96 -           (cons (notmuch-user-primary-email) (notmuch-user-other-email)))))\r
97 -\r
98  (defvar notmuch-mua-sender-history nil)\r
99  \r
100  (defun notmuch-mua-prompt-for-sender ()\r
101    (interactive)\r
102 -  (let ((collection (notmuch-mua-sender-collection)))\r
103 -    (ido-completing-read "Send mail From: " collection\r
104 -                        nil 'confirm nil 'notmuch-mua-sender-history (car collection))))\r
105 +  (let (name addresses one-name-only)\r
106 +    ;; If notmuch-identities is non-nil, check if there is a fixed user name.\r
107 +    (if notmuch-identities\r
108 +       (let ((components (mapcar 'mail-extract-address-components notmuch-identities)))\r
109 +         (setq name          (caar components)\r
110 +               addresses     (mapcar 'cadr components)\r
111 +               one-name-only (eval\r
112 +                              (cons 'and\r
113 +                                    (mapcar (lambda (identity)\r
114 +                                              (string-equal name (car identity)))\r
115 +                                            components)))))\r
116 +      ;; If notmuch-identities is nil, use values from the notmuch configuration file.\r
117 +      (setq name          (notmuch-user-name)\r
118 +           addresses     (cons (notmuch-user-primary-email) (notmuch-user-other-email))\r
119 +           one-name-only t))\r
120 +    ;; Now prompt the user, either for an email address only or for a full identity.\r
121 +    (if one-name-only\r
122 +       (let ((address\r
123 +              (ido-completing-read (concat "Sender address for " name ": ") addresses\r
124 +                                   nil nil nil 'notmuch-mua-sender-history (car addresses))))\r
125 +         (concat name " <" address ">"))\r
126 +      (ido-completing-read "Send mail From: " notmuch-identities\r
127 +                          nil nil nil 'notmuch-mua-sender-history (car notmuch-identities)))))\r
128  \r
129  (defun notmuch-mua-new-mail (&optional prompt-for-sender)\r
130    "Invoke the notmuch mail composition window.\r
131 -- \r
132 1.7.5.2\r
133 \r