]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't produce invalid XML with multi-line commenting style
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>
Tue, 25 Jun 2024 09:26:12 +0000 (12:26 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 27 Jul 2024 12:03:04 +0000 (14:03 +0200)
Both XML and HTML forbid double hyphens inside comments.  However,
nxml-mode was using a `!--' as a comment padding if `comment-style'
was set to any of the styles that supposed to add padding.  This infix
was auto-derived due to `comment-continue' being nil.  To fix that set
`comment-continue' explicitly.  It's unclear what padding should be
used, but from looking at other editors it seems they don't typically
add padding in XML, so let's be simple for now and just set
`comment-continue' to empty string.

* lisp/nxml/nxml-mode.el (nxml-mode): Make 'comment-continue' a
buffer-local variable set to the empty string.  (Bug#71772)

(cherry picked from commit 9eea6be5abffa91d21ea299158d5a2cd6cfb5089)

lisp/nxml/nxml-mode.el

index 02391dc6968c997c8550f6a0b56daf82a6fbc758..a58d3f3c75f9b281c24081a740b81b823eeaee05 100644 (file)
@@ -531,6 +531,7 @@ Many aspects this mode can be customized using
   (setq-local comment-end-skip "[ \t\r\n]*-->")
   (setq-local comment-line-break-function #'nxml-newline-and-indent)
   (setq-local comment-quote-nested-function #'nxml-comment-quote-nested)
+  (setq-local comment-continue "") ; avoid double-hyphens as a padding
   (save-excursion
     (save-restriction
       (widen)