From ce0d851614e4e386ffde74eb73f9aaa17c1568e9 Mon Sep 17 00:00:00 2001 From: RadioNoiseE Date: Tue, 11 Nov 2025 18:46:26 +0800 Subject: [PATCH] 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 --- lisp/nxml/nxml-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 9b780a91721..b1666156ecc 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -1430,6 +1430,8 @@ either nil or one of the symbols `start-tag', `end-tag', `markup', (if (memq context '(nil end-tag comment)) 'end-tag 'mixed)) + ((eq xmltok-type 'cdata-section) + (or context 'markup)) ((eq xmltok-type 'comment) (cond ((memq context '(start-tag end-tag comment)) 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 of the line. This expects the xmltok-* variables to be set up as by `xmltok-forward'." - (cond ((let ((end (+ pos (length close-delim)))) + (cond ((string= open-delim "