Subject: [PATCH] Respect sgml-xml-mode

From: Philip Kaludercic <[email-masked]>
Date: Sun, 18 Apr 2021 18:56:26 +0000

sgml-xml-mode is a user option that is over-riden by smgl-mode. When I
customize sgml-xml-mode to be enabled for every sgml-mode derived mode
(specifically html-mode), it is disabled because a HTML file does not
have to be a valid XML file -- even if I would want it to be.

This patch only sets sgml-xml-mode if we know that the current file is
an XML file, but leaves the default value if it cannot be said for sure.

-- 
	Philip K.
>From 934906eacc02ded6784653ef7b714b57b7b952b7 Mon Sep 17 00:00:00 2001
From: Philip K <[email-masked]>
Date: Wed, 14 Apr 2021 19:19:01 +0200
Subject: [PATCH 1/4] sgml-mode: Only set sgml-xml-mode if guessed to be an XML
 file

The user preference for sgml-xml-mode is overridden by default if the
result of the guess is used as the buffer local value.
---
 lisp/textmodes/sgml-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 67f731917e..d5930e82df 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -623,7 +623,8 @@ sgml-mode
   (setq-local syntax-propertize-function #'sgml-syntax-propertize)
   (setq-local syntax-ppss-table sgml-tag-syntax-table)
   (setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
-  (setq-local sgml-xml-mode (sgml-xml-guess))
+  (when (sgml-xml-guess)
+    (setq-local sgml-xml-mode t))
   (unless sgml-xml-mode
     (setq-local skeleton-transformation-function sgml-transformation-function))
   ;; This will allow existing comments within declarations to be
-- 
2.30.2