Dear XEmacs developers,
In latest 21.5, I found a serious problem that the function
`insert-file-contents' will not refer to the coding-system magic
cookie in the beginning of a file as follows:
;;; -*- mode: emacs-lisp; coding: iso-2022-7bit -*-
This kind of file may contain some strings in various languages.
We might not be abel to read such a file using
`insert-file-contents' (and possibly `read'), because the
function will use the coding-system `raw-text' for reading if it
failed to determine the proper coding-system.
Here is an emergency patch for it. I will take back this patch
if there is a better way.
2001-08-27 Katsumi Yamaoka <yamaoka(a)jpl.org>
* code-files.el (insert-file-contents): Use
`find-coding-system-magic-cookie-in-file'.
--- code-files.el~ Sun May 6 21:53:35 2001
+++ code-files.el Mon Aug 27 10:49:09 2001
@@ -329,7 +329,8 @@
3. The matching value for this filename from
`file-coding-system-alist', if any.
4. `buffer-file-coding-system-for-read', if non-nil.
-5. The coding system 'raw-text.
+5. The result of `find-coding-system-magic-cookie-in-file'.
+6. The coding system 'raw-text.
If a local value for `buffer-file-coding-system' in the current buffer
does not exist, it is set to the coding system which was actually used
@@ -358,6 +359,11 @@
;; #4.
buffer-file-coding-system-for-read
;; #5.
+ (let ((codesys
+ (find-coding-system-magic-cookie-in-file filename)))
+ (when codesys
+ (intern codesys)))
+ ;; #6.
'raw-text))
(if (consp coding-system)
(setq return-val coding-system)
Regards,
--
Katsumi Yamaoka <yamaoka(a)jpl.org>