🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.sgml
Article #748

Re: PSGML w\XML support - syntax colouring?

#748
From: Paul Groves
Date: Thu, 28 May 1998 00:00
96 lines
4031 bytes
On 27 May 1998 13:10:10 +0100, Toby.Speight@digitivity.com wrotf:

>That's normal - psgml-mode only parses (and fontifies) as much of the
>buffer as necessary.  If you want the whole buffer to be fontified,
>you need to force a complete parse.

But this still doesn't explain why I get full syntax colouring in SGML
mode, but not in XML mode - maybe a fragment from my .emacs file will
make things clearer*:

* BTW I'm running Emacs 20.21 on Windows 95

;; Turn on font-lock in all modes that support it
(if (fboundp 'global-font-lock-mode)
    (global-font-lock-mode t))

;; Maximum colors
(setq font-lock-maximum-decoration t)

; Set up psgml mode
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)

; Set up XML mode for PSGML

(setq auto-mode-alist
  (append (list (cons "\\.xml\\'" 'xml-mode))
	auto-mode-alist))
  (autoload 'xml-mode "psgml" nil t)


;; Name of the file used to translate entities <--> display characters
;;
(setq sgml-display-char-list-filename "C:/dtds/iso88591.map")

;; Automatically activate the dtd when a file is loaded.
;; This immediately colours the tags, for example.
;;
(setq sgml-auto-activate-dtd t)

;;   Create a new face for each different category of thing that
;; psgml can highlight.  These are based on the defaults in
;; psgml 1.0a10, except that we usually say "default" instead of
;; "bold", since we're generally going to use colors instead of bold
;; type.
;;   sgml-sgml-face is the only one that's not self-explanatory: it's
;; applied to the entire SGML declaration.

(copy-face 'default 'sgml-start-tag-face)
(copy-face 'default 'sgml-end-tag-face)
(copy-face 'italic 'sgml-comment-face)
(copy-face 'bold 'sgml-pi-face)
(copy-face 'bold 'sgml-sgml-face)
(copy-face 'bold 'sgml-doctype-face)
(copy-face 'default 'sgml-entity-face)
(copy-face 'bold 'sgml-shortref-face)

;; Tag colouring definitions
;; stolen from David Meggison (very slightly modified)
;;
(setq-default sgml-set-face t)
  (make-face 'sgml-comment-face)
  (make-face 'sgml-doctype-face)
  (make-face 'sgml-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)

  (set-face-foreground 'sgml-comment-face "dark green")
  (set-face-foreground 'sgml-doctype-face "lime green")
  (set-face-foreground 'sgml-tag-face "red")
  (set-face-foreground 'sgml-entity-face "midnight blue")
  (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")

  (setq-default sgml-markup-faces
   '((comment . sgml-comment-face)
     (doctype . sgml-doctype-face)
     (end-tag . sgml-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-tag-face)))
Technical Details
Message-ID: <356d44df.609512637@news.ox.ac.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <356ada45.451127207@news.ox.ac.uk> <vafemxhjaz8.fsf@ramses.cs.uni-dortmund.de> <u67irykwt.fsf@digitivity.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa82c,e14601e24d87f01c
X-Google-Attributes: gidfa82c,public
X-Google-Thread: 102b9a,e14601e24d87f01c
X-Google-Attributes: gid102b9a,public
X-Google-Thread: 103b8b,e14601e24d87f01c
X-Google-Attributes: gid103b8b,public
From: paul.groves@oucs.ox.ac.uk (Paul Groves)
Subject: Re: PSGML w\XML support - syntax colouring?
Date: 1998/05/28
Message-ID: <356d44df.609512637@news.ox.ac.uk>
X-Deja-AN: 357271039
References: <356ada45.451127207@news.ox.ac.uk> <vafemxhjaz8.fsf@ramses.cs.uni-dortmund.de> <u67irykwt.fsf@digitivity.com>
Organization: Oxford University
Newsgroups: comp.text.sgml,comp.emacs,gnu.emacs.help