From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#4623: 23.1.50; rmail changes encoding of characters on save Date: Fri, 04 Dec 2009 18:36:14 +0200 Message-ID: <831vjalmrl.fsf@gnu.org> Reply-To: Eli Zaretskii , 4623@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1259945341 25685 80.91.229.12 (4 Dec 2009 16:49:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Dec 2009 16:49:01 +0000 (UTC) To: 4623@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 04 17:48:54 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NGbKr-00035A-GJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Dec 2009 17:48:49 +0100 Original-Received: from localhost ([127.0.0.1]:37221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGbKr-0005fi-1v for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Dec 2009 11:48:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGbJb-0004id-LB for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 11:47:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGbJX-0004gN-Ou for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 11:47:31 -0500 Original-Received: from [199.232.76.173] (port=35643 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGbJX-0004gG-J6 for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 11:47:27 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:39426) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NGbJX-00067R-59 for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2009 11:47:27 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4GlOXu002018; Fri, 4 Dec 2009 08:47:24 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nB4Gj4jd001693; Fri, 4 Dec 2009 08:45:04 -0800 Resent-Date: Fri, 4 Dec 2009 08:45:04 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Eli Zaretskii Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 04 Dec 2009 16:45:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4623 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4623-submit@emacsbugs.donarmstrong.com id=B4623.12599445941126 (code B ref 4623); Fri, 04 Dec 2009 16:45:04 +0000 Original-Received: (at 4623) by emacsbugs.donarmstrong.com; 4 Dec 2009 16:36:34 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mtaout21.012.net.il (mtaout21.012.net.il [80.179.55.169]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4GaWtC001120 for <4623@emacsbugs.donarmstrong.com>; Fri, 4 Dec 2009 08:36:33 -0800 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0KU400B00Z6R0400@a-mtaout21.012.net.il> for 4623@emacsbugs.donarmstrong.com; Fri, 04 Dec 2009 18:36:25 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU400AW2ZGP7Q30@a-mtaout21.012.net.il>; Fri, 04 Dec 2009 18:36:25 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 04 Dec 2009 11:47:31 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:33204 Archived-At: The cure for this bug, viz. *** rmail.el 6 Oct 2009 06:40:40 -0000 1.554 --- rmail.el 13 Oct 2009 01:17:20 -0000 *************** *** 4176,4181 **** --- 4176,4182 ---- (defun rmail-write-region-annotate (start end) (when (and (null start) (rmail-buffers-swapped-p)) (set-buffer rmail-view-buffer) + (set (make-local-variable 'coding-system-for-write) 'no-conversion) (widen) nil)) is IMO not much better than the disease: now C-x C-s _always_ leaves the RMAIL buffer in no-conversion state, until you display a message, e.g., with "M-n". I think this happens because the above sets the encoding of rmail-view-buffer, where we display the messages, to no-conversion. I'm not sure how to solve this. What is needed is bind coding-system-for-write to no-conversion just for the duration of save-buffer or write-region that it calls eventually. But because we use annotations to switch the buffer behind save-buffer's back, there's no easy way of doing that. Perhaps we should special-case RMAIL in save-buffer, or maybe do something in buffer-swap-text. Any ideas are welcome. If no better idea pops up very soon, I suggest the following band-aid for Emacs 23.2: . don't set coding-system-for-write in rmail-write-region-annotate . bind C-x C-s in Rmail mode to a special command, like rmail-save, which will bind coding-system-for-write to no-conversion . wrap all instances of save-buffer in Rmail with a form that let-binds coding-system-for-write to no-conversion This will at least plumb the problem in 99% of use cases, I think.