Subject: Re: bug#13321: 24.3.0.50; Gmail error when replying from Gnus to github

From: Thierry Volpiatto <[email-masked]>
Date: Sat, 23 Feb 2013 11:06:19 +0100

Thierry Volpiatto <[email-masked]> writes:

> Katsumi Yamaoka <[email-masked]> writes:
>
>> [email-masked] wrote:
>>> Katsumi Yamaoka <[email-masked]> writes:
>>>> Please let me say that a wide reply doesn't contain the author
>>>> of an original mail in the recipient list is a bug.  To exclude
>>>> an invalid address from a wide reply is not a feature;
>>
>>> It is not excluded in the patch, it is added to "cc" only if "wide" is
>>> specified.
>> [...]
>>> Please have a look at the mail examples I sent in other posts.
>>
>> Hm, I haven't gotten it yet.  Could you try replying to a mail
>> attached in this message as well (copy it to a mail group and do
>> F)?
>>
>> [...]
>>> The point is that with the patch I sent + the headers of the rejected
>>> mail and the original mail where I reply to, you will be able to
>>> understand what happen and fix it.
>>
>> Ok, I'll surely try it.
>
> And you can probaly get rid of this while loop too by removing
> duplicates in first place:
>
> -	     (message-tokenize-header recipients)))
> -      ;; Remove all duplicates.
> -      (let ((s recipients))
> -	(while s
> -	  (let ((address (car (pop s))))
> -	    (while (assoc address s)
> -	      (setq recipients (delq (assoc address s) recipients)
> -		    s (delq (assoc address s) s))))))
> +	     ;; Remove all duplicates.
> +	     (loop with recip for mess in (message-tokenize-header recipients)
> +		   unless (member mess recip) collect mess into recip
> +		   finally return recip)))
>  
> NOTE: `remove-duplicates' can't be used because you require cl at compile
> time only.
And while we are at it this one also can be simpler:

-	(let ((plain-addrs (mapcar 'car recipients))
-	      subaddrs recip)
-	  (while plain-addrs
-	    (setq subaddrs (assoc (car plain-addrs)
-				  message-hierarchical-addresses)
-		  plain-addrs (cdr plain-addrs))
-	    (when subaddrs
-	      (setq subaddrs (cdr subaddrs))
-	      (while subaddrs
-		(setq recip (assoc (car subaddrs) recipients)
-		      subaddrs (cdr subaddrs))
-		(if recip
-		    (setq recipients (delq recip recipients))))))))
+        (setq recipients
+              (loop for (r . a) in recipients
+                    for assoc = (cdr (assoc r message-hierarchical-addresses))
+                    when assoc append assoc into recip
+                    unless (member r recip) collect (cons r a) into results
+                    finally return (cdr results))))

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997