unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: Adam Wolfe Gordon <awg+notmuch@xvx.ca>, notmuch@notmuchmail.org
Subject: Re: [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2
Date: Sat, 31 Mar 2012 10:13:53 +0100	[thread overview]
Message-ID: <87k42116b2.fsf@qmul.ac.uk> (raw)
In-Reply-To: <1333038410-17927-2-git-send-email-awg+notmuch@xvx.ca>

Adam Wolfe Gordon <awg+notmuch@xvx.ca> writes:

> The new reply code used strings instead of symbols for header names,
> which message-mail is OK with on emacs 23.3, but not 23.2. The symptom
> is that on 23.2 (and presumably on earlier versions) the reply message
> would end up with two of some headers.
>
> This fixes the problem by converting the header names to symbols of
> the type message.el usually expects before passing the headers to
> message-mail.

A few minor comments:

I think this code applies on top of   
  id:"1332941635-21019-2-git-send-email-awg+notmuch@xvx.ca" and 
  id:"1332941635-21019-3-git-send-email-awg+notmuch@xvx.ca"

Secondly it seems a little odd that the second patch above changes the
header stuff from 'From to "From" and then this patch changes it back
again. This is probably only a matter of a tidy history but I have to
admit I am confused about why the reply from alternate address still
works (but it does seem to)

Finally, there is a trailing white-space in the second patch in this
series.

Best wishes

Mark

> ---
>  emacs/notmuch-lib.el |    7 +++++--
>  emacs/notmuch-mua.el |   12 ++++++------
>  2 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index c146748..0effe24 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -232,9 +232,12 @@ the given type."
>    (or (plist-get part :content)
>        (notmuch-get-bodypart-internal (concat "id:" (plist-get msg :id)) nth process-crypto)))
>  
> -(defun notmuch-plist-to-alist (plist)
> +;; Converts a plist of headers to an alist of headers. The input plist should
> +;; have symbols of the form :Header as keys, and the resulting alist will have
> +;; symbols of the form 'Header as keys.
> +(defun notmuch-headers-plist-to-alist (plist)
>    (loop for (key value . rest) on plist by #'cddr
> -	collect (cons (substring (symbol-name key) 1) value)))
> +	collect (cons (intern (substring (symbol-name key) 1)) value)))
>  
>  ;; Compatibility functions for versions of emacs before emacs 23.
>  ;;
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 9805d79..cfa3d61 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -127,7 +127,7 @@ list."
>  	  ((same-window-regexps '("\\*mail .*")))
>  	(notmuch-mua-mail (plist-get reply-headers :To)
>  			  (plist-get reply-headers :Subject)
> -			  (notmuch-plist-to-alist reply-headers)))
> +			  (notmuch-headers-plist-to-alist reply-headers)))
>        ;; Insert the message body - but put it in front of the signature
>        ;; if one is present
>        (goto-char (point-max))
> @@ -185,11 +185,11 @@ OTHER-ARGS are passed through to `message-mail'."
>    (when notmuch-mua-user-agent-function
>      (let ((user-agent (funcall notmuch-mua-user-agent-function)))
>        (when (not (string= "" user-agent))
> -	(push (cons "User-Agent" user-agent) other-headers))))
> +	(push (cons 'User-Agent user-agent) other-headers))))
>  
> -  (unless (assoc "From" other-headers)
> -    (push (cons "From" (concat
> -			(notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))
> +  (unless (assq 'From other-headers)
> +    (push (cons 'From (concat
> +		       (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))
>  
>    (apply #'message-mail to subject other-headers other-args)
>    (message-sort-headers)
> @@ -250,7 +250,7 @@ the From: address first."
>    (interactive "P")
>    (let ((other-headers
>  	 (when (or prompt-for-sender notmuch-always-prompt-for-sender)
> -	   (list (cons "From" (notmuch-mua-prompt-for-sender))))))
> +	   (list (cons 'From (notmuch-mua-prompt-for-sender))))))
>      (notmuch-mua-mail nil nil other-headers)))
>  
>  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)
> -- 
> 1.7.5.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2012-03-31  9:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29 16:26 [BUG/PATCH v2 0/2] emacs: Yesterday's bugfixes Adam Wolfe Gordon
2012-03-29 16:26 ` [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2 Adam Wolfe Gordon
2012-03-31  9:13   ` Mark Walters [this message]
2012-03-31 23:36     ` Adam Wolfe Gordon
2012-03-29 16:26 ` [BUG/PATCH v2 2/2] emacs: Fix the References header in reply Adam Wolfe Gordon
2012-03-29 18:14 ` [BUG/PATCH v2 0/2] emacs: Yesterday's bugfixes Austin Clements
2012-03-29 20:22   ` Jameson Graef Rollins

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=87k42116b2.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=awg+notmuch@xvx.ca \
    --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).