Fix visiting XML files with non-Unix EOL format
* lisp/international/mule.el (sgml-xml-auto-coding-function) (sgml-html-meta-auto-coding-function): Don't use 'buffer-file-coding-system' if the buffer is unibyte. (Bug#34704)
This commit is contained in:
parent
a89fabe963
commit
04cad5e8ea
1 changed files with 13 additions and 5 deletions
|
@ -2500,10 +2500,17 @@ This function is intended to be added to `auto-coding-functions'."
|
||||||
(let ((sym-type (coding-system-type sym))
|
(let ((sym-type (coding-system-type sym))
|
||||||
(bfcs-type
|
(bfcs-type
|
||||||
(coding-system-type buffer-file-coding-system)))
|
(coding-system-type buffer-file-coding-system)))
|
||||||
;; 'charset' will signal an error in
|
;; If the buffer is unibyte, its encoding is
|
||||||
;; coding-system-equal, since it isn't a
|
;; immaterial (it is just the default value of
|
||||||
;; coding-system. So test that up front.
|
;; buffer-file-coding-system), so we ignore it.
|
||||||
(if (and (not (equal sym-type 'charset))
|
;; This situation happens when this function is
|
||||||
|
;; called as part of visiting a file, as opposed
|
||||||
|
;; to when saving a buffer to a file.
|
||||||
|
(if (and enable-multibyte-characters
|
||||||
|
;; 'charset' will signal an error in
|
||||||
|
;; coding-system-equal, since it isn't a
|
||||||
|
;; coding-system. So test that up front.
|
||||||
|
(not (equal sym-type 'charset))
|
||||||
(coding-system-equal 'utf-8 sym-type)
|
(coding-system-equal 'utf-8 sym-type)
|
||||||
(coding-system-equal 'utf-8 bfcs-type))
|
(coding-system-equal 'utf-8 bfcs-type))
|
||||||
buffer-file-coding-system
|
buffer-file-coding-system
|
||||||
|
@ -2555,7 +2562,8 @@ This function is intended to be added to `auto-coding-functions'."
|
||||||
(let ((sym-type (coding-system-type sym))
|
(let ((sym-type (coding-system-type sym))
|
||||||
(bfcs-type
|
(bfcs-type
|
||||||
(coding-system-type buffer-file-coding-system)))
|
(coding-system-type buffer-file-coding-system)))
|
||||||
(if (and (coding-system-equal 'utf-8 sym-type)
|
(if (and enable-multibyte-characters
|
||||||
|
(coding-system-equal 'utf-8 sym-type)
|
||||||
(coding-system-equal 'utf-8 bfcs-type))
|
(coding-system-equal 'utf-8 bfcs-type))
|
||||||
buffer-file-coding-system
|
buffer-file-coding-system
|
||||||
sym))
|
sym))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue