unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] emacs: Improve prompting for user address when replying.
Date: Sat, 04 Feb 2012 19:12:28 +0000	[thread overview]
Message-ID: <87haz6h0pv.fsf@qmul.ac.uk> (raw)
In-Reply-To: <87ipjmo4ri.fsf@nikula.org>


On Sat, 04 Feb 2012 20:03:13 +0200, Jani Nikula <jani@nikula.org> wrote:
> On Sat,  4 Feb 2012 17:09:10 +0000, Mark Walters <markwalters1009@gmail.com> 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

      reply	other threads:[~2012-02-04 19:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-04 17:09 [PATCH 0/2] Control guessing of the from-address when replying Mark Walters
2012-02-04 17:09 ` [PATCH 1/2] cli: add --from option to reply to restrict guessing of the From: header Mark Walters
2012-02-04 17:59   ` Jani Nikula
2012-02-04 19:07     ` Mark Walters
2012-02-04 17:09 ` [PATCH 2/2] emacs: Improve prompting for user address when replying Mark Walters
2012-02-04 18:03   ` Jani Nikula
2012-02-04 19:12     ` Mark Walters [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87haz6h0pv.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).