SGML: Fonts in PSGML

SGML: Fonts in PSGML

Subject: [Was Vanishing attributes in psgml-mode]
Date: 17 Jun 1997 07:15:22 -0400
From: David Megginson <dmeggins@uottawa.ca>
Newsgroup: comp.text.sgml
------------------------------------------------------------------- Peter Flynn <silmaril@m-net.arbornet.org> writes: > While I'm on it, though...has anyone ever done a fontify for > psgml-mode? Having seen the OmniMark mode, I'm a convert to > fontification (sounds perverted :-) but psgml seems not to have > any syntactic hooks to enable it right now, and my Lithp is > not up to understanding how it works. There are three steps, assuming that you have a non-antiquated version of PSGML (from the last two years, at least): 1. Set the variable 'sgml-set-face' to 't'. 2. Create any necessary faces and customise them to your liking (using the functions 'set-face-background', 'set-face-background-pixmap', 'set-face-font', 'set-face-foreground', 'set-face-stipple', and 'set-face-underline-p'). 3. Set the variable 'sgml-markup-faces' to an a-list of dotted pairs mapping your faces to any or all of the symbols 'comment', 'doctype', 'end-tag', 'entity', 'ignored', 'ms-end', 'ms-start', 'pi', 'sgml', 'short-ref', 'start-tag' For example, to make start-tags pink and processing instructions brown, you could do this: (setq-default sgml-set-face t) (make-face 'sgml-start-tag-face) (set-face-foreground 'sgml-start-tag-face "pink") (make-face 'sgml-pi-face) (set-face-foregroup 'sgml-pi-face "brown") (setq-default sgml-markup-faces '((start-tag . sgml-start-tag-face) (pi . sgml-pi-face))) Here's a fuller (and in the colour scheme, a less nauseating) example, from my own .emacs. Note that the colour names are probably X11-specific; if you're using MS Windows, you may have to play around with them: (setq-default sgml-set-face t) ;; ;; Faces. ;; (make-face 'sgml-comment-face) (make-face 'sgml-doctype-face) (make-face 'sgml-end-tag-face) (make-face 'sgml-entity-face) (make-face 'sgml-ignored-face) (make-face 'sgml-ms-end-face) (make-face 'sgml-ms-start-face) (make-face 'sgml-pi-face) (make-face 'sgml-sgml-face) (make-face 'sgml-short-ref-face) (make-face 'sgml-start-tag-face) (set-face-foreground 'sgml-comment-face "dark green") (set-face-foreground 'sgml-doctype-face "maroon") (set-face-foreground 'sgml-end-tag-face "blue2") (set-face-foreground 'sgml-entity-face "red2") (set-face-foreground 'sgml-ignored-face "maroon") (set-face-background 'sgml-ignored-face "gray90") (set-face-foreground 'sgml-ms-end-face "maroon") (set-face-foreground 'sgml-ms-start-face "maroon") (set-face-foreground 'sgml-pi-face "maroon") (set-face-foreground 'sgml-sgml-face "maroon") (set-face-foreground 'sgml-short-ref-face "goldenrod") (set-face-foreground 'sgml-start-tag-face "blue2") (setq-default sgml-markup-faces '((comment . sgml-comment-face) (doctype . sgml-doctype-face) (end-tag . sgml-end-tag-face) (entity . sgml-entity-face) (ignored . sgml-ignored-face) (ms-end . sgml-ms-end-face) (ms-start . sgml-ms-start-face) (pi . sgml-pi-face) (sgml . sgml-sgml-face) (short-ref . sgml-short-ref-face) (start-tag . sgml-start-tag-face))) All the best, and good luck, David -- David Megginson ak117@freenet.carleton.ca Microstar Software Ltd. dmeggins@microstar.com University of Ottawa dmeggins@uottawa.ca http://www.uottawa.ca/~dmeggins [New email address [August 1997]: ak117@freenet.carleton.ca New Home Page: http://home.sprynet.com/sprynet/dmeggins/]