mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-28 01:00:52 -07:00
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).
This commit is contained in:
parent
aa453e89dc
commit
4d4ff4c6dd
1 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue