aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2019-03-02 10:32:06 +0200
committerEli Zaretskii2019-03-02 10:32:06 +0200
commit04cad5e8eac6fee415c0951d673e8a27534e727d (patch)
tree7a2188c920222c948566a4927cfdd2039463f559 /lisp
parenta89fabe96396b2197cffc5a9e694004e1c691fa9 (diff)
downloademacs-04cad5e8eac6fee415c0951d673e8a27534e727d.tar.gz
emacs-04cad5e8eac6fee415c0951d673e8a27534e727d.zip
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)
Diffstat (limited to 'lisp')
-rw-r--r--lisp/international/mule.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index b47fd4ca69c..58fdd28243a 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -2500,10 +2500,17 @@ This function is intended to be added to `auto-coding-functions'."
2500 (let ((sym-type (coding-system-type sym)) 2500 (let ((sym-type (coding-system-type sym))
2501 (bfcs-type 2501 (bfcs-type
2502 (coding-system-type buffer-file-coding-system))) 2502 (coding-system-type buffer-file-coding-system)))
2503 ;; 'charset' will signal an error in 2503 ;; If the buffer is unibyte, its encoding is
2504 ;; coding-system-equal, since it isn't a 2504 ;; immaterial (it is just the default value of
2505 ;; coding-system. So test that up front. 2505 ;; buffer-file-coding-system), so we ignore it.
2506 (if (and (not (equal sym-type 'charset)) 2506 ;; This situation happens when this function is
2507 ;; called as part of visiting a file, as opposed
2508 ;; to when saving a buffer to a file.
2509 (if (and enable-multibyte-characters
2510 ;; 'charset' will signal an error in
2511 ;; coding-system-equal, since it isn't a
2512 ;; coding-system. So test that up front.
2513 (not (equal sym-type 'charset))
2507 (coding-system-equal 'utf-8 sym-type) 2514 (coding-system-equal 'utf-8 sym-type)
2508 (coding-system-equal 'utf-8 bfcs-type)) 2515 (coding-system-equal 'utf-8 bfcs-type))
2509 buffer-file-coding-system 2516 buffer-file-coding-system
@@ -2555,7 +2562,8 @@ This function is intended to be added to `auto-coding-functions'."
2555 (let ((sym-type (coding-system-type sym)) 2562 (let ((sym-type (coding-system-type sym))
2556 (bfcs-type 2563 (bfcs-type
2557 (coding-system-type buffer-file-coding-system))) 2564 (coding-system-type buffer-file-coding-system)))
2558 (if (and (coding-system-equal 'utf-8 sym-type) 2565 (if (and enable-multibyte-characters
2566 (coding-system-equal 'utf-8 sym-type)
2559 (coding-system-equal 'utf-8 bfcs-type)) 2567 (coding-system-equal 'utf-8 bfcs-type))
2560 buffer-file-coding-system 2568 buffer-file-coding-system
2561 sym)) 2569 sym))