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 A480E431FD2
\r
6 for <notmuch@notmuchmail.org>; Sat, 4 Feb 2012 12:44:49 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 5EiZm2RT1Gku for <notmuch@notmuchmail.org>;
\r
18 Sat, 4 Feb 2012 12:44:48 -0800 (PST)
\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
20 [74.125.82.181]) (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 7DE5E431FD5
\r
23 for <notmuch@notmuchmail.org>; Sat, 4 Feb 2012 12:44:39 -0800 (PST)
\r
24 Received: by mail-we0-f181.google.com with SMTP id b10so4024656wer.26
\r
25 for <notmuch@notmuchmail.org>; Sat, 04 Feb 2012 12:44:39 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=hdkgZUlD9Zrtxj6bogYYGvCVAH67HDTxhIxsZGhOnww=;
\r
29 b=OZg3rgcmsTaFbYB9l9XIGM8gaTEz6utuMlp6kffojhY+EPB4Vh8+3soP0GrP/8W7SH
\r
30 Q0Y56paeAKcZfbXMAiIe6MKGDa/mME6jiqaqdIUMDRcGDCZUm6M3dASkLFFTIAqYOo8z
\r
31 60s4/0o4I85qEAAGocD2iOs6h203So50ZI0p0=
\r
32 Received: by 10.216.138.162 with SMTP id a34mr1189712wej.5.1328388279249;
\r
33 Sat, 04 Feb 2012 12:44:39 -0800 (PST)
\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
35 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
36 ho4sm14970370wib.3.2012.02.04.12.44.37 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sat, 04 Feb 2012 12:44:38 -0800 (PST)
\r
38 From: Mark Walters <markwalters1009@gmail.com>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v2 3/4] emacs: Improve prompting for user address when
\r
42 Date: Sat, 4 Feb 2012 20:45:16 +0000
\r
43 Message-Id: <1328388317-20161-4-git-send-email-markwalters1009@gmail.com>
\r
44 X-Mailer: git-send-email 1.7.2.3
\r
45 In-Reply-To: <1328388317-20161-1-git-send-email-markwalters1009@gmail.com>
\r
46 References: <1328388317-20161-1-git-send-email-markwalters1009@gmail.com>
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Sat, 04 Feb 2012 20:44:50 -0000
\r
61 This patch uses the new --from option to notmuch reply to allow it to
\r
62 prompt the user for the From: address in cases when the cli does not
\r
63 know the "correct" from address. If the cli does not it either uses
\r
64 the users default address or, if notmuch-always-prompt-for-sender
\r
65 is set, prompts the user.
\r
67 emacs/notmuch-mua.el | 47 ++++++++++++++++++++++++++++-------------------
\r
68 1 files changed, 28 insertions(+), 19 deletions(-)
\r
70 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
71 index 41f82c2..36e62f9 100644
\r
72 --- a/emacs/notmuch-mua.el
\r
73 +++ b/emacs/notmuch-mua.el
\r
74 @@ -51,6 +51,24 @@ list."
\r
78 +(defcustom notmuch-identities nil
\r
79 + "Identities that can be used as the From: address when composing a new message.
\r
81 +If this variable is left unset, then a list will be constructed from the
\r
82 +name and addresses configured in the notmuch configuration file."
\r
83 + :type '(repeat string)
\r
84 + :group 'notmuch-send)
\r
86 +(defcustom notmuch-always-prompt-for-sender nil
\r
87 + "Always prompt for the From: address when composing or forwarding a message.
\r
89 +This is not taken into account when replying to a message, because in that case
\r
90 +the From: header is already filled in by notmuch."
\r
92 + :group 'notmuch-send)
\r
94 +(defvar notmuch-mua-sender-history nil)
\r
96 (defun notmuch-mua-user-agent-full ()
\r
97 "Generate a `User-Agent:' string suitable for notmuch."
\r
98 (concat (notmuch-mua-user-agent-notmuch)
\r
99 @@ -75,7 +93,7 @@ list."
\r
100 (defun notmuch-mua-reply (query-string &optional sender reply-all)
\r
103 - (args '("reply")))
\r
104 + (args '("reply" "--from=fallback-received")))
\r
105 (if notmuch-show-process-crypto
\r
106 (setq args (append args '("--decrypt"))))
\r
108 @@ -99,6 +117,15 @@ list."
\r
109 ;; If sender is non-nil, set the From: header to its value.
\r
111 (mail-header-set 'from sender headers))
\r
112 + ;; If we do not have a From: header yet it means that
\r
113 + ;; notmuch-reply.c was not able to make a useful guess so we fill
\r
114 + ;; it in ourselves.
\r
115 + (when (string= "" (mail-header 'from headers))
\r
116 + (if notmuch-always-prompt-for-sender
\r
117 + (setq sender (notmuch-mua-prompt-for-sender))
\r
118 + (setq sender (concat
\r
119 + (notmuch-user-name) " <" (notmuch-user-primary-email) ">")))
\r
120 + (mail-header-set 'from sender headers))
\r
122 ;; Overlay the composition window on that being used to read
\r
123 ;; the original message.
\r
124 @@ -153,24 +180,6 @@ OTHER-ARGS are passed through to `message-mail'."
\r
128 -(defcustom notmuch-identities nil
\r
129 - "Identities that can be used as the From: address when composing a new message.
\r
131 -If this variable is left unset, then a list will be constructed from the
\r
132 -name and addresses configured in the notmuch configuration file."
\r
133 - :type '(repeat string)
\r
134 - :group 'notmuch-send)
\r
136 -(defcustom notmuch-always-prompt-for-sender nil
\r
137 - "Always prompt for the From: address when composing or forwarding a message.
\r
139 -This is not taken into account when replying to a message, because in that case
\r
140 -the From: header is already filled in by notmuch."
\r
142 - :group 'notmuch-send)
\r
144 -(defvar notmuch-mua-sender-history nil)
\r
146 (defun notmuch-mua-prompt-for-sender ()
\r
148 (let (name addresses one-name-only)
\r