[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rmail and the raw-text coding system
From: |
Mark Lillibridge |
Subject: |
Re: Rmail and the raw-text coding system |
Date: |
Tue, 18 Jan 2011 21:16:31 -0800 |
> >> 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
- Rmail and the raw-text coding system, Mark Lillibridge, 2011/01/14
- Re: Rmail and the raw-text coding system, Stefan Monnier, 2011/01/14
- Re: Rmail and the raw-text coding system, Mark Lillibridge, 2011/01/14
- Re: Rmail and the raw-text coding system, Stefan Monnier, 2011/01/14
- Re: Rmail and the raw-text coding system, Mark Lillibridge, 2011/01/16
- Re: Rmail and the raw-text coding system, Stefan Monnier, 2011/01/17
- Re: Rmail and the raw-text coding system, Mark Lillibridge, 2011/01/17
- Re: Rmail and the raw-text coding system, Stefan Monnier, 2011/01/17
- Re: Rmail and the raw-text coding system,
Mark Lillibridge <=