Commit 4d4ff4c6 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

mule-cmds.el (select-safe-coding-system): If

DEFAULT-CODING-SYSTEM is prefer-utf-8 and the buffer contains
multibyte characters, return utf-8 (or one of it's siblings).
parent aa453e89
......@@ -972,7 +972,7 @@ It is highly recommended to fix it before writing to a file."
;; Classify the defaults into safe, rejected, and unsafe.
(dolist (elt default-coding-system)
(if (or (eq (car codings) 'undecided)
(if (or (eq (coding-system-type (car elt)) 'undecided)
(memq (cdr elt) codings))
(if (and (functionp accept-default-p)
(not (funcall accept-default-p (cdr elt))))
......@@ -1029,6 +1029,11 @@ and try again)? " coding-system auto-cs))
(error "Save aborted"))))
(when (and tick (/= tick (buffer-chars-modified-tick)))
(error "Canceled because the buffer was modified"))
(if (and (eq (coding-system-type coding-system) 'undecided)
(coding-system-get coding-system :prefer-utf-8)
(< (- to from) (- (position-bytes to) (position-bytes from))))
(setq coding-system
(coding-system-change-text-conversion coding-system 'utf-8)))
coding-system)))
(setq select-safe-coding-system-function 'select-safe-coding-system)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment