unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Lillibridge <mark.lillibridge@hp.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Rmail and the raw-text coding system
Date: Tue, 18 Jan 2011 21:16:31 -0800	[thread overview]
Message-ID: <qmhpqrth3rk.fsf@hp.com> (raw)
In-Reply-To: <jwvipxn3r37.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Mon, 17 Jan 2011 21:05:15 -0500)


>  >> 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



      reply	other threads:[~2011-01-19  5:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 18:14 Rmail and the raw-text coding system Mark Lillibridge
2011-01-14 21:00 ` Stefan Monnier
2011-01-15  0:06   ` Mark Lillibridge
2011-01-15  2:55     ` Stefan Monnier
2011-01-16 22:11       ` Mark Lillibridge
2011-01-17 19:19         ` Stefan Monnier
2011-01-17 22:31           ` Mark Lillibridge
2011-01-18  2:05             ` Stefan Monnier
2011-01-19  5:16               ` Mark Lillibridge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=qmhpqrth3rk.fsf@hp.com \
    --to=mark.lillibridge@hp.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).