From unknown Fri Jun 20 07:09:23 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#4623 <4623@debbugs.gnu.org> To: bug#4623 <4623@debbugs.gnu.org> Subject: Status: 23.1.50; rmail changes encoding of characters on save Reply-To: bug#4623 <4623@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:09:23 +0000 retitle 4623 23.1.50; rmail changes encoding of characters on save reassign 4623 emacs submitter 4623 Markus Rost severity 4623 normal thanks From rost@math.uni-bielefeld.de Sat Oct 3 07:54:46 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 3 Oct 2009 14:54:46 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA,MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n93EsiV3003140 for ; Sat, 3 Oct 2009 07:54:46 -0700 Received: from mail.gnu.org ([199.232.76.166]:35333 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Mu60R-0001sH-Tn for emacs-pretest-bug@gnu.org; Sat, 03 Oct 2009 10:54:43 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Mu60N-0001zm-1P for emacs-pretest-bug@gnu.org; Sat, 03 Oct 2009 10:54:42 -0400 Received: from mail1.math.uni-bielefeld.de ([129.70.14.32]:50517) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mu60M-0001zK-K1 for emacs-pretest-bug@gnu.org; Sat, 03 Oct 2009 10:54:38 -0400 Received: from xen12.math.uni-bielefeld.de (xen12.math.uni-bielefeld.de [129.70.14.133]) by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id 7128195A00; Sat, 3 Oct 2009 16:54:35 +0200 (CEST) Received: by xen12.math.uni-bielefeld.de (Postfix, from userid 3710) id 75D5D288A0AB; Sat, 3 Oct 2009 16:54:35 +0200 (CEST) To: emacs-pretest-bug@gnu.org Subject: 23.1.50; rmail changes encoding of characters on save From: Markus Rost Message-Id: <20091003145435.75D5D288A0AB@xen12.math.uni-bielefeld.de> Date: Sat, 3 Oct 2009 16:54:35 +0200 (CEST) X-detected-operating-system: by monty-python.gnu.org: FreeBSD 5.3-5.4 With rmail I observed random encoding changes in mbox files: some non-ascii characters are changed depending on which message you look at while saving. Providing a test case is a bit tiresome, so I omit one for now. The reason for the problem is that rmail-expunge-and-save uses the coding system of the current message when saving the file. This is certainly wrong: the coding system for writing the mbox file must not depend on the currently selected message. Since rmail reads the mbox file with coding-system 'no-conversion, it should save it with coding-system 'no-conversion. Perhaps the problem sits in rmail-swap-buffers: Shouldn't rmail-swap-buffers exchange the value of buffer-file-coding-system in both ways? Or perhaps it should ensure that the buffer which contains the full mbox file has always the same buffer-file-coding-system, namely 'no-conversion. Anyway, the following ad hoc patch fixes the problem for me. *** rmail.el.~1.552.~ 2009-09-26 21:21:07.000000000 +0200 --- rmail.el 2009-10-02 16:14:30.000000000 +0200 *************** *** 1458,1464 **** (rmail-expunge) ;; No need to swap buffers: rmail-write-region-annotate takes care of it. ;; (rmail-swap-buffers-maybe) ! (save-buffer) (if (rmail-summary-exists) (rmail-select-summary (set-buffer-modified-p nil)))) --- 1458,1465 ---- (rmail-expunge) ;; No need to swap buffers: rmail-write-region-annotate takes care of it. ;; (rmail-swap-buffers-maybe) ! (let ((coding-system-for-write 'no-conversion)) ! (save-buffer)) (if (rmail-summary-exists) (rmail-select-summary (set-buffer-modified-p nil)))) In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.16.1) of 2009-10-02 on laptop Windowing system distributor `The X.Org Foundation', version 11.0.10600000 configured using `configure '--prefix=/home/rost/local/cvs'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t From rost@math.uni-bielefeld.de Sat Oct 3 11:40:13 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 3 Oct 2009 18:40:13 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: * X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=1.7 required=4.0 tests=AWL,ONEWORD autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail1.math.uni-bielefeld.de (mail1.math.uni-bielefeld.de [129.70.14.32]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n93IeAYI007437 for <4623@emacsbugs.donarmstrong.com>; Sat, 3 Oct 2009 11:40:12 -0700 Received: from xen12.math.uni-bielefeld.de (xen12.math.uni-bielefeld.de [129.70.14.133]) by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id AFF16959CB; Sat, 3 Oct 2009 20:40:04 +0200 (CEST) Received: by xen12.math.uni-bielefeld.de (Postfix, from userid 3710) id 9CB6B288A0AB; Sat, 3 Oct 2009 20:40:04 +0200 (CEST) From: Markus Rost To: 4623@debbugs.gnu.org Subject: test X-GNU-Emacs-Mailer: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="++----------20091003201353-233902639----------++" Content-Transfer-Encoding: 7bit X-Mailer: Emacs 22.3.3 with etach 1.4.3 Message-Id: <20091003184004.9CB6B288A0AB@xen12.math.uni-bielefeld.de> Date: Sat, 3 Oct 2009 20:40:04 +0200 (CEST) This is a multi-part message in MIME format. --++----------20091003201353-233902639----------++ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Here is a test case: Attached is file inbox-mixed-charsets which contains 2 messages, one using utf-8, one with iso-latin-1 charsets. Follow the steps: C-u rmail inbox-mixed-charsets You look now at the second message. Save rmail file, kill buffer and visit again: s C-x k C-u rmail inbox-mixed-charsets First message looks like this: ... ae=\344 oe=\366 ... --++----------20091003201353-233902639----------++ Content-Type: application/octet-stream; name="inbox-mixed-charsets" Content-Transfer-Encoding: base64 RnJvbSBzb21lb25lQHNvbWV3aGVyZS5mb28ub3JnICBXZWQgQXByICAxIDIxOjMxOjMzIDIwMDkK RGF0ZTogV2VkLCAwMSBBcHIgMjAwOSAxOTozNDoxOSArMDAwMApGcm9tOiBYWVogPHNvbWVvbmVA c29tZXdoZXJlLmZvby5vcmc+ClRvOiBzb21lYm9keUBzb21ld2hlcmUuZm9vLm9yZwpTdWJqZWN0 OiB1dGYtOCBjb250ZW50CkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOAoK RGllcyBpc3QgZWluIFRlc3QgYWU9w6Qgb2U9w7YgdWU9w7wgQUU9w4QgT0U9w5YgVUU9w5wgc3o9 w58uCgp1dGYtOAoKRnJvbSBzb21lb25lQHNvbWV3aGVyZS5mb28ub3JnICBXZWQgQXByICAxIDIx OjMxOjMzIDIwMDkKRGF0ZTogV2VkLCAwMSBBcHIgMjAwOSAxOTozNDoxOSArMDAwMApGcm9tOiBY WVogPHNvbWVvbmVAc29tZXdoZXJlLmZvby5vcmc+ClRvOiBzb21lYm9keUBzb21ld2hlcmUuZm9v Lm9yZwpTdWJqZWN0OiBpc28tbGF0aW4tMSBjb250ZW50CkNvbnRlbnQtVHlwZTogdGV4dC9wbGFp bjsgY2hhcnNldD1pc28tbGF0aW4tMQoKRGllcyBpc3QgZWluIFRlc3QgYWU95CBvZT32IHVlPfwg QUU9xCBPRT3WIFVFPdwgc3o93y4KCmlzby1sYXRpbi0xCgo= --++----------20091003201353-233902639----------++-- From rgm@gnu.org Mon Oct 12 18:21:46 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 13 Oct 2009 01:21:46 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-7.4 required=4.0 tests=AWL,HAS_BUG_NUMBER, X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9D1Lj0v020606 for <4623@emacsbugs.donarmstrong.com>; Mon, 12 Oct 2009 18:21:46 -0700 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1MxW59-0005Y4-Sh; Mon, 12 Oct 2009 21:21:43 -0400 From: Glenn Morris To: Markus Rost Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save References: <20091003145435.75D5D288A0AB@xen12.math.uni-bielefeld.de> X-Spook: ANC crypto anarchy S Box JPL monarchist 2600 Magazine X-Ran: =/~?I1`w9B|UN?RPY=IUQWUVbg*[|5j@D}9`:{h]K-b.b1(r-:E04N^HR_=u0MWc3*w7E) X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 12 Oct 2009 21:21:43 -0400 In-Reply-To: <20091003145435.75D5D288A0AB@xen12.math.uni-bielefeld.de> (Markus Rost's message of "Sat, 3 Oct 2009 16:54:35 +0200 (CEST)") Message-ID: <3tfx9o142g.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Thanks for the test case. I know very little about coding issues, but if setting coding-system-for-write is the correct fix, I think it should be done in a manner similar to the following, since saving an rmail file with just "C-x C-s" should work. *** 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)) From rost@math.uni-bielefeld.de Mon Oct 12 19:16:33 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 13 Oct 2009 02:16:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-0.9 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,URIBL_CNKR autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail2.math.uni-bielefeld.de (mail2.math.uni-bielefeld.de [129.70.14.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9D2GWwf029863 for <4623@emacsbugs.donarmstrong.com>; Mon, 12 Oct 2009 19:16:33 -0700 Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134]) by mail2.math.uni-bielefeld.de (Postfix) with ESMTP id 7736B73020; Tue, 13 Oct 2009 04:16:26 +0200 (CEST) Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710) id 197A3EFB52; Tue, 13 Oct 2009 04:16:19 +0200 (CEST) From: Markus Rost To: Glenn Morris CC: 4623@debbugs.gnu.org In-reply-to: <3tfx9o142g.fsf@fencepost.gnu.org> (message from Glenn Morris on Mon, 12 Oct 2009 21:21:43 -0400) Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-GNU-Emacs-Mailer: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost References: <20091003145435.75D5D288A0AB@xen12.math.uni-bielefeld.de> <3tfx9o142g.fsf@fencepost.gnu.org> Message-Id: <20091013021619.197A3EFB52@sonic02.math.uni-bielefeld.de> Date: Tue, 13 Oct 2009 04:16:19 +0200 (CEST) The crucial thing is that the mbox file after reading and saving in rmail differs from the original file only by some headers, usually X-RMAIL-ATTRIBUTES, X-RMAIL-KEYWORDS. Your patch fixes the problem. > I think it > should be done in a manner similar to the following, since saving an > rmail file with just "C-x C-s" should work. Yes, your patch is better than my attempts, as in and at the end of However all 3 patches leave the same problem, namely that the rmail buffer gets the buffer-file-coding-system 'no-conversion. This can be easily seen from the mode line indicator ('=' instead of say '1' or 'u'). See the detailed discussion in the second part of Now this problem is of minor importance, at least I don't know of any serious effects, and refreshing the rmail buffer by hitting "Nj" (where N is the message number you are looking at) resets the buffer-file-coding-system (and the mode line indicator). One could work around this by calling (rmail-show-message rmail-current-message) after the save, although this isn't satisfactory. Anyway, I think that your patch should be installed. From rgm@gnu.org Fri Oct 16 20:12:25 2009 Received: (at 4623-done) by emacsbugs.donarmstrong.com; 17 Oct 2009 03:12:25 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-7.4 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n9H3CNI9002264 for <4623-done@emacsbugs.donarmstrong.com>; Fri, 16 Oct 2009 20:12:25 -0700 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1MyziR-0004VD-FZ; Fri, 16 Oct 2009 23:12:23 -0400 From: Glenn Morris To: 4623-done@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save References: <20091003145435.75D5D288A0AB@xen12.math.uni-bielefeld.de> <3tfx9o142g.fsf@fencepost.gnu.org> <20091013021619.197A3EFB52@sonic02.math.uni-bielefeld.de> X-Spook: STARLAN United Nations FIPS140 IMF spy $400 million in X-Ran: @s&R/h89y^lg'myZ,bE+_bMq#!ZLZ-eo7#g0!@nub`_!Hns!2f0Ch_tIMv8F&nt%q"b3(% X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Fri, 16 Oct 2009 23:12:23 -0400 Message-ID: <22r5t2emso.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Markus Rost wrote: > Anyway, I think that your patch should be installed. In the absence of any other comments on this, I did so. From unknown Fri Jun 20 07:09:23 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 14 Nov 2009 15:24:12 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From eliz@gnu.org Fri Dec 4 08:06:00 2009 Received: (at control) by emacsbugs.donarmstrong.com; 4 Dec 2009 16:06:00 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.0 required=4.0 tests=AWL,MISSING_SUBJECT,NOSUBJECT autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout23.012.net.il (mtaout23.012.net.il [80.179.55.175]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4G5wJS030937 for ; Fri, 4 Dec 2009 08:06:00 -0800 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0KU400200XWYN300@a-mtaout23.012.net.il> for control@emacsbugs.donarmstrong.com; Fri, 04 Dec 2009 18:04:52 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU400NIFY0300A0@a-mtaout23.012.net.il> for control@emacsbugs.donarmstrong.com; Fri, 04 Dec 2009 18:04:52 +0200 (IST) Date: Fri, 04 Dec 2009 18:04:46 +0200 From: Eli Zaretskii X-012-Sender: halo1@inter.net.il To: control@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <833a3qlo81.fsf@gnu.org> unarchive 4623 From eliz@gnu.org Fri Dec 4 08:36:34 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 4 Dec 2009 16:36:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.6 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 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 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) 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) Date: Fri, 04 Dec 2009 18:36:14 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-012-Sender: halo1@inter.net.il To: 4623@debbugs.gnu.org Cc: Glenn Morris Reply-to: Eli Zaretskii Message-id: <831vjalmrl.fsf@gnu.org> 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. From rgm@gnu.org Fri Dec 4 09:16:41 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 4 Dec 2009 17:16:41 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-7.1 required=4.0 tests=AWL,HAS_BUG_NUMBER, X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4HGeQW005312 for <4623@emacsbugs.donarmstrong.com>; Fri, 4 Dec 2009 09:16:41 -0800 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1NGbln-0004Y9-7T; Fri, 04 Dec 2009 12:16:39 -0500 From: Glenn Morris To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save References: <831vjalmrl.fsf@gnu.org> X-Spook: Afghanistan government Bin Laden North Korea Blowpipe X-Ran: b8Kn;nQ|~k:R8PM$9>k%G\7zMZTa+A.h`+5T$TkP7"9Wsz=HkJb\1!`6\bx93oxMkeu4T$ X-Hue: yellow X-Debbugs-No-Ack: yes X-Attribution: GM Date: Fri, 04 Dec 2009 12:16:38 -0500 In-Reply-To: <831vjalmrl.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Dec 2009 18:36:14 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Eli Zaretskii wrote: > Any ideas are welcome. If no better idea pops up very soon, I suggest > the following band-aid for Emacs 23.2: I was hoping at the time someone would comment, but no-one did. Please do whatever you think is best. > . 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 What if someone does M-x save-buffer? From monnier@iro.umontreal.ca Fri Dec 4 10:42:39 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 4 Dec 2009 18:42:39 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4IgbJa012867 for <4623@emacsbugs.donarmstrong.com>; Fri, 4 Dec 2009 10:42:38 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhgFAFLnGEtFpZ1E/2dsb2JhbACBTtVahDMEihs X-IronPort-AV: E=Sophos;i="4.47,343,1257138000"; d="scan'208";a="50699918" Received: from 69-165-157-68.dsl.teksavvy.com (HELO pastel.home) ([69.165.157.68]) by ironport2-out.pppoe.ca with ESMTP; 04 Dec 2009 13:42:31 -0500 Received: by pastel.home (Postfix, from userid 20848) id 4A90286C4; Fri, 4 Dec 2009 13:42:31 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> Date: Fri, 04 Dec 2009 13:42:31 -0500 In-Reply-To: <831vjalmrl.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Dec 2009 18:36:14 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > 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. In the above code, rmail-view-buffer is (confusingly enough) the raw-data buffer (which is why we switch to it to save the raw data), so setting coding-system-for-write in that buffer is right. The problem is that this setting is then somehow propagated to the other buffer (the one we show to the user). > Perhaps we should special-case RMAIL in save-buffer, or maybe do > something in buffer-swap-text. Most likely we need to do something in the rmail code that calls buffer-swap-text. Some debugging `message's in there showing the coding-systems in use in each buffer before and after the swap should make things more clear. Stefan From eliz@gnu.org Fri Dec 4 11:16:39 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 4 Dec 2009 19:16:39 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.6 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout22.012.net.il (mtaout22.012.net.il [80.179.55.172]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4JGbwd016475 for <4623@emacsbugs.donarmstrong.com>; Fri, 4 Dec 2009 11:16:38 -0800 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0KU5000006P40S00@a-mtaout22.012.net.il> for 4623@emacsbugs.donarmstrong.com; Fri, 04 Dec 2009 21:15:37 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU500L4R6U0UI60@a-mtaout22.012.net.il>; Fri, 04 Dec 2009 21:15:37 +0200 (IST) Date: Fri, 04 Dec 2009 21:15:03 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83y6lik0ug.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623@emacsbugs.donarmstrong.com > Date: Fri, 04 Dec 2009 13:42:31 -0500 > > Most likely we need to do something in the rmail code that calls > buffer-swap-text. Not sure what you had in mind. buffer-swap-text is not called (AFAICS) between "C-x C-s" and the return to top-level. So how can anything we do in rmail-swap-buffers help here? From monnier@iro.umontreal.ca Fri Dec 4 11:48:49 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 4 Dec 2009 19:48:49 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB4JmlUI019027 for <4623@emacsbugs.donarmstrong.com>; Fri, 4 Dec 2009 11:48:48 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhgFAHv2GEtFpZ1E/2dsb2JhbACBTtVnhDMEihs X-IronPort-AV: E=Sophos;i="4.47,343,1257138000"; d="scan'208";a="50704767" Received: from 69-165-157-68.dsl.teksavvy.com (HELO pastel.home) ([69.165.157.68]) by ironport2-out.pppoe.ca with ESMTP; 04 Dec 2009 14:48:41 -0500 Received: by pastel.home (Postfix, from userid 20848) id 7539A86CF; Fri, 4 Dec 2009 14:48:41 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> Date: Fri, 04 Dec 2009 14:48:41 -0500 In-Reply-To: <83y6lik0ug.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Dec 2009 21:15:03 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >> Most likely we need to do something in the rmail code that calls >> buffer-swap-text. > Not sure what you had in mind. buffer-swap-text is not called > (AFAICS) between "C-x C-s" and the return to top-level. So how can > anything we do in rmail-swap-buffers help here? Oh, I see, it's because setting coding-system-for-write affect the buffer-file-coding-system choice which is later saved into the "original" buffer, which in this case is the displayed buffer. Hmm... Let's take a step back: when/why does buffer-file-coding-system matter in the RMAIL display buffer? Stefan From eliz@gnu.org Sat Dec 5 04:05:42 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 5 Dec 2009 12:05:43 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.5 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5C5flo010612 for <4623@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 04:05:42 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KU600100H3VLB00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Sat, 05 Dec 2009 14:05:34 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU6000D3HL8B840@a-mtaout20.012.net.il>; Sat, 05 Dec 2009 14:05:33 +0200 (IST) Date: Sat, 05 Dec 2009 14:03:29 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83hbs5k4q6.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623@emacsbugs.donarmstrong.com > Date: Fri, 04 Dec 2009 14:48:41 -0500 > > Oh, I see, it's because setting coding-system-for-write affect the > buffer-file-coding-system choice which is later saved into the > "original" buffer, which in this case is the displayed buffer. Yes. > Let's take a step back: when/why does buffer-file-coding-system matter > in the RMAIL display buffer? Several reasons off the top of my head: . It gives you an easily visible indication of how the message was encoded. (We hide the relevant mail headers by default, so they are not visible unless you invoke rmail-toggle-header.) . It is useful when saving the current message to a file. . When replying to a message, rmail-reply uses it to set the encoding of the *mail* buffer where you compose the reply, which takes care of 99.99% of situations where the response needs to have some non-trivial encoding that is not your system's native one. The last one of these is by far the most important reason, at least in my use pattern. Maybe we need to set up an after-save-hook to restore the original encoding after saving the message collection? Btw, I find rmail-swap-buffers incomplete in its handling of encoding and the modified flag. It looks like it works by sheer luck, unless I'm missing something. I suggest the following more thorough version. If nothing else, it eliminates the need for the kludge in rmail-write-region-annotate that forces no-conversion at save-buffer time (because the encoding of the message collection buffer is now kept at no-conversion at all times): (defun rmail-swap-buffers () "Swap text between current buffer and `rmail-view-buffer'. This function preserves the buffers' modified flags, and also swaps the current buffer's `buffer-file-coding-system' with that of `rmail-view-buffer'." (let ((modp-this (buffer-modified-p)) (modp-that (with-current-buffer rmail-view-buffer (buffer-modified-p))) (coding-this buffer-file-coding-system) (coding-that (with-current-buffer rmail-view-buffer buffer-file-coding-system))) (buffer-swap-text rmail-view-buffer) (setq buffer-file-coding-system coding-that) (with-current-buffer rmail-view-buffer (setq buffer-file-coding-system coding-this) (restore-buffer-modified-p modp-that)) (restore-buffer-modified-p modp-this))) From rost@math.uni-bielefeld.de Sat Dec 5 12:11:06 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 5 Dec 2009 20:11:06 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.2 required=4.0 tests=AWL,FVGT_m_MULTI_ODD, HAS_BUG_NUMBER,MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from xen16.math.uni-bielefeld.de (xen16.math.uni-bielefeld.de [129.70.14.14]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5KB2UT024936 for <4623@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 12:11:05 -0800 Received: from ada00.math.uni-bielefeld.de (ada00.math.uni-bielefeld.de [129.70.15.245]) by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id F2EFA3000186; Sat, 5 Dec 2009 21:10:56 +0100 (CET) Received: by ada00.math.uni-bielefeld.de (Postfix, from userid 3710) id B56E31BA516; Sat, 5 Dec 2009 21:10:56 +0100 (CET) From: Markus Rost To: Eli Zaretskii CC: monnier@iro.umontreal.ca, 4623@debbugs.gnu.org In-reply-to: <83hbs5k4q6.fsf@gnu.org> (message from Eli Zaretskii on Sat, 05 Dec 2009 14:03:29 +0200) Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-Mail-Tool: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> Message-Id: <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> Date: Sat, 5 Dec 2009 21:10:56 +0100 (CET) > Btw, I find rmail-swap-buffers incomplete in its handling of encoding > and the modified flag. It looks like it works by sheer luck, unless > I'm missing something. I suggest the following more thorough version. I feel like running in circles. Eli's rmail-swap-buffers function (except for the modp-that) is in my previous post which itself mentions Eli's Oct 2008 message: See also the other messages in > Maybe we need to set up an after-save-hook to restore the original > encoding after saving the message collection? Agreed. I don't see any other way without changing files.el and fileio.c. The real problem is the buffer change in write-region-annotate-functions and this part of basic-save-buffer (setq setmodes (basic-save-buffer-1))) ;; Now we have saved the current buffer. Let's make sure ;; that buffer-file-coding-system is fixed to what ;; actually used for saving by binding it locally. (if save-buffer-coding-system (setq save-buffer-coding-system last-coding-system-used) (setq buffer-file-coding-system last-coding-system-used)) which just assumes that last-coding-system-used was used in the current buffer. This part of basic-save-buffer practically forbids a buffer change in write-region-annotate-functions. Anyway, I think that the logical way for saving in Rmail is to swap buffers back and forth and not change buffers. What about the patch below? And: Could someone change the name of the variable rmail-view-buffer? A good name is perhaps 'rmail-hold-buffer'. Also: The doc string of rmail-buffer-swapped is not helpful. What about (defvar rmail-buffer-swapped nil "If nil, `rmail-buffer' contains the actual mbox message collection") or (defvar rmail-buffer-swapped nil "If non-nil, the actual mbox message collection is in `rmail-hold-buffer'.") === Buffer *vc-diff* ======================================= *** rmail.el 05 Dec 2009 20:13:54 +0100 1.562 --- rmail.el 05 Dec 2009 20:38:06 +0100 *************** *** 1279,1284 **** --- 1279,1286 ---- (rmail-perm-variables) (rmail-variables)) + (defvar rmail-swapped-before-save nil) + (defun rmail-mode-1 () (setq major-mode 'rmail-mode) (setq mode-name "RMAIL") *************** *** 1293,1303 **** (set-syntax-table text-mode-syntax-table) (setq local-abbrev-table text-mode-abbrev-table) ;; Functions to support buffer swapping: ! (add-hook 'write-region-annotate-functions ! 'rmail-write-region-annotate nil t) (add-hook 'kill-buffer-hook 'rmail-mode-kill-buffer-hook nil t) (add-hook 'change-major-mode-hook 'rmail-change-major-mode-hook nil t)) (defun rmail-generate-viewer-buffer () "Return a reusable buffer suitable for viewing messages. Create the buffer if necessary." --- 1295,1322 ---- (set-syntax-table text-mode-syntax-table) (setq local-abbrev-table text-mode-abbrev-table) ;; Functions to support buffer swapping: ! (make-local-variable 'rmail-swapped-before-save) ! (add-hook 'before-save-hook 'rmail-swap-before-save nil t) ! (add-hook 'after-save-hook 'rmail-swap-after-save t t) (add-hook 'kill-buffer-hook 'rmail-mode-kill-buffer-hook nil t) (add-hook 'change-major-mode-hook 'rmail-change-major-mode-hook nil t)) + (defun rmail-swap-before-save () + (setq rmail-swapped-before-save nil) + (when (rmail-buffers-swapped-p) + (rmail-swap-buffers) + ;; This is probably not necssary, but let's be on the safe side. + (set (make-local-variable 'coding-system-for-write) 'no-conversion) + (setq rmail-buffer-swapped nil) + (setq rmail-swapped-before-save t) + (widen))) + + (defun rmail-swap-after-save () + (when rmail-swapped-before-save + (rmail-swap-buffers) + (setq rmail-buffer-swapped t) + (setq rmail-swapped-before-save nil))) + (defun rmail-generate-viewer-buffer () "Return a reusable buffer suitable for viewing messages. Create the buffer if necessary." *************** *** 1313,1328 **** (defun rmail-swap-buffers () "Swap text between current buffer and `rmail-view-buffer'. ! This function preserves the current buffer's modified flag, and also ! sets the current buffer's `buffer-file-coding-system' to that of ! `rmail-view-buffer'." ! (let ((modp (buffer-modified-p)) ! (coding (with-current-buffer rmail-view-buffer buffer-file-coding-system))) (buffer-swap-text rmail-view-buffer) ! (setq buffer-file-coding-system coding) ! (restore-buffer-modified-p modp))) (defun rmail-buffers-swapped-p () "Return non-nil if the message collection is in `rmail-view-buffer'." --- 1332,1353 ---- (defun rmail-swap-buffers () "Swap text between current buffer and `rmail-view-buffer'. ! This function preserves the buffers' modified flags, and also ! swaps the current buffer's `buffer-file-coding-system' with that ! of `rmail-view-buffer'." ! (let ((modp-this (buffer-modified-p)) ! (modp-that ! (with-current-buffer rmail-view-buffer (buffer-modified-p))) ! (coding-this buffer-file-coding-system) ! (coding-that (with-current-buffer rmail-view-buffer buffer-file-coding-system))) (buffer-swap-text rmail-view-buffer) ! (setq buffer-file-coding-system coding-that) ! (with-current-buffer rmail-view-buffer ! (setq buffer-file-coding-system coding-this) ! (restore-buffer-modified-p modp-that)) ! (restore-buffer-modified-p modp-this))) (defun rmail-buffers-swapped-p () "Return non-nil if the message collection is in `rmail-view-buffer'." *************** *** 1470,1477 **** (interactive) (set-buffer rmail-buffer) (rmail-expunge) - ;; No need to swap buffers: rmail-write-region-annotate takes care of it. - ;; (rmail-swap-buffers-maybe) (save-buffer) (if (rmail-summary-exists) (rmail-select-summary (set-buffer-modified-p nil)))) --- 1495,1500 ---- *************** *** 4179,4194 **** (add-to-list 'desktop-buffer-mode-handlers '(rmail-mode . rmail-restore-desktop-buffer)) - ;; Used in `write-region-annotate-functions' to write rmail files. - (defun rmail-write-region-annotate (start end) - (when (and (null start) (rmail-buffers-swapped-p)) - (set-buffer rmail-view-buffer) - ;; Prevent viewing different messages from messing up the coding. (Bug#4623) - ;; FIXME is there a better solution? - (set (make-local-variable 'coding-system-for-write) 'no-conversion) - (widen) - nil)) - ;;; Start of automatically extracted autoloads. --- 4202,4207 ---- ============================================================ From eliz@gnu.org Sat Dec 5 13:55:33 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 5 Dec 2009 21:55:33 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.5 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5LtV67004957 for <4623@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 13:55:33 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KU7000008NUEX00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Sat, 05 Dec 2009 23:54:58 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU700NX68VK3920@a-mtaout20.012.net.il>; Sat, 05 Dec 2009 23:54:57 +0200 (IST) Date: Sat, 05 Dec 2009 23:52:54 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> X-012-Sender: halo1@inter.net.il To: Markus Rost Cc: monnier@iro.umontreal.ca, 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <837ht1jdft.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> > From: Markus Rost > CC: monnier@iro.umontreal.ca, 4623@emacsbugs.donarmstrong.com > Date: Sat, 5 Dec 2009 21:10:56 +0100 (CET) > > > Btw, I find rmail-swap-buffers incomplete in its handling of encoding > > and the modified flag. It looks like it works by sheer luck, unless > > I'm missing something. I suggest the following more thorough version. > > I feel like running in circles. Nah, it just means good ideas never die, they just get reborn ;-) > What about the patch below? I think it goes a tad too far. What I had in mind was way simpler: record the encoding of the current message inside rmail-show-message, then restore it in after-save-hook. Stefan, I surely would like to hear from you on this one, the 23.2 release branch being so close. From rost@math.uni-bielefeld.de Sat Dec 5 14:37:34 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 5 Dec 2009 22:37:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.3 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from xen16.math.uni-bielefeld.de (xen16.math.uni-bielefeld.de [129.70.14.14]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5MbWp1009965 for <4623@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 14:37:34 -0800 Received: from ada00.math.uni-bielefeld.de (ada00.math.uni-bielefeld.de [129.70.15.245]) by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id 5FFC43000186; Sat, 5 Dec 2009 23:37:27 +0100 (CET) Received: by ada00.math.uni-bielefeld.de (Postfix, from userid 3710) id 4E9CB1BA516; Sat, 5 Dec 2009 23:37:27 +0100 (CET) From: Markus Rost To: Eli Zaretskii CC: monnier@iro.umontreal.ca, 4623@debbugs.gnu.org In-reply-to: <837ht1jdft.fsf@gnu.org> (message from Eli Zaretskii on Sat, 05 Dec 2009 23:52:54 +0200) Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-Mail-Tool: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> Message-Id: <20091205223727.4E9CB1BA516@ada00.math.uni-bielefeld.de> Date: Sat, 5 Dec 2009 23:37:27 +0100 (CET) > I think it goes a tad too far. What I had in mind was way simpler: I tried a bit by just adding something to after-save-hook. But I ran into problems with C-u g (rmail-get-new-mail from some file). > record the encoding of the current message inside rmail-show-message, > then restore it in after-save-hook. I didn't try that. Maybe that could work. Actually, in the end my patch was meant to be simple and safe. Its changes can't be wrong (in the sense: I proved the code is correct, but didn't try it..., or just a few times). It implements your version of rmail-swap-buffers, which can't be wrong. It removes switching buffers in write-region-annotate-functions, which is wrong. The buffer swapping with before/after-save-hook was at first meant as a brutal but safe kludge, but on second thought it looks very natural to me. From eliz@gnu.org Sat Dec 5 20:14:23 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 6 Dec 2009 04:14:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.5 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB64ELHj017504 for <4623@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 20:14:23 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KU700E00QDNBB00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Sun, 06 Dec 2009 06:13:02 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU700DDDQDPZS20@a-mtaout20.012.net.il>; Sun, 06 Dec 2009 06:13:01 +0200 (IST) Date: Sun, 06 Dec 2009 06:10:56 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: <20091205223727.4E9CB1BA516@ada00.math.uni-bielefeld.de> X-012-Sender: halo1@inter.net.il To: Markus Rost Cc: monnier@iro.umontreal.ca, 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <834oo4kai7.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <20091205223727.4E9CB1BA516@ada00.math.uni-bielefeld.de> > From: Markus Rost > CC: monnier@iro.umontreal.ca, 4623@emacsbugs.donarmstrong.com > Date: Sat, 5 Dec 2009 23:37:27 +0100 (CET) > > Actually, in the end my patch was meant to be simple and safe. I didn't say it wasn't. I just think that 2 days before the feature freeze, we need to find a solution that modifies the current code as little as possible. The current code has survived since the pretest of v23.1, and changing it significantly would be unsafe and could be justifiably voted down by Stefan and Yidong. From rost@math.uni-bielefeld.de Sun Dec 6 06:40:23 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 6 Dec 2009 14:40:24 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.3 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail1.math.uni-bielefeld.de (mail1.math.uni-bielefeld.de [129.70.14.32]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB6EeLEb030872 for <4623@emacsbugs.donarmstrong.com>; Sun, 6 Dec 2009 06:40:23 -0800 Received: from ada00.math.uni-bielefeld.de (ada00.math.uni-bielefeld.de [129.70.15.245]) by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id 3C119959D6; Sun, 6 Dec 2009 15:40:16 +0100 (CET) Received: by ada00.math.uni-bielefeld.de (Postfix, from userid 3710) id 377111BA334; Sun, 6 Dec 2009 15:40:16 +0100 (CET) From: Markus Rost To: Eli Zaretskii CC: monnier@iro.umontreal.ca, 4623@debbugs.gnu.org In-reply-to: <834oo4kai7.fsf@gnu.org> (message from Eli Zaretskii on Sun, 06 Dec 2009 06:10:56 +0200) Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-Mail-Tool: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <20091205223727.4E9CB1BA516@ada00.math.uni-bielefeld.de> <834oo4kai7.fsf@gnu.org> Message-Id: <20091206144016.377111BA334@ada00.math.uni-bielefeld.de> Date: Sun, 6 Dec 2009 15:40:16 +0100 (CET) > I just think that 2 days before the feature > freeze, I didn't know it is so close. > changing it significantly would be unsafe Indeed: rmail-write-region-annotate is also in rmail-edit-mode in rmailedit.el. From eliz@gnu.org Sun Dec 6 11:19:52 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 6 Dec 2009 19:19:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,FOURLA,FVGT_m_MULTI_ODD, HAS_BUG_NUMBER,MURPHY_SEX_L2 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout22.012.net.il (mtaout22.012.net.il [80.179.55.172]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB6JJoG7001742 for <4623@emacsbugs.donarmstrong.com>; Sun, 6 Dec 2009 11:19:51 -0800 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0KU800G00W04RZ00@a-mtaout22.012.net.il> for 4623@emacsbugs.donarmstrong.com; Sun, 06 Dec 2009 21:19:07 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU800E62WBS9W90@a-mtaout22.012.net.il>; Sun, 06 Dec 2009 21:19:04 +0200 (IST) Date: Sun, 06 Dec 2009 21:17:03 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: <837ht1jdft.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: 4623@debbugs.gnu.org Cc: rost@math.uni-bielefeld.de Reply-to: Eli Zaretskii Message-id: <83zl5vj4k0.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> > Date: Sat, 05 Dec 2009 23:52:54 +0200 > From: Eli Zaretskii > Cc: 4623@emacsbugs.donarmstrong.com > > I think it goes a tad too far. What I had in mind was way simpler: > record the encoding of the current message inside rmail-show-message, > then restore it in after-save-hook. Here's what I came up with. This is relative to current CVS. It seems to work, but I'd appreciate more testing. Markus, could you please see if it works for you? TIA Index: lisp/mail/rmail.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/mail/rmail.el,v retrieving revision 1.562 diff -u -r1.562 rmail.el --- lisp/mail/rmail.el 4 Dec 2009 05:00:47 -0000 1.562 +++ lisp/mail/rmail.el 6 Dec 2009 19:16:05 -0000 @@ -642,6 +642,9 @@ (defvar rmail-enable-mime-composing nil "*If non-nil, RMAIL uses `rmail-insert-mime-forwarded-message-function' to forward.") +;; We use this to record the encoding of the last displayed message. +(defvar rmail-message-encoding nil) + ;; FIXME unused. (defvar rmail-show-mime-function nil "Function to show MIME decoded message of RMAIL file. @@ -1316,13 +1319,19 @@ This function preserves the current buffer's modified flag, and also sets the current buffer's `buffer-file-coding-system' to that of `rmail-view-buffer'." - (let ((modp (buffer-modified-p)) - (coding + (let ((modp-this (buffer-modified-p)) + (modp-that + (with-current-buffer rmail-view-buffer (buffer-modified-p))) + (coding-this buffer-file-coding-system) + (coding-that (with-current-buffer rmail-view-buffer buffer-file-coding-system))) (buffer-swap-text rmail-view-buffer) - (setq buffer-file-coding-system coding) - (restore-buffer-modified-p modp))) + (setq buffer-file-coding-system coding-that) + (with-current-buffer rmail-view-buffer + (setq buffer-file-coding-system coding-this) + (restore-buffer-modified-p modp-that)) + (restore-buffer-modified-p modp-this))) (defun rmail-buffers-swapped-p () "Return non-nil if the message collection is in `rmail-view-buffer'." @@ -2748,6 +2757,7 @@ (rmail-highlight-headers) ;(rmail-activate-urls) ;(rmail-process-quoted-material) + (setq rmail-message-encoding buffer-file-coding-system) ) ;; Update the mode-line with message status information and swap ;; the view buffer/mail buffer contents. @@ -4185,10 +4195,20 @@ (set-buffer rmail-view-buffer) ;; Prevent viewing different messages from messing up the coding. (Bug#4623) ;; FIXME is there a better solution? - (set (make-local-variable 'coding-system-for-write) 'no-conversion) + ;(set (make-local-variable 'coding-system-for-write) 'no-conversion) (widen) nil)) +;; Used to restore the encoding of the buffer where we show the +;; current message. +(defun rmail-after-save-hook () + (if (or (eq rmail-view-buffer (current-buffer)) + (eq rmail-buffer (current-buffer))) + (with-current-buffer + (if (rmail-buffers-swapped-p) rmail-buffer rmail-view-buffer) + (setq buffer-file-coding-system rmail-message-encoding)))) +(add-hook 'after-save-hook 'rmail-after-save-hook) + ;;; Start of automatically extracted autoloads. From rost@math.uni-bielefeld.de Sun Dec 6 12:23:57 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 6 Dec 2009 20:23:57 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.3 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from xen16.math.uni-bielefeld.de (xen16.math.uni-bielefeld.de [129.70.14.14]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB6KNtun010083 for <4623@emacsbugs.donarmstrong.com>; Sun, 6 Dec 2009 12:23:57 -0800 Received: from ada00.math.uni-bielefeld.de (ada00.math.uni-bielefeld.de [129.70.15.245]) by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id F04CF30072BD; Sun, 6 Dec 2009 21:23:48 +0100 (CET) Received: by ada00.math.uni-bielefeld.de (Postfix, from userid 3710) id C2EEB1BA334; Sun, 6 Dec 2009 21:23:48 +0100 (CET) From: Markus Rost To: Eli Zaretskii CC: 4623@debbugs.gnu.org In-reply-to: <83zl5vj4k0.fsf@gnu.org> (message from Eli Zaretskii on Sun, 06 Dec 2009 21:17:03 +0200) Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-Mail-Tool: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <83zl5vj4k0.fsf@gnu.org> Message-Id: <20091206202348.C2EEB1BA334@ada00.math.uni-bielefeld.de> Date: Sun, 6 Dec 2009 21:23:48 +0100 (CET) > Here's what I came up with. You are a Master of the Universe. Once rmail-swap-buffers is set up correctly, things get much simpler. I tested: The old bug is still gone, and problems which I encountered during my own hacking don't show up. One minor thing: Since rmail-message-encoding is a global variable, several Rmail buffers may interfere. If you have displayed a message in buffer A with encoding A (so rmail-message-encoding is set to A) and you switch to a modified Rmail buffer B and save that buffer, then the message in buffer B gets encoding A. Only temporarily of course, as before. I don't suggest to fix that now. Perhaps one could put a note in the code. From eliz@gnu.org Sun Dec 6 20:06:43 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 04:06:43 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.5 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB746fWW002571 for <4623@emacsbugs.donarmstrong.com>; Sun, 6 Dec 2009 20:06:43 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KU900100KPAZN00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Mon, 07 Dec 2009 06:06:35 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KU900LASKQZSJD0@a-mtaout20.012.net.il>; Mon, 07 Dec 2009 06:06:35 +0200 (IST) Date: Mon, 07 Dec 2009 06:04:34 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: <20091206202348.C2EEB1BA334@ada00.math.uni-bielefeld.de> X-012-Sender: halo1@inter.net.il To: Markus Rost Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83y6lfig4t.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <83zl5vj4k0.fsf@gnu.org> <20091206202348.C2EEB1BA334@ada00.math.uni-bielefeld.de> > From: Markus Rost > CC: 4623@emacsbugs.donarmstrong.com > Date: Sun, 6 Dec 2009 21:23:48 +0100 (CET) > > One minor thing: Since rmail-message-encoding is a global variable, > several Rmail buffers may interfere. Right, I didn't think abut that possibility. I will try to think about some simple solution. Thanks for testing. Unless someone objects, I will commit these changes (suitably cleaned up) by today's evening. From monnier@iro.umontreal.ca Sun Dec 6 20:35:03 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 04:35:05 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.5 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB74Z1ac005018 for <4623@emacsbugs.donarmstrong.com>; Sun, 6 Dec 2009 20:35:03 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArcEAIcUHEtMCrV1/2dsb2JhbACBTNRhg0ppBIoe X-IronPort-AV: E=Sophos;i="4.47,352,1257138000"; d="scan'208";a="50818505" Received: from 76-10-181-117.dsl.teksavvy.com (HELO pastel.home) ([76.10.181.117]) by ironport2-out.pppoe.ca with ESMTP; 06 Dec 2009 23:34:55 -0500 Received: by pastel.home (Postfix, from userid 20848) id 0C5A180B4; Sun, 6 Dec 2009 23:34:55 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> Date: Sun, 06 Dec 2009 23:34:55 -0500 In-Reply-To: <83hbs5k4q6.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Dec 2009 14:03:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > Several reasons off the top of my head: > . It gives you an easily visible indication of how the message was > encoded. (We hide the relevant mail headers by default, so they > are not visible unless you invoke rmail-toggle-header.) So it's abusing buffer-file-coding-system for "message-coding-system" (which of course is only meaningful is the message is not made up of various parts using different coding-systems). > . It is useful when saving the current message to a file. Good point. > . When replying to a message, rmail-reply uses it to set the > encoding of the *mail* buffer where you compose the reply, which > takes care of 99.99% of situations where the response needs to > have some non-trivial encoding that is not your system's native > one. rmail-replay doesn't need to use buffer-file-coding-system for that, but could just as well use some other variable for it, right? > The last one of these is by far the most important reason, at least in > my use pattern. Then it's easy to fix. > Maybe we need to set up an after-save-hook to restore the original > encoding after saving the message collection? That would be fine, yes. I'd suggest to use an rmail-coding-system variable as the canonical place to store the coding system used for the currently shown message, use it in rmail-reply in preference to buffer-file-coding-system, and simply copy rmail-coding-system to buffer-file-coding-system whenever necessary, such as in after-save-hook. > Btw, I find rmail-swap-buffers incomplete in its handling of encoding > and the modified flag. It looks like it works by sheer luck, unless > I'm missing something. Could be. I really think the first thing that needs to be done is to get rid of Rmail's constant swapping of those buffers. There should be one swap when entering rmail-mode and one more when(if) leaving it, no more. That will get us rid of most of that insanity. Stefan From eliz@gnu.org Mon Dec 7 11:01:21 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 19:01:21 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7J1JRJ030850 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 11:01:20 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KUA00F00PZ9QB00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Mon, 07 Dec 2009 21:01:13 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUA009JEQ5Z2BH0@a-mtaout20.012.net.il>; Mon, 07 Dec 2009 21:01:12 +0200 (IST) Date: Mon, 07 Dec 2009 20:59:12 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83ws0yipa7.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623@emacsbugs.donarmstrong.com > Date: Sun, 06 Dec 2009 23:34:55 -0500 > > > . When replying to a message, rmail-reply uses it to set the > > encoding of the *mail* buffer where you compose the reply, which > > takes care of 99.99% of situations where the response needs to > > have some non-trivial encoding that is not your system's native > > one. > > rmail-replay doesn't need to use buffer-file-coding-system for that, but > could just as well use some other variable for it, right? If that variable is set correctly, sure. However, buffer-file-coding-system has the advantage that it is already prominently shown in the mode line. > > Maybe we need to set up an after-save-hook to restore the original > > encoding after saving the message collection? > > That would be fine, yes. I'd suggest to use an rmail-coding-system > variable as the canonical place to store the coding system used for the > currently shown message, use it in rmail-reply in preference to > buffer-file-coding-system, and simply copy rmail-coding-system to > buffer-file-coding-system whenever necessary, such as in > after-save-hook. Well, I did precisely that, as you could see, but then Markus pointed out that a single global variable will not work when there are more than one Rmail buffer. I will post a slightly improved patch soon that hopefully will take care of that as well. From eliz@gnu.org Mon Dec 7 11:25:08 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 19:25:08 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,FVGT_m_MULTI_ODD, HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7JP6qE001509 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 11:25:08 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KUA00G00R4FLW00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Mon, 07 Dec 2009 21:24:30 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUA00DAKR8S2MA0@a-mtaout20.012.net.il>; Mon, 07 Dec 2009 21:24:30 +0200 (IST) Date: Mon, 07 Dec 2009 21:22:29 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: <83y6lfig4t.fsf@gnu.org> X-012-Sender: halo1@inter.net.il To: 4623@debbugs.gnu.org Cc: rost@math.uni-bielefeld.de Reply-to: Eli Zaretskii Message-id: <83vdgiio7e.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <83zl5vj4k0.fsf@gnu.org> <20091206202348.C2EEB1BA334@ada00.math.uni-bielefeld.de> <83y6lfig4t.fsf@gnu.org> > Date: Mon, 07 Dec 2009 06:04:34 +0200 > From: Eli Zaretskii > Cc: 4623@emacsbugs.donarmstrong.com > > > From: Markus Rost > > CC: 4623@emacsbugs.donarmstrong.com > > Date: Sun, 6 Dec 2009 21:23:48 +0100 (CET) > > > > One minor thing: Since rmail-message-encoding is a global variable, > > several Rmail buffers may interfere. > > Right, I didn't think abut that possibility. I will try to think > about some simple solution. I think I found it. If we have to live with rmail-write-region-annotate, we might as well have it do something useful: Index: lisp/mail/rmail.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/mail/rmail.el,v retrieving revision 1.562 diff -u -r1.562 rmail.el --- lisp/mail/rmail.el 4 Dec 2009 05:00:47 -0000 1.562 +++ lisp/mail/rmail.el 7 Dec 2009 19:14:23 -0000 @@ -1316,13 +1316,19 @@ This function preserves the current buffer's modified flag, and also sets the current buffer's `buffer-file-coding-system' to that of `rmail-view-buffer'." - (let ((modp (buffer-modified-p)) - (coding + (let ((modp-this (buffer-modified-p)) + (modp-that + (with-current-buffer rmail-view-buffer (buffer-modified-p))) + (coding-this buffer-file-coding-system) + (coding-that (with-current-buffer rmail-view-buffer buffer-file-coding-system))) (buffer-swap-text rmail-view-buffer) - (setq buffer-file-coding-system coding) - (restore-buffer-modified-p modp))) + (setq buffer-file-coding-system coding-that) + (with-current-buffer rmail-view-buffer + (setq buffer-file-coding-system coding-this) + (restore-buffer-modified-p modp-that)) + (restore-buffer-modified-p modp-this))) (defun rmail-buffers-swapped-p () "Return non-nil if the message collection is in `rmail-view-buffer'." @@ -4179,16 +4185,31 @@ (add-to-list 'desktop-buffer-mode-handlers '(rmail-mode . rmail-restore-desktop-buffer)) +;; We use this to record the encoding of the current message before +;; saving the message collection. +(defvar rmail-message-encoding nil) + ;; Used in `write-region-annotate-functions' to write rmail files. (defun rmail-write-region-annotate (start end) (when (and (null start) (rmail-buffers-swapped-p)) + (setq rmail-message-encoding buffer-file-coding-system) (set-buffer rmail-view-buffer) - ;; Prevent viewing different messages from messing up the coding. (Bug#4623) - ;; FIXME is there a better solution? - (set (make-local-variable 'coding-system-for-write) 'no-conversion) (widen) nil)) +;; Used to restore the encoding of the buffer where we show the +;; current message, after we save the message collection. This is +;; needed because rmail-write-region-annotate switches buffers behind +;; save-file's back, with the side effect that last-coding-system-used +;; is assigned to buffer-file-coding-system of the wrong buffer. +(defun rmail-after-save-hook () + (if (or (eq rmail-view-buffer (current-buffer)) + (eq rmail-buffer (current-buffer))) + (with-current-buffer + (if (rmail-buffers-swapped-p) rmail-buffer rmail-view-buffer) + (setq buffer-file-coding-system rmail-message-encoding)))) +(add-hook 'after-save-hook 'rmail-after-save-hook) + ;;; Start of automatically extracted autoloads. From monnier@faina.iro.umontreal.ca Mon Dec 7 11:25:40 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 19:25:41 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.8 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from pruche.dit.umontreal.ca (pruche.dit.umontreal.ca [132.204.246.22]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7JPcac001847 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 11:25:40 -0800 Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nB7JPbqB030900; Mon, 7 Dec 2009 14:25:37 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id B8BE53A122; Mon, 7 Dec 2009 14:25:37 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> Date: Mon, 07 Dec 2009 14:25:37 -0500 In-Reply-To: <83ws0yipa7.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 07 Dec 2009 20:59:12 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3422=0 >> That would be fine, yes. I'd suggest to use an rmail-coding-system >> variable as the canonical place to store the coding system used for the >> currently shown message, use it in rmail-reply in preference to >> buffer-file-coding-system, and simply copy rmail-coding-system to >> buffer-file-coding-system whenever necessary, such as in >> after-save-hook. > Well, I did precisely that, as you could see, but then Markus pointed > out that a single global variable will not work when there are more > than one Rmail buffer. Of course, just like buffer-file-coding-system, it should be buffer-local. Stefan From rost@math.uni-bielefeld.de Mon Dec 7 11:50:43 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 19:50:43 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.4 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail1.math.uni-bielefeld.de (mail1.math.uni-bielefeld.de [129.70.14.32]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7JoffR004107 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 11:50:43 -0800 Received: from ada00.math.uni-bielefeld.de (ada00.math.uni-bielefeld.de [129.70.15.245]) by mail1.math.uni-bielefeld.de (Postfix) with ESMTP id EFE73959B5; Mon, 7 Dec 2009 20:50:35 +0100 (CET) Received: by ada00.math.uni-bielefeld.de (Postfix, from userid 3710) id E7F561BA52D; Mon, 7 Dec 2009 20:50:35 +0100 (CET) From: Markus Rost To: Eli Zaretskii CC: 4623@debbugs.gnu.org In-reply-to: <83vdgiio7e.fsf@gnu.org> (message from Eli Zaretskii on Mon, 07 Dec 2009 21:22:29 +0200) Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save X-Mail-Tool: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <83zl5vj4k0.fsf@gnu.org> <20091206202348.C2EEB1BA334@ada00.math.uni-bielefeld.de> <83y6lfig4t.fsf@gnu.org> <83vdgiio7e.fsf@gnu.org> Message-Id: <20091207195035.E7F561BA52D@ada00.math.uni-bielefeld.de> Date: Mon, 7 Dec 2009 20:50:35 +0100 (CET) > I think I found it. Yes. With the new rmail-swap-buffers one can rely on the correct values of buffer-file-coding-system in the rmail and rmail-view buffers at all times -- and use them. I tested the new patch. It works for me. From eliz@gnu.org Mon Dec 7 11:53:49 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 19:53:50 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7JrmFb004190 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 11:53:49 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KUA00H00SFQQJ00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Mon, 07 Dec 2009 21:53:41 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUA00FRLSLG5760@a-mtaout20.012.net.il>; Mon, 07 Dec 2009 21:53:41 +0200 (IST) Date: Mon, 07 Dec 2009 21:51:40 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: <20091207195035.E7F561BA52D@ada00.math.uni-bielefeld.de> X-012-Sender: halo1@inter.net.il To: Markus Rost Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83skbmimur.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <20091205201056.B56E31BA516@ada00.math.uni-bielefeld.de> <837ht1jdft.fsf@gnu.org> <83zl5vj4k0.fsf@gnu.org> <20091206202348.C2EEB1BA334@ada00.math.uni-bielefeld.de> <83y6lfig4t.fsf@gnu.org> <83vdgiio7e.fsf@gnu.org> <20091207195035.E7F561BA52D@ada00.math.uni-bielefeld.de> > From: Markus Rost > CC: 4623@emacsbugs.donarmstrong.com > Date: Mon, 7 Dec 2009 20:50:35 +0100 (CET) > > I tested the new patch. It works for me. Thanks, committed. From eliz@gnu.org Mon Dec 7 11:56:58 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 19:56:58 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout23.012.net.il (mtaout23.012.net.il [80.179.55.175]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7Juufp004604 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 11:56:57 -0800 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0KUA00800SOXNQ00@a-mtaout23.012.net.il> for 4623@emacsbugs.donarmstrong.com; Mon, 07 Dec 2009 21:55:58 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUA004OOSP8SM90@a-mtaout23.012.net.il>; Mon, 07 Dec 2009 21:55:57 +0200 (IST) Date: Mon, 07 Dec 2009 21:53:57 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83r5r6imqy.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623@emacsbugs.donarmstrong.com > Date: Mon, 07 Dec 2009 14:25:37 -0500 > > > Well, I did precisely that, as you could see, but then Markus pointed > > out that a single global variable will not work when there are more > > than one Rmail buffer. > > Of course, just like buffer-file-coding-system, it should be buffer-local. Yes, I thought about that at first. But this solution complicates things because of the swapping. So I went for a slightly different one, which stashes the encoding immediately prior to switching to the ``other'' buffer. This makes sure we have always the correct encoding. From monnier@faina.iro.umontreal.ca Mon Dec 7 13:44:27 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 7 Dec 2009 21:44:27 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.8 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from pruche.dit.umontreal.ca (pruche.dit.umontreal.ca [132.204.246.22]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7LiONl014780 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 13:44:26 -0800 Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nB7LiOE2004982; Mon, 7 Dec 2009 16:44:24 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 144913A122; Mon, 7 Dec 2009 16:44:24 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> <83r5r6imqy.fsf@gnu.org> Date: Mon, 07 Dec 2009 16:44:24 -0500 In-Reply-To: <83r5r6imqy.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 07 Dec 2009 21:53:57 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3422=0 > Yes, I thought about that at first. But this solution complicates > things because of the swapping. As I said: we should first fix the swapping madness. Stefan From eliz@gnu.org Mon Dec 7 20:17:14 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 8 Dec 2009 04:17:14 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB84HCVK025391 for <4623@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 20:17:14 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KUB00D00FN9LX00@a-mtaout20.012.net.il> for 4623@emacsbugs.donarmstrong.com; Tue, 08 Dec 2009 06:16:44 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUB00AA0FVVPNA0@a-mtaout20.012.net.il>; Tue, 08 Dec 2009 06:16:44 +0200 (IST) Date: Tue, 08 Dec 2009 06:14:44 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83my1uhzkb.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> <83r5r6imqy.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623@emacsbugs.donarmstrong.com > Date: Mon, 07 Dec 2009 16:44:24 -0500 > > > Yes, I thought about that at first. But this solution complicates > > things because of the swapping. > > As I said: we should first fix the swapping madness. Not sure how you propose to do that. All users of rmail-swap-buffers do that because they need to do something with the entire message collection. From monnier@iro.umontreal.ca Tue Dec 8 05:47:28 2009 Received: (at 4623) by emacsbugs.donarmstrong.com; 8 Dec 2009 13:47:29 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.5 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB8DlRZC017929 for <4623@emacsbugs.donarmstrong.com>; Tue, 8 Dec 2009 05:47:28 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao4FACboHUvO+INN/2dsb2JhbACBTNY4hDIEih8 X-IronPort-AV: E=Sophos;i="4.47,362,1257138000"; d="scan'208";a="50986227" Received: from 206-248-131-77.dsl.teksavvy.com (HELO pastel.home) ([206.248.131.77]) by ironport2-out.pppoe.ca with ESMTP; 08 Dec 2009 08:47:21 -0500 Received: by pastel.home (Postfix, from userid 20848) id 3701F80B4; Tue, 8 Dec 2009 08:47:21 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> <83r5r6imqy.fsf@gnu.org> <83my1uhzkb.fsf@gnu.org> Date: Tue, 08 Dec 2009 08:47:21 -0500 In-Reply-To: <83my1uhzkb.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Dec 2009 06:14:44 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >> > Yes, I thought about that at first. But this solution complicates >> > things because of the swapping. >> As I said: we should first fix the swapping madness. > Not sure how you propose to do that. All users of rmail-swap-buffers > do that because they need to do something with the entire message > collection. There's no need to swap buffers for that, there's with-current-buffer. I know it's not as simple as that because they may also need to access buffer-local variables. Stefan From eliz@gnu.org Tue Dec 8 10:57:25 2009 Received: (at 4623-done) by emacsbugs.donarmstrong.com; 8 Dec 2009 18:57:26 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.4 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout23.012.net.il (mtaout23.012.net.il [80.179.55.175]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB8IvNon021811 for <4623-done@emacsbugs.donarmstrong.com>; Tue, 8 Dec 2009 10:57:25 -0800 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0KUC00E00KDK4S00@a-mtaout23.012.net.il> for 4623-done@emacsbugs.donarmstrong.com; Tue, 08 Dec 2009 20:57:15 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUC00E3LKNEBW00@a-mtaout23.012.net.il>; Tue, 08 Dec 2009 20:57:15 +0200 (IST) Date: Tue, 08 Dec 2009 20:55:16 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623-done@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <83ljhdi9d7.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> <83r5r6imqy.fsf@gnu.org> <83my1uhzkb.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623@emacsbugs.donarmstrong.com > Date: Tue, 08 Dec 2009 08:47:21 -0500 > > There's no need to swap buffers for that, there's with-current-buffer. > I know it's not as simple as that because they may also need to access > buffer-local variables. Exactly. Figuring all that out is hardly a feature-freeze day job. I'm closing this bug. From monnier@iro.umontreal.ca Tue Dec 8 17:43:48 2009 Received: (at 4623-done) by emacsbugs.donarmstrong.com; 9 Dec 2009 01:43:48 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.5 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB91hkkc032304 for <4623-done@emacsbugs.donarmstrong.com>; Tue, 8 Dec 2009 17:43:47 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvAEAK6PHkvO+INN/2dsb2JhbACBTNZ8hDIEih8 X-IronPort-AV: E=Sophos;i="4.47,365,1257138000"; d="scan'208";a="51071279" Received: from 206-248-131-77.dsl.teksavvy.com (HELO ceviche.home) ([206.248.131.77]) by ironport2-out.pppoe.ca with ESMTP; 08 Dec 2009 20:43:41 -0500 Received: by ceviche.home (Postfix, from userid 20848) id D3CA1B4206; Tue, 8 Dec 2009 20:43:39 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Cc: 4623-done@debbugs.gnu.org Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save Message-ID: References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> <83r5r6imqy.fsf@gnu.org> <83my1uhzkb.fsf@gnu.org> <83ljhdi9d7.fsf@gnu.org> Date: Tue, 08 Dec 2009 20:43:39 -0500 In-Reply-To: <83ljhdi9d7.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Dec 2009 20:55:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >> There's no need to swap buffers for that, there's with-current-buffer. >> I know it's not as simple as that because they may also need to access >> buffer-local variables. > Exactly. Figuring all that out is hardly a feature-freeze day job. Agreed, but it has to be done at some point, so even if it's not installed right away, now is a very good time to start working on it. This problem was already present in Emacs-23.1 and I already mentioned it several times back then. We installed hacks ack then to patch up the most glaring problems introduced and we keep adding such hacks, which just makes the whole code every time less maintainable. Stefan From eliz@gnu.org Fri Dec 11 04:12:14 2009 Received: (at 4623-done) by emacsbugs.donarmstrong.com; 11 Dec 2009 12:12:15 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.6 required=4.0 tests=AWL,HAS_BUG_NUMBER, RCVD_IN_NIX1 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mtaout20.012.net.il (mtaout20.012.net.il [80.179.55.166]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nBBCCDKu022536 for <4623-done@emacsbugs.donarmstrong.com>; Fri, 11 Dec 2009 04:12:14 -0800 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0KUH00400LQ11X00@a-mtaout20.012.net.il> for 4623-done@emacsbugs.donarmstrong.com; Fri, 11 Dec 2009 14:12:07 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.126.213.252]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KUH00N74LW52VC0@a-mtaout20.012.net.il>; Fri, 11 Dec 2009 14:12:06 +0200 (IST) Date: Fri, 11 Dec 2009 14:10:10 +0200 From: Eli Zaretskii Subject: Re: bug#4623: 23.1.50; rmail changes encoding of characters on save In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Cc: 4623-done@debbugs.gnu.org Reply-to: Eli Zaretskii Message-id: <838wd990f1.fsf@gnu.org> References: <831vjalmrl.fsf@gnu.org> <83y6lik0ug.fsf@gnu.org> <83hbs5k4q6.fsf@gnu.org> <83ws0yipa7.fsf@gnu.org> <83r5r6imqy.fsf@gnu.org> <83my1uhzkb.fsf@gnu.org> <83ljhdi9d7.fsf@gnu.org> > From: Stefan Monnier > Cc: 4623-done@emacsbugs.donarmstrong.com > Date: Tue, 08 Dec 2009 20:43:39 -0500 > > >> There's no need to swap buffers for that, there's with-current-buffer. > >> I know it's not as simple as that because they may also need to access > >> buffer-local variables. > > Exactly. Figuring all that out is hardly a feature-freeze day job. > > Agreed, but it has to be done at some point, so even if it's not > installed right away, now is a very good time to start working on it. I filed a bug report about this. From unknown Fri Jun 20 07:09:23 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 08 Jan 2010 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator