changeset: 4641:a90b63846dc4
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sun Jun 07 16:47:04 2009 +0100
files: lisp/ChangeLog lisp/code-files.el
description:
Set buffer-file-coding-system more sensibly with zero-length files.
lisp/ChangeLog addition:
2009-06-07 Aidan Kehoe <kehoea(a)parhasard.net>
* code-files.el (insert-file-contents):
Autodetection may return undecided as a coding system. If the file
was zero-length, this is kosher, and we should set
buffer-file-coding-system to its default; if it is not
zero-length, we still need to set b-f-c-s, but we warn that the
autodetection fails. (Ignoring that for the user, autodetection
failing is something very distinct from what we use it to mean
here.) See
http://mid.gmane.org/18986.53111.800393.660612@parhasard.net and
the related thread.
diff -r 8cef85a39d2c -r a90b63846dc4 lisp/ChangeLog
--- a/lisp/ChangeLog Sat Jun 06 17:20:21 2009 +0100
+++ b/lisp/ChangeLog Sun Jun 07 16:47:04 2009 +0100
@@ -1,3 +1,16 @@
+2009-06-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * code-files.el (insert-file-contents):
+ Autodetection may return undecided as a coding system. If the file
+ was zero-length, this is kosher, and we should set
+ buffer-file-coding-system to its default; if it is not
+ zero-length, we still need to set b-f-c-s, but we warn that the
+ autodetection fails. (Ignoring that for the user, autodetection
+ failing is something very distinct from what we use it to mean
+ here.) See
+
http://mid.gmane.org/18986.53111.800393.660612@parhasard.net and
+ the related thread.
+
2009-06-06 Aidan Kehoe <kehoea(a)parhasard.net>
* files.el (cd):
diff -r 8cef85a39d2c -r a90b63846dc4 lisp/code-files.el
--- a/lisp/code-files.el Sat Jun 06 17:20:21 2009 +0100
+++ b/lisp/code-files.el Sun Jun 07 16:47:04 2009 +0100
@@ -443,6 +443,13 @@
filename visit err)
(signal (car err) (cdr err))))
(setq coding-system used-codesys)
+ ;; If the file was zero-length, used-codesys is undecided. Set it to
+ ;; a more sane value.
+ (when (eq 'undecided (coding-system-type coding-system))
+ (unless (zerop (buffer-size))
+ (warn "%s: autodetection failed: setting to default."
+ (file-name-nondirectory (buffer-file-name))))
+ (setq coding-system (default-value 'buffer-file-coding-system)))
;; call any `post-read-conversion' for the coding system that
;; was used ...
(let ((func
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches