From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28671: 25.2; double transfer-encoding in rmailedit for complex mime messages Date: Mon, 02 Oct 2017 19:37:55 +0300 Message-ID: <834lrh33q4.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1506962362 22231 195.159.176.226 (2 Oct 2017 16:39:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 2 Oct 2017 16:39:22 +0000 (UTC) Cc: kdo@cosmos.phy.tufts.edu, 28671@debbugs.gnu.org To: Ken Olum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 02 18:39:17 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz3kP-0004mJ-BW for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Oct 2017 18:39:13 +0200 Original-Received: from localhost ([::1]:53341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz3kU-0006Aw-WB for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Oct 2017 12:39:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz3kH-000679-Ue for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 12:39:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz3kE-0006YY-Rh for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 12:39:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dz3kE-0006YE-O1 for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 12:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dz3kE-0005y2-EH for bug-gnu-emacs@gnu.org; Mon, 02 Oct 2017 12:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Oct 2017 16:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28671 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28671-submit@debbugs.gnu.org id=B28671.150696231922904 (code B ref 28671); Mon, 02 Oct 2017 16:39:02 +0000 Original-Received: (at 28671) by debbugs.gnu.org; 2 Oct 2017 16:38:39 +0000 Original-Received: from localhost ([127.0.0.1]:44422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz3jr-0005xM-Fo for submit@debbugs.gnu.org; Mon, 02 Oct 2017 12:38:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz3jq-0005x9-89 for 28671@debbugs.gnu.org; Mon, 02 Oct 2017 12:38:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz3jh-0005id-TL for 28671@debbugs.gnu.org; Mon, 02 Oct 2017 12:38:33 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz3jR-0005S5-Dl; Mon, 02 Oct 2017 12:38:13 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2067 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dz3jQ-00032w-Q8; Mon, 02 Oct 2017 12:38:13 -0400 In-reply-to: (message from Ken Olum on Mon, 02 Oct 2017 11:37:46 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137789 Archived-At: > From: Ken Olum > Date: Mon, 02 Oct 2017 11:37:46 -0400 > Cc: kdo@cosmos.phy.tufts.edu > > When rmail-edit-current-message gets a mime message which is too complex > for it to handle (i.e., anything but one "text/plain" part), it just > gives you the raw message to edit. If you do so, rmail-cease-edit then > applies the transfer-encoding even though the message wasn't decoded, > and so on. It also in some circumstances it also moves the marker for > the beginning of the following message. > > The attached patch modifies rmail-cease-edit to check the > rmail-old-mime-state flag set by rmail-edit-current-message when it is > editing the raw message. If set, rmail-cease-edit inserts the > already-encoded body without further processing. It also deletes the > old body after inserting the new, rather than before, to avoid moving > the next message's marker. Thanks. Could you please send a small mbox file which could be used to reproduce the problem and test the solution? A couple of minor comments to the patch: > ;; Re-apply content-transfer-encoding, if any, on the message body. > - (cond > - ((string= character-coding "quoted-printable") > - (mail-quote-printable-region start (point-max))) > - ((and (string= character-coding "base64") is-text-message) > - (base64-encode-region start (point-max))) > - ((and (eq character-coding 'uuencode) is-text-message) > - (error "uuencoded messages are not supported"))) > + (unless mime-state ; if set, already transfer-encoded > + (cond > + ((string= character-coding "quoted-printable") > + (mail-quote-printable-region start end)) > + ((and (string= character-coding "base64") is-text-message) > + (base64-encode-region start end)) > + ((and (eq character-coding 'uuencode) is-text-message) > + (error "uuencoded messages are not supported")))) You could easily make the change less intrusive by simply adding the mime-state condition as the first alternative in 'cond' with no action, right? Also, please add a commit log message for the changes formatted as a ChangeLog entry (e.g., using "C-x 4 a").