Subject: bug#6267: 23.1; invalid XML in nested comments produced by comment-region

From: Patrik Hägglund H <[email-masked]>
Date: Tue, 25 May 2010 10:46:24 +0200

In xml mode, mark the following:

  <!-- foo -->
  <bar/>

and execute comment-region:

  <!-- <\!-- foo -\-> -->
  <!-- <bar/> -->

This is invalid XML because '--' is not allowed inside comments. See http://www.w3.org/TR/REC-xml/#sec-comments. (This is enforced by for example XML::Simple in perl 5.10.)

For example, as an alternative, the following is valid:

  <!-- <!-\- foo -\-> -->
  <!-- <bar/> -->

The offending code seems to be comment-quote-nested in newcomment.el. Should this code be changed, or the code for the xml mode, or both?

In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.11)
 of 2009-09-08 on deacxl001
Windowing system distributor `The Cygwin/X Project', version 11.0.10800000
configured using `configure  '--prefix=/app/emacs/23.1/LMWP2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

Major mode: XML

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-g g 3 0 6 <return> <down> C-SPC <down> <down> M-;
<up> <up> <right> <right> <right> <right> <backspace>
C-a C-SPC <down> <down> M-; C-x C-s M-x r e p o r t
- b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [2 times]
Mark activated
Saving file /vobs/radio_testbeds_adv/platform/testapps/build/template/dul_a/ulma_1/make/template.xml...
Wrote /vobs/radio_testbeds_adv/platform/testapps/build/template/dul_a/ulma_1/make/template.xml