From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Lillibridge Newsgroups: gmane.emacs.devel Subject: Re: Rmail and the raw-text coding system Date: Tue, 18 Jan 2011 21:16:31 -0800 Message-ID: References: Reply-To: mark.lillibridge@hp.com NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1295414214 9951 80.91.229.12 (19 Jan 2011 05:16:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 19 Jan 2011 05:16:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 19 06:16:50 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PfQPX-0000oP-Cl for ged-emacs-devel@m.gmane.org; Wed, 19 Jan 2011 06:16:47 +0100 Original-Received: from localhost ([127.0.0.1]:58397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfQPU-0006Er-FW for ged-emacs-devel@m.gmane.org; Wed, 19 Jan 2011 00:16:44 -0500 Original-Received: from [140.186.70.92] (port=59365 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfQPP-0006El-LS for emacs-devel@gnu.org; Wed, 19 Jan 2011 00:16:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfQPO-0006Tr-KV for emacs-devel@gnu.org; Wed, 19 Jan 2011 00:16:39 -0500 Original-Received: from madara.hpl.hp.com ([192.6.19.124]:51895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfQPO-0006Tm-8W for emacs-devel@gnu.org; Wed, 19 Jan 2011 00:16:38 -0500 Original-Received: from mailhub-pa1.hpl.hp.com (mailhub-pa1.hpl.hp.com [15.25.115.25]) by madara.hpl.hp.com (8.14.3/8.14.3/HPL-PA Relay) with ESMTP id p0J5GXSa015947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 18 Jan 2011 21:16:33 -0800 Original-Received: from ts-rhel5 (ts-rhel5.hpl.hp.com [15.25.118.27]) by mailhub-pa1.hpl.hp.com (8.14.3/8.14.3/HPL-PA Hub) with ESMTP id p0J5GVDY001975; Tue, 18 Jan 2011 21:16:31 -0800 In-reply-to: (message from Stefan Monnier on Mon, 17 Jan 2011 21:05:15 -0500) X-Scanned-By: MIMEDefang 2.69 on 15.0.152.124 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134724 Archived-At: > >> But AFAIK BABYL files use a single encoding for the whole file, and > >> since around Emacs-21.x that single encoding is supposed to be > >> emacs-mule (and I seem to remember that the BABYL file is supposed to > >> contain an annotation at the very beginning saying it's using > >> emacs-mule, if so). > > > Arguably, it is a Rmail 22 bug that some BABYL files are encoded > > using raw-text. > > So you're saying that when Emacs-22 wrote those files, it used raw-text? > And that Emacs-22's Rmail reads those files properly? > And that Emacs-22's Rmail reads those files with raw-text? yes, yes, and yes. The Rmail 22 reading code uses: (unless (and coding-system (coding-system-p coding-system)) (setq coding-system ;; Emacs 21.1 and later writes RMAIL files in emacs-mule, but ;; earlier versions did that with the current buffer's encoding. ;; So we want to favor detection of emacs-mule (whose normal ;; priority is quite low), but still allow detection of other ;; encodings if emacs-mule won't fit. The call to ;; detect-coding-with-priority below achieves that. (car (detect-coding-with-priority from to '((coding-category-emacs-mule . emacs-mule)))))) (unless (memq coding-system '(undecided undecided-unix)) (set-buffer-modified-p t) ; avoid locking when decoding (let ((buffer-undo-list t)) (decode-coding-region from to coding-system)) (setq coding-system last-coding-system-used)) (set-buffer-modified-p modifiedp) (setq buffer-file-coding-system nil) (setq save-buffer-coding-system (or coding-system 'undecided)))) If the file doesn't appear be valid emacs-mule, it tries raw-text and succeeds (I think all files are valid raw-text). On write, it ends up using undecided-unix (see above), which uses raw-text because the buffer cannot be written in emacs-mule validly for some reason. Weird code points? Thus, it both reads and writes using raw-text, preserving the contents of the buffer so long as we don't upgrade to version 23. - Mark