Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / c8 / 6ffc95057c0c575cf7281be3775a270c2e2489
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 49C3A431FB6\r
6         for <notmuch@notmuchmail.org>; Thu, 26 May 2011 01:41:53 -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 LusZ1096SC6s for <notmuch@notmuchmail.org>;\r
17         Thu, 26 May 2011 01:41:52 -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 6655E431FD0\r
20         for <notmuch@notmuchmail.org>; Thu, 26 May 2011 01:41:52 -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 B70B36A06A9;\r
23         Thu, 26 May 2011 10:41:51 +0200 (CEST)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
25         s=key-schnouki; t=1306399311;\r
26         bh=sbmpolwzteB/vfVXJwj48vukpdpIDINppX6bu14zzro=;\r
27         h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
28         b=FHInpmYSH77FLkFWH6kwpSui4V1fsxRaZ6mh3rVuDxlz+SK4trHRfhwY7VJfztC9J\r
29         0oZT0VmGNiQ17EyfzP1efFq9OnK2xbsFyM/E8MAmQTAWTKMg9f+LEJ2yvEOXecMIa2\r
30         2Y3mVKM3XXUYNsz3tYWvg/g+6eXd0cuYJ1H9gum4=\r
31 From: Thomas Jost <schnouki@schnouki.net>\r
32 To: Carl Worth <cworth@cworth.org>, Stewart Smith <stewart@flamingspork.com>,\r
33         notmuch <notmuch@notmuchmail.org>\r
34 Subject: [PATCH v2 1/4] emacs: Helpers needed for the user to be able to\r
35         choose the "From" address when composing a new message\r
36 Date: Thu, 26 May 2011 10:41:30 +0200\r
37 Message-Id: <1306399293-22215-1-git-send-email-schnouki@schnouki.net>\r
38 X-Mailer: git-send-email 1.7.5.1\r
39 In-Reply-To: <87hb8hlush.fsf@thor.loria.fr>\r
40 References: <87hb8hlush.fsf@thor.loria.fr>\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: Thu, 26 May 2011 08:41:53 -0000\r
54 \r
55 This adds functions and variables needed for this feature to be implemented.\r
56 Once it's done, the user will be able to use a prefix argument (e.g. pressing\r
57 C-u m instead of m) and be able to select a From address.\r
58 \r
59 By default the list of names/addresses to be used during completion will be\r
60 automatically generated by the settings in the notmuch configuration file. The\r
61 user can customize the notmuch-identities variable to provide an alternate list.\r
62 \r
63 This is based on a previous patch by Carl Worth\r
64 (id:"87wrhfvk6a.fsf@yoom.home.cworth.org" and follow-ups).\r
65 ---\r
66  emacs/notmuch-mua.el |   23 +++++++++++++++++++++++\r
67  1 files changed, 23 insertions(+), 0 deletions(-)\r
68 \r
69 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
70 index 003b313..2baf6bd 100644\r
71 --- a/emacs/notmuch-mua.el\r
72 +++ b/emacs/notmuch-mua.el\r
73 @@ -143,6 +143,29 @@ list."\r
74  \r
75    (message-goto-to))\r
76  \r
77 +(defcustom notmuch-identities nil\r
78 +  "Identities that can be used as the From: address when composing a new message.\r
79 +\r
80 +If this variable is left unset, then a list will be constructed from the\r
81 +name and addresses configured in the notmuch configuration file."\r
82 +  :group 'notmuch\r
83 +  :type '(repeat string))\r
84 +\r
85 +(defun notmuch-mua-sender-collection ()\r
86 +  (if notmuch-identities\r
87 +      notmuch-identities\r
88 +    (mapcar (lambda (address)\r
89 +             (concat (notmuch-user-name) " <" address ">"))\r
90 +           (cons (notmuch-user-primary-email) (notmuch-user-other-email)))))\r
91 +\r
92 +(defvar notmuch-mua-sender-history nil)\r
93 +\r
94 +(defun notmuch-mua-prompt-for-sender ()\r
95 +  (interactive)\r
96 +  (let ((collection (notmuch-mua-sender-collection)))\r
97 +    (ido-completing-read "Send mail From: " collection\r
98 +                        nil 'confirm nil 'notmuch-mua-sender-history (car collection))))\r
99 +\r
100  (defun notmuch-mua-send-and-exit (&optional arg)\r
101    (interactive "P")\r
102    (message-send-and-exit arg))\r
103 -- \r
104 1.7.5.1\r
105 \r