1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Fix XML indentation for CDATA section content

* lisp/nxml/nxml-mode.el (nxml-merge-indent-context-type):
Handle 'cdata-section' type to prevent it from returning 'mixed'.
* lisp/nxml/nxml-mode.el (nxml-compute-indent-in-delimited-token):
Preserve existing indentation for CDATA section content.
(bug#79817)

Copyright-paperwork-exempt: yes
This commit is contained in:
RadioNoiseE 2025-11-11 18:46:26 +08:00 committed by Eli Zaretskii
parent dfa646096a
commit ce0d851614

View file

@ -1430,6 +1430,8 @@ either nil or one of the symbols `start-tag', `end-tag', `markup',
(if (memq context '(nil end-tag comment)) (if (memq context '(nil end-tag comment))
'end-tag 'end-tag
'mixed)) 'mixed))
((eq xmltok-type 'cdata-section)
(or context 'markup))
((eq xmltok-type 'comment) ((eq xmltok-type 'comment)
(cond ((memq context '(start-tag end-tag comment)) (cond ((memq context '(start-tag end-tag comment))
context) context)
@ -1519,7 +1521,9 @@ OPEN-DELIM and CLOSE-DELIM are strings giving the opening and closing
delimiters. POS is the position of the first non-whitespace character delimiters. POS is the position of the first non-whitespace character
of the line. This expects the xmltok-* variables to be set up as by of the line. This expects the xmltok-* variables to be set up as by
`xmltok-forward'." `xmltok-forward'."
(cond ((let ((end (+ pos (length close-delim)))) (cond ((string= open-delim "<![CDATA[")
(goto-char pos))
((let ((end (+ pos (length close-delim))))
(and (<= end (point-max)) (and (<= end (point-max))
(string= (buffer-substring-no-properties pos end) (string= (buffer-substring-no-properties pos end)
close-delim))) close-delim)))