summaryrefslogtreecommitdiff
path: root/lisp/international/mule-conf.el
diff options
context:
space:
mode:
authorKenichi Handa <handa@gnu.org>2013-06-28 23:41:14 +0900
committerKenichi Handa <handa@gnu.org>2013-06-28 23:41:14 +0900
commitaa453e89dc7a26c048ecaa2f7b4a45917e574c0d (patch)
treef2df4dae5c873c3debdd13dbb56b85a10fe22c81 /lisp/international/mule-conf.el
parent3e3da660306d977c1fd7090c067c9324ab111c04 (diff)
downloademacs-aa453e89dc7a26c048ecaa2f7b4a45917e574c0d.tar.gz
mule-conf.el (prefer-utf-8): New coding system.
(file-coding-system-alist): Use prefer-utf-8 as default for Elisp files.
Diffstat (limited to 'lisp/international/mule-conf.el')
-rw-r--r--lisp/international/mule-conf.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index 48487b850df..a84054b498b 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1225,6 +1225,18 @@
(define-coding-system-alias 'dos 'undecided-dos)
(define-coding-system-alias 'mac 'undecided-mac)
+(define-coding-system 'prefer-utf-8
+ "Like `undecided' but prefer UTF-8 when appropriate.
+On decoding, if the source contains 8-bit codes and they all
+are valid UTF-8 sequences, detect the source as UTF-8 encoding
+regardless of the coding priority.
+On encoding, if the source contains non-ASCII characters, encode them
+by UTF-8."
+ :coding-type 'undecided
+ :mnemonic ?-
+ :charset-list '(emacs)
+ :prefer-utf-8 t)
+
(define-coding-system 'raw-text
"Raw text, which means text contains random 8-bit codes.
Encoding text with this coding system produces the actual byte
@@ -1508,7 +1520,7 @@ for decoding and encoding files, process I/O, etc."
(setq file-coding-system-alist
(mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg)))
'(("\\.elc\\'" . utf-8-emacs)
- ("\\.el\\'" . utf-8)
+ ("\\.el\\'" . prefer-utf-8)
("\\.utf\\(-8\\)?\\'" . utf-8)
("\\.xml\\'" . xml-find-file-coding-system)
;; We use raw-text for reading loaddefs.el so that if it