aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadioNoiseE2025-11-11 18:46:26 +0800
committerEli Zaretskii2025-11-22 12:03:16 +0200
commitce0d851614e4e386ffde74eb73f9aaa17c1568e9 (patch)
treec03a5516fb37182f7413c7e044112bb89848f39d
parentdfa646096aadfe6fae1ebf722e4fd0291888c9d5 (diff)
downloademacs-ce0d851614e4e386ffde74eb73f9aaa17c1568e9.tar.gz
emacs-ce0d851614e4e386ffde74eb73f9aaa17c1568e9.zip
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
-rw-r--r--lisp/nxml/nxml-mode.el6
1 files changed, 5 insertions, 1 deletions
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',
1430 (if (memq context '(nil end-tag comment)) 1430 (if (memq context '(nil end-tag comment))
1431 'end-tag 1431 'end-tag
1432 'mixed)) 1432 'mixed))
1433 ((eq xmltok-type 'cdata-section)
1434 (or context 'markup))
1433 ((eq xmltok-type 'comment) 1435 ((eq xmltok-type 'comment)
1434 (cond ((memq context '(start-tag end-tag comment)) 1436 (cond ((memq context '(start-tag end-tag comment))
1435 context) 1437 context)
@@ -1519,7 +1521,9 @@ OPEN-DELIM and CLOSE-DELIM are strings giving the opening and closing
1519delimiters. POS is the position of the first non-whitespace character 1521delimiters. POS is the position of the first non-whitespace character
1520of the line. This expects the xmltok-* variables to be set up as by 1522of the line. This expects the xmltok-* variables to be set up as by
1521`xmltok-forward'." 1523`xmltok-forward'."
1522 (cond ((let ((end (+ pos (length close-delim)))) 1524 (cond ((string= open-delim "<![CDATA[")
1525 (goto-char pos))
1526 ((let ((end (+ pos (length close-delim))))
1523 (and (<= end (point-max)) 1527 (and (<= end (point-max))
1524 (string= (buffer-substring-no-properties pos end) 1528 (string= (buffer-substring-no-properties pos end)
1525 close-delim))) 1529 close-delim)))