bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35381: 26.2; nxml-mode doesn't fontify attributes in single quotes


From: Noam Postavsky
Subject: bug#35381: 26.2; nxml-mode doesn't fontify attributes in single quotes
Date: Fri, 26 Apr 2019 07:32:17 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> I'm not sure about this, is the disadvantage of the ?- also out
>> of date?
>
> If not, we should just fix it with appropriate syntax-propertize tricks.
>
>>  Including ?- has the problem of affecting dashes that have nothing to do
>>  with comments, so we normally turn it off.")
>
> Actually, I think the issue with -- comments is not just that they
> should not be treated as such when appearing outside tags, but that even
> within tags it's often not to be considered as comments.
>
> E.g. according to my flaky memory --...-- is not considered as a comment
> in HTML nor in XML (both inside and outside of tags).

XML says comments should always be <!--...--> where ... contains no
"--".

https://www.w3.org/TR/xml/#sec-comments

For SGML, it seems that --...-- is a comment within DTD definitions.
Otherwise only <!-- starts a comment, but "--" can toggle interpretation
of angle brackets and other special characters.  But browsers may or may
not handle the toggling thing correctly, so the recommendation for HTML
is to stick <!--...--> just like XML.  It's all rather confusing.

http://www.flightlab.com/~joe/sgml/comments.html
https://www.w3.org/TR/WD-html40-970917/intro/sgmltut.html

-;; As long as Emacs's syntax can't be complemented with predicates to context
-;; sensitively confirm the syntax of characters, we have to live with this
-;; kludgy kind of tradeoff.
+;; TODO: Add syntax-propertize rules to handle "--" properly, and
+;; eventually get rid of this variable altogether.
 (defvar sgml-specials '(?\" ?\')
   "List of characters that have a special meaning for SGML mode.
 This list is used when first loading the `sgml-mode' library.
-The supported characters and potential disadvantages are:
+The supported characters are ?\\\", ?\\=', and ?-.
 
-  ?\\\"        Makes \" in text start a string.
-  ?\\='        Makes \\=' in text start a string.
-  ?-   Makes -- in text start a comment.
-
-When only one of ?\\\" or ?\\=' are included, \"\\='\" or \\='\"\\=', as can 
be found in
-DTDs, start a string.  To partially avoid this problem this also makes these
-self insert as named entities depending on `sgml-quick-keys'.
-
-Including ?- has the problem of affecting dashes that have nothing to do
-with comments, so we normally turn it off.")
+Including ?- makes double dashes into comment delimiters, but
+they are really only supposed to delimit comments within DTD
+definitions.  So we normally turn it off.")





reply via email to

[Prev in Thread] Current Thread [Next in Thread]