From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.devel Subject: nxml-mode faces Date: Tue, 18 Dec 2007 13:48:19 +0000 Message-ID: <4767CFA3.10201@f2s.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1197985779 11468 80.91.229.12 (18 Dec 2007 13:49:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Dec 2007 13:49:39 +0000 (UTC) To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 18 14:49:51 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J4cpJ-0005ah-5O for ged-emacs-devel@m.gmane.org; Tue, 18 Dec 2007 14:49:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4cp0-0005U9-0A for ged-emacs-devel@m.gmane.org; Tue, 18 Dec 2007 08:49:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J4coC-0004Ve-TI for emacs-devel@gnu.org; Tue, 18 Dec 2007 08:48:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J4coB-0004RJ-62 for emacs-devel@gnu.org; Tue, 18 Dec 2007 08:48:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4co9-0004QR-Qm for emacs-devel@gnu.org; Tue, 18 Dec 2007 08:48:29 -0500 Original-Received: from mk-outboundfilter-4.mail.uk.tiscali.com ([212.74.114.32]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J4co9-0003QU-4k for emacs-devel@gnu.org; Tue, 18 Dec 2007 08:48:29 -0500 Original-X-Trace: 1598186/mk-outboundfilter-2.mail.uk.tiscali.com/F2S/$ACCEPTED/freedom2Surf-customers/83.67.23.108 X-SBRS: None X-RemoteIP: 83.67.23.108 X-IP-MAIL-FROM: jasonr@f2s.com X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAANdeZ0dTQxds/2dsb2JhbAAIkUmZDQ X-IronPort-AV: E=Sophos;i="4.24,180,1196640000"; d="scan'208";a="1598186" Original-Received: from i-83-67-23-108.freedom2surf.net (HELO [192.168.249.28]) ([83.67.23.108]) by smtp.f2s.tiscali.co.uk with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Dec 2007 13:48:26 +0000 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:85250 Archived-At: Does anyone have any objection to the patch below, which makes use of existing font-lock faces rather than inventing an entirely separate color scheme? Fontification I think is an improvement over xml-mode that can be changed if others do not agree: 1. Keywords in the prolog, such as SYSTEM and PUBLIC are fontified as keywords, as is CDATA. xml-mode does not fontify these. 2. Entity and character references are fontified in font-lock-constant-face. xml-mode fontifies entity references in font-lock-variable-name face (the same as attribute names), and does not fontify numeric character references at all. Changes in fontification compared to xml-mode that are due to differences in internal implementation: 1. The opening ! and ? of processing instruction and prolog (in nxml terminology) elements are fontified with the opening <, rather than the following "element" name. The ? before the closing tag of a processing instruction is fontified with the closing > in both cases, so xml-mode seems a little inconsistent here. 2. The content of processing instructions is fontified in font-lock-doc-face. xml-mode formats the contents as if it were a normal XML element, but the content of a processing instruction is arbitrary and not considered part of the XML. If the chosen face does not seem appropriate, font-lock-comment-face or default could be other candidates. Index: lisp/nxml/nxml-mode.el =================================================================== RCS file: /sources/emacs/emacs/lisp/nxml/nxml-mode.el,v retrieving revision 1.3 diff -c -r1.3 nxml-mode.el *** lisp/nxml/nxml-mode.el 28 Nov 2007 04:08:30 -0000 1.3 --- lisp/nxml/nxml-mode.el 18 Dec 2007 13:07:47 -0000 *************** *** 147,185 **** :group 'nxml :type 'boolean) - ;; The following are the colors we use with a light background. - ;; The two blues have the same hue but contrasting saturation/value. - ;; The hue of the green is 120 degrees different from that of the - ;; blue. The red used for highlighting errors is 120 degrees - ;; different again. We use the light blue only for refs and - ;; delimiters, since these are short (long stretches in a light color - ;; would be too hard to read). The dark blue is closest to black - ;; (which we use by default for text), so we use it for attribute - ;; values, which are similar to text. - - (defconst nxml-light-blue-color "#9292C9") ; hue 240 - (defconst nxml-dark-blue-color "#3A3A7B") ; hue 240 - (defconst nxml-green-color "#257A25") ; hue 120 - - ;; Similar principles apply with a dark background. However, - ;; we switch green and blue, because darker blues are very hard to - ;; read (for me anyway) on a dark background. - - (defconst nxml-sky-blue-color "#ACACFC") ; hue 240 - (defconst nxml-dark-green-color "#00AD00") ; hue 120 - (defconst nxml-light-green-color "#70F170") ; hue 120 - (defface nxml-delimited-data-face ! `((((class color) (background light)) (:foreground ,nxml-dark-blue-color)) ! (((class color) (background dark)) (:foreground ,nxml-light-green-color))) "Face used to highlight data enclosed between delimiters. ! By default, this is inherited by `nxml-attribute-value-face' ! and `nxml-processing-instruction-content-face'." :group 'nxml-highlighting-faces) (defface nxml-name-face ! `((((class color) (background light)) (:foreground ,nxml-green-color)) ! (((class color) (background dark)) (:foreground ,nxml-sky-blue-color))) "Face used to highlight various names. This includes element and attribute names, processing instruction targets and the CDATA keyword in a CDATA section. --- 147,160 ---- :group 'nxml :type 'boolean) (defface nxml-delimited-data-face ! '((t (:inherit font-lock-doc-face))) "Face used to highlight data enclosed between delimiters. ! This is not used directly, but only by inheritance by other faces." :group 'nxml-highlighting-faces) (defface nxml-name-face ! '((t (:inherit font-lock-builtin-face))) "Face used to highlight various names. This includes element and attribute names, processing instruction targets and the CDATA keyword in a CDATA section. *************** *** 187,202 **** :group 'nxml-highlighting-faces) (defface nxml-ref-face ! `((((class color) (background light)) (:foreground ,nxml-light-blue-color)) ! (((class color) (background dark)) (:foreground ,nxml-dark-green-color))) "Face used to highlight character and entity references. This is not used directly, but only via inheritance by other faces." :group 'nxml-highlighting-faces) (defface nxml-delimiter-face ! `((((class color) (background light)) (:foreground ,nxml-light-blue-color)) ! (((class color) (background dark)) (:foreground ,nxml-dark-green-color)) ! (t (:bold t))) "Face used to highlight delimiters. This is not used directly, but only via inheritance by other faces." :group 'nxml-highlighting-faces) --- 162,174 ---- :group 'nxml-highlighting-faces) (defface nxml-ref-face ! '((t (:inherit font-lock-constant-face))) "Face used to highlight character and entity references. This is not used directly, but only via inheritance by other faces." :group 'nxml-highlighting-faces) (defface nxml-delimiter-face ! nil "Face used to highlight delimiters. This is not used directly, but only via inheritance by other faces." :group 'nxml-highlighting-faces) *************** *** 207,218 **** :group 'nxml-highlighting-faces) (defface nxml-comment-content-face ! '((t (:italic t))) "Face used to highlight the content of comments." :group 'nxml-highlighting-faces) (defface nxml-comment-delimiter-face ! '((t (:inherit nxml-delimiter-face))) "Face used for the delimiters of comments, i.e ." :group 'nxml-highlighting-faces) --- 179,190 ---- :group 'nxml-highlighting-faces) (defface nxml-comment-content-face ! '((t (:inherit font-lock-comment-face))) "Face used to highlight the content of comments." :group 'nxml-highlighting-faces) (defface nxml-comment-delimiter-face ! '((t (:inherit font-lock-comment-delimiter-face))) "Face used for the delimiters of comments, i.e ." :group 'nxml-highlighting-faces) *************** *** 222,228 **** :group 'nxml-highlighting-faces) (defface nxml-processing-instruction-target-face ! '((t (:inherit nxml-name-face))) "Face used for the target of processing instructions." :group 'nxml-highlighting-faces) --- 194,200 ---- :group 'nxml-highlighting-faces) (defface nxml-processing-instruction-target-face ! '((t (:inherit font-lock-keyword-face))) "Face used for the target of processing instructions." :group 'nxml-highlighting-faces) *************** *** 274,280 **** :group 'nxml-highlighting-faces) (defface nxml-tag-slash-face ! '((t (:inherit nxml-name-face))) "Face used for slashes in tags, both in end-tags and empty-elements." :group 'nxml-highlighting-faces) --- 246,252 ---- :group 'nxml-highlighting-faces) (defface nxml-tag-slash-face ! '((t (:inherit nxml-tag-delimiter-face))) "Face used for slashes in tags, both in end-tags and empty-elements." :group 'nxml-highlighting-faces) *************** *** 284,295 **** :group 'nxml-highlighting-faces) (defface nxml-element-colon-face ! '((t (:inherit nxml-name-face))) "Face used for the colon in element names." :group 'nxml-highlighting-faces) (defface nxml-element-local-name-face ! '((t (:inherit nxml-name-face))) "Face used for the local name of elements." :group 'nxml-highlighting-faces) --- 256,267 ---- :group 'nxml-highlighting-faces) (defface nxml-element-colon-face ! nil "Face used for the colon in element names." :group 'nxml-highlighting-faces) (defface nxml-element-local-name-face ! '((t (:inherit font-lock-function-name-face))) "Face used for the local name of elements." :group 'nxml-highlighting-faces) *************** *** 299,335 **** :group 'nxml-highlighting-faces) (defface nxml-attribute-colon-face ! '((t (:inherit nxml-name-face))) "Face used for the colon in attribute names." :group 'nxml-highlighting-faces) (defface nxml-attribute-local-name-face ! '((t (:inherit nxml-name-face))) "Face used for the local name of attributes." :group 'nxml-highlighting-faces) (defface nxml-namespace-attribute-xmlns-face ! '((t (:inherit nxml-name-face))) "Face used for `xmlns' in namespace attributes." :group 'nxml-highlighting-faces) (defface nxml-namespace-attribute-colon-face ! '((t (:inherit nxml-name-face))) "Face used for the colon in namespace attributes." :group 'nxml-highlighting-faces) (defface nxml-namespace-attribute-prefix-face ! '((t (:inherit nxml-name-face))) "Face used for the prefix declared in namespace attributes." :group 'nxml-highlighting-faces) (defface nxml-attribute-value-face ! '((t (:inherit nxml-delimited-data-face))) "Face used for the value of attributes." :group 'nxml-highlighting-faces) (defface nxml-attribute-value-delimiter-face ! '((t (:inherit nxml-delimiter-face))) "Face used for the delimiters of attribute values." :group 'nxml-highlighting-faces) --- 271,307 ---- :group 'nxml-highlighting-faces) (defface nxml-attribute-colon-face ! '((t (:inherit nxml-delimiter-face))) "Face used for the colon in attribute names." :group 'nxml-highlighting-faces) (defface nxml-attribute-local-name-face ! '((t (:inherit font-lock-variable-name-face))) "Face used for the local name of attributes." :group 'nxml-highlighting-faces) (defface nxml-namespace-attribute-xmlns-face ! '((t (:inherit nxml-attribute-prefix-face))) "Face used for `xmlns' in namespace attributes." :group 'nxml-highlighting-faces) (defface nxml-namespace-attribute-colon-face ! '((t (:inherit nxml-attribute-colon-face))) "Face used for the colon in namespace attributes." :group 'nxml-highlighting-faces) (defface nxml-namespace-attribute-prefix-face ! '((t (:inherit nxml-attribute-local-name-face))) "Face used for the prefix declared in namespace attributes." :group 'nxml-highlighting-faces) (defface nxml-attribute-value-face ! '((t (:inherit font-lock-string-face))) "Face used for the value of attributes." :group 'nxml-highlighting-faces) (defface nxml-attribute-value-delimiter-face ! '((t (:inherit nxml-attribute-value-face))) "Face used for the delimiters of attribute values." :group 'nxml-highlighting-faces) *************** *** 344,350 **** :group 'nxml-highlighting-faces) (defface nxml-prolog-literal-delimiter-face ! '((t (:inherit nxml-delimiter-face))) "Face used for the delimiters of literals in the prolog." :group 'nxml-highlighting-faces) --- 316,322 ---- :group 'nxml-highlighting-faces) (defface nxml-prolog-literal-delimiter-face ! '((t (:inherit nxml-delimited-data-face))) "Face used for the delimiters of literals in the prolog." :group 'nxml-highlighting-faces) *************** *** 354,360 **** :group 'nxml-highlighting-faces) (defface nxml-prolog-keyword-face ! '((t (:inherit nxml-name-face))) "Face used for keywords in the prolog." :group 'nxml-highlighting-faces) --- 326,332 ---- :group 'nxml-highlighting-faces) (defface nxml-prolog-keyword-face ! '((t (:inherit font-lock-keyword-face))) "Face used for keywords in the prolog." :group 'nxml-highlighting-faces) Index: lisp/nxml/rng-valid.el =================================================================== RCS file: /sources/emacs/emacs/lisp/nxml/rng-valid.el,v retrieving revision 1.3 diff -c -r1.3 rng-valid.el *** lisp/nxml/rng-valid.el 28 Nov 2007 04:13:52 -0000 1.3 --- lisp/nxml/rng-valid.el 18 Dec 2007 12:10:24 -0000 *************** *** 107,113 **** :group 'nxml :group 'languages) ! (defface rng-error-face '((t (:underline "red"))) "Face for highlighting XML errors." :group 'relax-ng) --- 107,113 ---- :group 'nxml :group 'languages) ! (defface rng-error-face '((t (:inherit font-lock-warning-face))) "Face for highlighting XML errors." :group 'relax-ng)