🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.sgml
Article #749

Re: PSGML w\XML support - syntax colouring?

#749
From: Toby.Speight
Date: Thu, 28 May 1998 00:00
50 lines
3151 bytes
Paul> Paul Groves <URL:mailto:paul.groves@oucs.ox.ac.uk>

=> In <URL:news:356d44df.609512637@news.ox.ac.uk>, Paul wrote:

Paul> ... I get full syntax colouring in SGML mode, but not in XML
Paul> mode - maybe a fragment from my .emacs file will make things
Paul> clearer*:
Paul>
Paul> * BTW I'm running Emacs 20.21 on Windows 95

I have

(defun my-sgml-mode-hook nil
  (setq sgml-validate-command "nsgmls -s")
  (setq sgml-xml-declaration "/usr/local/lib/sgml/xml.decl")
  (local-set-key [(meta control ?n)] 'sgml-up-element)
  (set (make-local-variable 'ispell-skip-sgml) t)
  (set (make-local-variable 'sgml-markup-start) 0) ; psgml brokenness
  (let ((document-is-html (save-excursion (goto-char (point-min)) (looking-at "<!DOCTYPE HTML\\>"))))
    (cond ((and window-system document-is-html)
           (require 'html-helper-mode)
           (set (make-local-variable 'font-lock-keywords) html-helper-font-lock-keywords)
           (set (make-local-variable 'font-lock-keywords-case-fold-search) t)
           (font-lock-mode 1))
          (window-system
           (set (make-local-variable 'sgml-set-face) t)
           (setq sgml-markup-faces
                 '((comment . font-lock-comment-face)
                   (doctype . font-lock-function-name-face)
                   (end-tag . font-lock-variable-name-face)
                   (entity . font-lock-string-face)
                   (ignored . font-lock-reference-face)
                   (ms-end . font-lock-type-face)
                   (ms-start . font-lock-type-face)
                   (pi . font-lock-type-face)
                   (sgml . font-lock-type-face)
                   (short-ref . font-lock-variable-name-face)
                   (start-tag . font-lock-variable-name-face)))))
    (cond (document-is-html
           (local-set-key [(meta ?M)] 'html-helper-mode)))))

(add-hook 'sgml-mode-hook 'my-sgml-mode-hook)


and it works fine for me, on Emacs 19.32 / HP-UX 9, and on 19.34 /
Windows NT 4.

I can't remember why I had to hack `sgml-markup-start' - maybe that's
related.
Technical Details
Message-ID: <uvhqq5nyf.fsf@digitivity.com>
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> <356d44df.609512637@news.ox.ac.uk>

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: Toby.Speight@digitivity.com
Subject: Re: PSGML w\XML support - syntax colouring?
Date: 1998/05/28
Message-ID: <uvhqq5nyf.fsf@digitivity.com>
X-Deja-AN: 357348766
References: <356ada45.451127207@news.ox.ac.uk> <vafemxhjaz8.fsf@ramses.cs.uni-dortmund.de> <u67irykwt.fsf@digitivity.com> <356d44df.609512637@news.ox.ac.uk>
X-Yow: I brought my BOWLING BALL - and some DRUGS!!
X-PGP-ID: 0xABBDC46D (from servers or author-info)
X-Server-Date: 28 May 1998 16:55:15 GMT
Mime-Version: 1.0 (generated by tm-edit 7.105)
Mail-Copies-To: never
Content-Type: text/plain; charset=US-ASCII
X-Author-Info: <URL:http://www.ansa.co.uk/People/tms/>
Organization: Digitivity, Inc. <URL:http://digitivity.com/>
Newsgroups: comp.text.sgml,comp.emacs,gnu.emacs.help