[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 04cad5e: Fix visiting XML files with non-Unix EOL
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-26 04cad5e: Fix visiting XML files with non-Unix EOL format |
Date: |
Sat, 2 Mar 2019 03:35:16 -0500 (EST) |
branch: emacs-26
commit 04cad5e8eac6fee415c0951d673e8a27534e727d
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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)
---
lisp/international/mule.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index b47fd4c..58fdd28 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'."
(let ((sym-type (coding-system-type sym))
(bfcs-type
(coding-system-type buffer-file-coding-system)))
- ;; 'charset' will signal an error in
- ;; coding-system-equal, since it isn't a
- ;; coding-system. So test that up front.
- (if (and (not (equal sym-type 'charset))
+ ;; If the buffer is unibyte, its encoding is
+ ;; immaterial (it is just the default value of
+ ;; buffer-file-coding-system), so we ignore it.
+ ;; 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 bfcs-type))
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))
(bfcs-type
(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))
buffer-file-coding-system
sym))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 04cad5e: Fix visiting XML files with non-Unix EOL format,
Eli Zaretskii <=