* nxml-mode faces
@ 2007-12-18 13:48 Jason Rumney
2007-12-18 14:25 ` Miles Bader
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Jason Rumney @ 2007-12-18 13:48 UTC (permalink / raw)
To: Emacs Devel
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 <!-- and -->."
: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 <!-- and -->."
: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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-18 13:48 nxml-mode faces Jason Rumney
@ 2007-12-18 14:25 ` Miles Bader
2007-12-18 16:15 ` Eric Lilja
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Miles Bader @ 2007-12-18 14:25 UTC (permalink / raw)
To: Jason Rumney; +Cc: Emacs Devel
While you're at it, maybe also remove the "-face" suffix from the face
names?
Thanks,
-Miles
--
The secret to creativity is knowing how to hide your sources.
--Albert Einstein
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-18 13:48 nxml-mode faces Jason Rumney
2007-12-18 14:25 ` Miles Bader
@ 2007-12-18 16:15 ` Eric Lilja
2007-12-18 20:04 ` Lennart Borgman (gmail)
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Eric Lilja @ 2007-12-18 16:15 UTC (permalink / raw)
To: emacs-devel
Jason Rumney wrote:
> 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?
>
I'm not a developer but I think it sounds great! A few days ago I tried
to make nxml-mode follow the colors used by xml-mode (and it gets it
from the theme I have selected in color-theme, a non-official emacs
package), and I couldn't quite get them to match so this sounds great I
think.
- Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-18 13:48 nxml-mode faces Jason Rumney
2007-12-18 14:25 ` Miles Bader
2007-12-18 16:15 ` Eric Lilja
@ 2007-12-18 20:04 ` Lennart Borgman (gmail)
2007-12-18 23:37 ` Richard Stallman
2007-12-23 17:14 ` Juri Linkov
4 siblings, 0 replies; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-18 20:04 UTC (permalink / raw)
To: Jason Rumney; +Cc: emacs-nxml-mode, Emacs Devel
Jason Rumney wrote:
> 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?
I have nothing against it, but I cc the emacs nxml mailing list if
someone there has any comments. (In fact I am using this color scheme
already in nXhtml, since fontification there may be done by xhtml-mode
even though nxhtml-mode (derived from nxml-mode) is used.)
There is another problem with fontification in nxml-mode. The
fontification routines works very differently from the normal font lock
scheme. If I understand and remember correctly fontification is done
while parsing the file. I think James Clark implemented it this way to
make it faster and perhaps it also allows more granularity.
However the fontification is a problem if you try to make nxml-mode
coexist with other major modes in a buffer since nxml-mode parses the
whole buffer and also wants to fontify the whole buffer.
But this is of course a problem to solve further on, it will take some time.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-18 13:48 nxml-mode faces Jason Rumney
` (2 preceding siblings ...)
2007-12-18 20:04 ` Lennart Borgman (gmail)
@ 2007-12-18 23:37 ` Richard Stallman
2007-12-20 16:04 ` Jason Rumney
2007-12-23 17:14 ` Juri Linkov
4 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-12-18 23:37 UTC (permalink / raw)
To: Jason Rumney; +Cc: emacs-devel
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?
On general principles, that's a change for the better.
But I don't know any details about this mode.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-18 23:37 ` Richard Stallman
@ 2007-12-20 16:04 ` Jason Rumney
2007-12-21 11:01 ` Eric Lilja
0 siblings, 1 reply; 8+ messages in thread
From: Jason Rumney @ 2007-12-20 16:04 UTC (permalink / raw)
To: emacs-devel
Richard Stallman wrote:
> 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?
>
> On general principles, that's a change for the better.
> But I don't know any details about this mode.
>
As the only replies have been positive, I have checked the changes in,
along with Mile's suggestion to remove the -face suffix from face names.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-20 16:04 ` Jason Rumney
@ 2007-12-21 11:01 ` Eric Lilja
0 siblings, 0 replies; 8+ messages in thread
From: Eric Lilja @ 2007-12-21 11:01 UTC (permalink / raw)
To: emacs-devel
Jason Rumney wrote:
>
> As the only replies have been positive, I have checked the changes in,
> along with Mile's suggestion to remove the -face suffix from face names.
Hmm, they have been checked in? I've been keeping an eye on
gmane.emacs.cvs for those changes to be checked in so I could perform a
new checkout and try them out but I didn't see it there. Am I just blind or?
- eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: nxml-mode faces
2007-12-18 13:48 nxml-mode faces Jason Rumney
` (3 preceding siblings ...)
2007-12-18 23:37 ` Richard Stallman
@ 2007-12-23 17:14 ` Juri Linkov
4 siblings, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2007-12-23 17:14 UTC (permalink / raw)
To: Jason Rumney; +Cc: emacs-devel
> 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.
Thanks for making nxml-mode and xml-mode faces the same.
Too bad there are still differences in faces for entity references.
It seems your changes in nxml-mode are better than current faces in
xml-mode. Is there a reason not to change font-lock-variable-name
to font-lock-constant-face for entity references in xml-mode now?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-12-23 17:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 13:48 nxml-mode faces Jason Rumney
2007-12-18 14:25 ` Miles Bader
2007-12-18 16:15 ` Eric Lilja
2007-12-18 20:04 ` Lennart Borgman (gmail)
2007-12-18 23:37 ` Richard Stallman
2007-12-20 16:04 ` Jason Rumney
2007-12-21 11:01 ` Eric Lilja
2007-12-23 17:14 ` Juri Linkov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.