Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8BCD2431FAF for ; Sat, 4 Feb 2012 11:11:25 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b8aG2iGrKKgn for ; Sat, 4 Feb 2012 11:11:24 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id EBFAC431FBC for ; Sat, 4 Feb 2012 11:11:20 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1Rtl15-0002yS-4v; Sat, 04 Feb 2012 19:11:19 +0000 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1Rtl14-000355-Lk; Sat, 04 Feb 2012 19:11:19 +0000 From: Mark Walters To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] emacs: Improve prompting for user address when replying. In-Reply-To: <87ipjmo4ri.fsf@nikula.org> References: <1328375350-10352-1-git-send-email-markwalters1009@gmail.com> <1328375350-10352-3-git-send-email-markwalters1009@gmail.com> <87ipjmo4ri.fsf@nikula.org> User-Agent: Notmuch/0.11+152~g4d737cf (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Sat, 04 Feb 2012 19:12:28 +0000 Message-ID: <87haz6h0pv.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 94.192.233.223 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 0ba94740333f809189eafa56aec07388 (of first 20000 bytes) X-SpamAssassin-Score: -1.8 X-SpamAssassin-SpamBar: - X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -1.8 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay * domain * 0.5 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2012 19:11:25 -0000 On Sat, 04 Feb 2012 20:03:13 +0200, Jani Nikula wrote: > On Sat, 4 Feb 2012 17:09:10 +0000, Mark Walters wrote: > > This patch uses the new --from option to notmuch reply to allow it to > > prompt the user for the From: address in cases when the cli does not > > know the "correct" from address. If the cli does not it either uses > > the users default address or, if notmuch-always-prompt-for-sender > > is set, prompts the user. > > --- > > emacs/notmuch-mua.el | 47 ++++++++++++++++++++++++++++------------------- > > 1 files changed, 28 insertions(+), 19 deletions(-) > > > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > > index 41f82c2..36e62f9 100644 > > --- a/emacs/notmuch-mua.el > > +++ b/emacs/notmuch-mua.el > > @@ -51,6 +51,24 @@ list." > > > > ;; > > > > +(defcustom notmuch-identities nil > > + "Identities that can be used as the From: address when composing a new message. > > + > > +If this variable is left unset, then a list will be constructed from the > > +name and addresses configured in the notmuch configuration file." > > + :type '(repeat string) > > + :group 'notmuch-send) > > + > > +(defcustom notmuch-always-prompt-for-sender nil > > + "Always prompt for the From: address when composing or forwarding a message. > > + > > +This is not taken into account when replying to a message, because in that case > > +the From: header is already filled in by notmuch." > > + :type 'boolean > > + :group 'notmuch-send) > > + > > +(defvar notmuch-mua-sender-history nil) > > + > > (defun notmuch-mua-user-agent-full () > > "Generate a `User-Agent:' string suitable for notmuch." > > (concat (notmuch-mua-user-agent-notmuch) > > @@ -75,7 +93,7 @@ list." > > (defun notmuch-mua-reply (query-string &optional sender reply-all) > > (let (headers > > body > > - (args '("reply"))) > > + (args '("reply" "--from=fallback-received"))) > > There are better reviewers for the rest of the emacs bits, but wouldn't > it be better to just use the "notmuch reply" default when the user wants > the current behaviour? Does any user actually want to be prompted for a From address when mailing/forwarding normally but not when replying and there is no reason to choose one address over another? What I would actually like is to consolidate the From address choosing so that it occurs in one place in the emacs code, so the three (mail/forward/reply) naturally behave the same. Thanks for the rapid review (and the significant bug catch!) Best wishes Mark > BR, > Jani. > > > > (if notmuch-show-process-crypto > > (setq args (append args '("--decrypt")))) > > (if reply-all > > @@ -99,6 +117,15 @@ list." > > ;; If sender is non-nil, set the From: header to its value. > > (when sender > > (mail-header-set 'from sender headers)) > > + ;; If we do not have a From: header yet it means that > > + ;; notmuch-reply.c was not able to make a useful guess so we fill > > + ;; it in ourselves. > > + (when (string= "" (mail-header 'from headers)) > > + (if notmuch-always-prompt-for-sender > > + (setq sender (notmuch-mua-prompt-for-sender)) > > + (setq sender (concat > > + (notmuch-user-name) " <" (notmuch-user-primary-email) ">"))) > > + (mail-header-set 'from sender headers)) > > (let > > ;; Overlay the composition window on that being used to read > > ;; the original message. > > @@ -153,24 +180,6 @@ OTHER-ARGS are passed through to `message-mail'." > > > > (message-goto-to)) > > > > -(defcustom notmuch-identities nil > > - "Identities that can be used as the From: address when composing a new message. > > - > > -If this variable is left unset, then a list will be constructed from the > > -name and addresses configured in the notmuch configuration file." > > - :type '(repeat string) > > - :group 'notmuch-send) > > - > > -(defcustom notmuch-always-prompt-for-sender nil > > - "Always prompt for the From: address when composing or forwarding a message. > > - > > -This is not taken into account when replying to a message, because in that case > > -the From: header is already filled in by notmuch." > > - :type 'boolean > > - :group 'notmuch-send) > > - > > -(defvar notmuch-mua-sender-history nil) > > - > > (defun notmuch-mua-prompt-for-sender () > > (interactive) > > (let (name addresses one-name-only) > > -- > > 1.7.2.3 > > > > _______________________________________________ > > notmuch mailing list > > notmuch@notmuchmail.org > > http://notmuchmail.org/mailman/listinfo/notmuch