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 47DDA431FC3
\r
6 for <notmuch@notmuchmail.org>; Sat, 4 Feb 2012 09:08:31 -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 AF+z8u0e4Fma for <notmuch@notmuchmail.org>;
\r
18 Sat, 4 Feb 2012 09:08:30 -0800 (PST)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.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 E8AE6431FBF
\r
23 for <notmuch@notmuchmail.org>; Sat, 4 Feb 2012 09:08:29 -0800 (PST)
\r
24 Received: by mail-wi0-f181.google.com with SMTP id hi8so3640758wib.26
\r
25 for <notmuch@notmuchmail.org>; Sat, 04 Feb 2012 09:08:29 -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=MOSCVPvnT2NoYjKz8tkZERmb+gbyFLIdDkppTE9BMh4XRQxJgnpZrWMx6X8q8dwDRQ
\r
30 X2gt10DQ+G1juacJEv7/UvITH38BWBbOhaU6DVqIjAP/sbsHxIXCT7gY6+qrU+9pWKnt
\r
31 scdNd8dg6THKKmylMbKQUkj4rtZTSxolJoVJE=
\r
32 Received: by 10.180.92.229 with SMTP id cp5mr1183901wib.8.1328375309799;
\r
33 Sat, 04 Feb 2012 09:08:29 -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 fv6sm28660983wib.8.2012.02.04.09.08.28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sat, 04 Feb 2012 09:08:29 -0800 (PST)
\r
38 From: Mark Walters <markwalters1009@gmail.com>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 2/2] emacs: Improve prompting for user address when replying.
\r
41 Date: Sat, 4 Feb 2012 17:09:10 +0000
\r
42 Message-Id: <1328375350-10352-3-git-send-email-markwalters1009@gmail.com>
\r
43 X-Mailer: git-send-email 1.7.2.3
\r
44 In-Reply-To: <1328375350-10352-1-git-send-email-markwalters1009@gmail.com>
\r
45 References: <1328375350-10352-1-git-send-email-markwalters1009@gmail.com>
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Sat, 04 Feb 2012 17:08:31 -0000
\r
60 This patch uses the new --from option to notmuch reply to allow it to
\r
61 prompt the user for the From: address in cases when the cli does not
\r
62 know the "correct" from address. If the cli does not it either uses
\r
63 the users default address or, if notmuch-always-prompt-for-sender
\r
64 is set, prompts the user.
\r
66 emacs/notmuch-mua.el | 47 ++++++++++++++++++++++++++++-------------------
\r
67 1 files changed, 28 insertions(+), 19 deletions(-)
\r
69 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
70 index 41f82c2..36e62f9 100644
\r
71 --- a/emacs/notmuch-mua.el
\r
72 +++ b/emacs/notmuch-mua.el
\r
73 @@ -51,6 +51,24 @@ list."
\r
77 +(defcustom notmuch-identities nil
\r
78 + "Identities that can be used as the From: address when composing a new message.
\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 + :type '(repeat string)
\r
83 + :group 'notmuch-send)
\r
85 +(defcustom notmuch-always-prompt-for-sender nil
\r
86 + "Always prompt for the From: address when composing or forwarding a message.
\r
88 +This is not taken into account when replying to a message, because in that case
\r
89 +the From: header is already filled in by notmuch."
\r
91 + :group 'notmuch-send)
\r
93 +(defvar notmuch-mua-sender-history nil)
\r
95 (defun notmuch-mua-user-agent-full ()
\r
96 "Generate a `User-Agent:' string suitable for notmuch."
\r
97 (concat (notmuch-mua-user-agent-notmuch)
\r
98 @@ -75,7 +93,7 @@ list."
\r
99 (defun notmuch-mua-reply (query-string &optional sender reply-all)
\r
102 - (args '("reply")))
\r
103 + (args '("reply" "--from=fallback-received")))
\r
104 (if notmuch-show-process-crypto
\r
105 (setq args (append args '("--decrypt"))))
\r
107 @@ -99,6 +117,15 @@ list."
\r
108 ;; If sender is non-nil, set the From: header to its value.
\r
110 (mail-header-set 'from sender headers))
\r
111 + ;; If we do not have a From: header yet it means that
\r
112 + ;; notmuch-reply.c was not able to make a useful guess so we fill
\r
113 + ;; it in ourselves.
\r
114 + (when (string= "" (mail-header 'from headers))
\r
115 + (if notmuch-always-prompt-for-sender
\r
116 + (setq sender (notmuch-mua-prompt-for-sender))
\r
117 + (setq sender (concat
\r
118 + (notmuch-user-name) " <" (notmuch-user-primary-email) ">")))
\r
119 + (mail-header-set 'from sender headers))
\r
121 ;; Overlay the composition window on that being used to read
\r
122 ;; the original message.
\r
123 @@ -153,24 +180,6 @@ OTHER-ARGS are passed through to `message-mail'."
\r
127 -(defcustom notmuch-identities nil
\r
128 - "Identities that can be used as the From: address when composing a new message.
\r
130 -If this variable is left unset, then a list will be constructed from the
\r
131 -name and addresses configured in the notmuch configuration file."
\r
132 - :type '(repeat string)
\r
133 - :group 'notmuch-send)
\r
135 -(defcustom notmuch-always-prompt-for-sender nil
\r
136 - "Always prompt for the From: address when composing or forwarding a message.
\r
138 -This is not taken into account when replying to a message, because in that case
\r
139 -the From: header is already filled in by notmuch."
\r
141 - :group 'notmuch-send)
\r
143 -(defvar notmuch-mua-sender-history nil)
\r
145 (defun notmuch-mua-prompt-for-sender ()
\r
147 (let (name addresses one-name-only)
\r