Unintuitive behaviour with find-file and empty files.

Aidan Kehoe <[email protected]> Thu, 8 Jul 2004 09:26:59 +0100
Newsgroups gmane.emacs.xemacs.mule
Message-ID <[email protected]>
Hi!

Consider the following;=20

;; [1]
(setq-default buffer-file-coding-system 'hz-gb-2312)

;; [2]
(find-file "/tmp/not-previously-existing" 'iso-8859-2)
(set-buffer "not-previously-existing")
;; [3]
(insert (format "C with caron: %c\n" (make-char 'latin-iso8859-2 #xc8)))
(save-buffer)
(kill-buffer "not-previously-existing")

[1] is intended to emulate the situation where someone's default-buffer
file-coding-system can't cover a character that's inserted into a
buffer. [2] creates a buffer corresponding to a file that does not yet ex=
ist
on disk; if it had previously existed on disk, then the second argument t=
o
find-file would have been taken note of, but in this case, it's ignored.=20

At point [3], buffer-file-coding-system is hz-gb-2312, not iso-8859-2, wh=
ich
I, at least, would na=C3=AFvely expect. IMHO, this isn't very intuitive
behaviour; is there a good reason for it?

Take care,=20

	- Aidan
--=20
I don't care if it rains or freezes/'Long as I got my Plastic Jesus
Riding on the dashboard of my car.