Subject: Re: bug#25645: reproducer?

From: Eli Zaretskii <[email-masked]>
Date: Wed, 04 Oct 2017 12:27:04 +0300

> From: Alex Bennée <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 04 Oct 2017 09:46:17 +0100
> 
> > A stab in the dark: what if you filter out message-default-charset
> > from the cloned locals?
> 
> Good guess:
> 
> (defun message-clone-locals (buffer &optional varstr)
>   "Clone the local variables from BUFFER to the current buffer."
>   (message "message-clone-locals: %s" buffer)
>   (let ((locals (with-current-buffer buffer (buffer-local-variables)))
> 	(regexp "^gnus\\|^nn\\|^message\\|^sendmail\\|^smtp\\|^user-mail-address"))
>     (mapcar
>      (lambda (local)
>        (when (and (consp local)
> 		  (car local)
> 		  (string-match regexp (symbol-name (car local)))
> 		  (or (null varstr)
> 		      (string-match varstr (symbol-name (car local)))))
> 	 (ignore-errors
>            (unless (string-match "message-default-charset" (symbol-name (car local)))
>              (message "copying: %s -> %s" (car local) (cdr local))
> 	     (set (make-local-variable (car local))
> 		  (cdr local))))))
>      locals)))
> 
> Although I feel a slightly neater solution is needed.

Hmm... what is non-neat about this one?  The existing filtering
already includes quite a bit of ad-hoc'ery.

> So is the problem we are attempting to double encode an already encoded
> buffer or something else?

Something like that.  I could look deeper, if needed, but frankly the
thick forest of Gnus encoding-related stuff is not something I like to
wander into.  It's easy to break things there because effects are not
localized.

Thanks.