Index: openacs-4/packages/acs-core-docs/www/psgml-mode.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/psgml-mode.html,v diff -u -r1.40 -r1.41 --- openacs-4/packages/acs-core-docs/www/psgml-mode.html 16 Feb 2005 00:21:03 -0000 1.40 +++ openacs-4/packages/acs-core-docs/www/psgml-mode.html 4 Jun 2006 00:45:24 -0000 1.41 @@ -1,4 +1,5 @@ -Using PSGML mode in Emacs

Using PSGML mode in Emacs

By David Lutterkort

+ +Using PSGML mode in Emacs

Using PSGML mode in Emacs

By David Lutterkort

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Note: nxml mode replaces and/or complements psgml mode. More information.

What it is

PSGML Mode is a mode for editing, umm, SGML and XML documents in emacs. It @@ -23,7 +24,7 @@

  • Create a file with the name CATALOG in the dtd directory and put the line

    -      CATALOG "docbook-xml/docbook.cat"
    +      CATALOG "docbook-xml/docbook.cat"
     

    in it. By maintaining your own CATALOG, it is easy to add more DTD's without changing your emacs settings. (How about that HTML 4.01 DTD you @@ -32,18 +33,18 @@ that funky CATALOG

  • What to tell emacs

    If you installed PSGML mode in a non-standard location, e.g., somewhere in your home directory, you need to add this to the load-path by adding this line to your .emacs file:

    -      (add-to-list 'load-path "/some/dir/that/contains/psgml.elc")
    +      (add-to-list 'load-path "/some/dir/that/contains/psgml.elc")
        
     

    To let PSGML mode find your CATALOG and to enable PSGML mode for all your editing, add these lines to your .emacs:

           (require 'psgml)
     
    -      (add-to-list 'auto-mode-alist '("\\.html" . sgml-mode))
    -      (add-to-list 'auto-mode-alist '("\\.adp" . xml-mode))
    -      (add-to-list 'auto-mode-alist '("\\.xml" . xml-mode))
    -      (add-to-list 'auto-mode-alist '("\\.xsl" . xml-mode))
    +      (add-to-list 'auto-mode-alist '("\\.html" . sgml-mode))
    +      (add-to-list 'auto-mode-alist '("\\.adp" . xml-mode))
    +      (add-to-list 'auto-mode-alist '("\\.xml" . xml-mode))
    +      (add-to-list 'auto-mode-alist '("\\.xsl" . xml-mode))
           
    -      (add-to-list 'sgml-catalog-files "/path/to/your/dtd/CATALOG")
    +      (add-to-list 'sgml-catalog-files "/path/to/your/dtd/CATALOG")
        
     

    If you want font-locking and indentation, you can also add these lines into the .emacs file:

    @@ -58,21 +59,21 @@
           (setq sgml-set-face t)
           (setq-default sgml-indent-data t)
           ;; Some convenient key definitions:
    -      (define-key sgml-mode-map "\C-c\C-x\C-e" 'sgml-describe-element-type)
    -      (define-key sgml-mode-map "\C-c\C-x\C-i" 'sgml-general-dtd-info)
    -      (define-key sgml-mode-map "\C-c\C-x\C-t" 'sgml-describe-entity)
    +      (define-key sgml-mode-map "\C-c\C-x\C-e" 'sgml-describe-element-type)
    +      (define-key sgml-mode-map "\C-c\C-x\C-i" 'sgml-general-dtd-info)
    +      (define-key sgml-mode-map "\C-c\C-x\C-t" 'sgml-describe-entity)
        
     

    What is a DOCTYPE ?

    All SGML and XML documents that should conform to a DTD have to declare a doctype. For the docbook XML, all your .xml files whould start with the line

    -      <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "docbookx.dtd">
    +      <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "docbookx.dtd">
        
     

    If your document is only part of a larger XML document, you can tell PSGML mode about it by appending the following lines to your file. In this case, do not include a DOCTYPE declaration in your file.

           <!--
            Local Variables:
    -       sgml-parent-document: ("top.xml" "book" "sect1")
    +       sgml-parent-document: ("top.xml" "book" "sect1")
            End:
           -->
        
    @@ -82,4 +83,4 @@
     element is a sect1.

    How to use it

    Of course, you should read the emacs texinfo pages that come with PSGML mode from start to finish. Barring that, here are some handy commands:

    KeyCommand
    C-c C-eInsert an element. Uses completion and only lets you insert elements that are valid
    C-c C-aEdit attributes of enclosing element.
    C-c C-x C-iShow information about the document's DTD.
    C-c C-x C-eDescribe element. Shows for one element which elements can be parents, -what its contents can be and lists its attributes.

    Further reading

    Start with the the section called “OpenACS Documentation Guide”

    ($Id$)
    View comments on this page at openacs.org
    +what its contents can be and lists its attributes.

    Further reading

    Start with the Section�, “OpenACS Documentation Guide”

    ($Id$)
    View comments on this page at openacs.org