1 This is psgml.info, produced by makeinfo version 4.0 from psgml.texi.
4 * PSGML: (psgml). PSGML, a major mode for SGML documents.
7 Documentation for PSGML, a major mode for SGML.
9 Copyright 1994, 1996, 1998 Lennart Staflin
11 Permission is granted to make and distribute verbatim copies of this
12 manual provided the copyright notice and this permission notice are
13 preserved on all copies.
15 Permission is granted to copy and distribute modified versions of
16 this manual under the conditions for verbatim copying, and provided
17 that the entire resulting derived work is distributed under the terms
18 of a permission notice identical to this one.
20 Permission is granted to copy and distribute translations of this
21 manual into another language, under the above conditions for modified
22 versions, except that this permission notice may be stated in a
23 translation approved by the Free Software Foundation.
26 File: psgml.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
31 PSGML is a major mode for editing SGML documents. This is the DRAFT
32 documentation for PSGML version 1.2.
36 * Introduction:: Introduction
37 * Install:: How to install PSGML
38 * Invoke:: How to invoke PSGML
39 * Entity manager:: The Entity Manager
40 * Validate:: Running an external SGML parser
41 * SGML declaration:: Using an SGML declaration
42 * Managing the DTD:: Specifying what DTD to use
43 * Edit:: Commands for editing
44 * Display:: Appearance of text in the buffer
45 * Miscellaneous options::
46 * Bugs:: Reporting bugs
50 File: psgml.info, Node: Introduction, Next: Install, Prev: Top, Up: Top
55 PSGML is a major mode for editing SGML and XML documents. It works
56 with GNU Emacs 19.34, 20.3 and later or with XEmacs 19.9 and later.
57 PSGML contains a simple SGML parser and can work with any DTD.
58 Functions provided includes menus and commands for inserting tags with
59 only the contextually valid tags, identification of structural errors,
60 editing of attribute values in a separate window with information about
61 types and defaults, and structure based editing.
63 SGML, a language for encoding the structure of a document, is an ISO
64 standard: ISO 8879:1986 "Information processing - Text and office
65 systems - Standard Generalized Markup Language (SGML)".
67 A good introduction to SGML is `A Gentle Introduction to SGML'
68 produced by Text Encoding Initiative (this is really chapter 2 of TEI
69 P3). This can be found on
71 `ftp://ftp.ifi.uio.no/pub/SGML/TEI/P3SG.DOC'.
73 A SGML document has three major parts, in order:
75 1. SGML Declaration (`<!SGML "ISO 8879:1986" ... >')
77 2. Document Type Declaration (`<!DOCTYPE NAME ... >')
79 3. Document Element (`<NAME> ... </NAME>')
81 The SGML declaration contains general information about character
82 sets, concrete syntax, and SGML features used. PSGML does not use the
83 SGML Declaration, it can be left out, and if included is ignored. Many
84 SGML systems allow the SGML declaration to be defaulted. PSGML always
85 use the Concrete Reference Syntax but without limitations on lengths.
86 Features used has to be indicated with variables (*note SGML
89 The document type declaration specifies the valid elements and
90 entities and how they can be nested. A document type is usually needed,
91 but can reside in another file (*note Managing the DTD::).
93 The system declaration for PSGML:
94 SYSTEM "ISO 8879:1986"
96 BASESET "ISO 646-1983//CHARSET
97 International Reference Version (IRV)//ESC 2/5 4/0"
99 CAPACITY PUBLIC "ISO 8879:1986//CAPACITY Reference//EN"
101 MINIMIZE DATATAG NO OMITTAG YES RANK NO SHORTTAG YES
102 LINK SIMPLE NO IMPLICIT NO EXPLICIT NO
103 OTHER CONCUR NO SUBDOC YES 1 FORMAL YES
105 SYNTAX PUBLIC "ISO 8879:1986//SYNTAX Reference//EN"
107 GENERAL NO MODEL NO EXCLUDE NO CAPACITY NO
108 NONSGML NO SGML NO FORMAL NO
109 SDIF PACK NO UNPACK NO
112 File: psgml.info, Node: Install, Next: Invoke, Prev: Introduction, Up: Top
117 To install PSGML you first need to uncompress and unpack the source
118 archive. This is done with the `gunzip' and `tar' commands.
120 gunzip psgml-1.2.0.tar.gz; tar xf psgml-1.2.0.tar
122 This should create a subdirectory to the current directory with the
123 source code. This directory contains a `configure' command (see the
124 file INSTALL for more information about configure). You can use the
125 `configure' command to configure the package or you can load the file
126 `psgml-maint' and execute the `psgml-compile-files' command.
128 Place the `*.el' and the `*.elc' files in a directory where Emacs
129 can find it (i.e. one of the directories in the `load-path' variable,
130 you can add a directory to this variable in your `.emacs'.)
132 If you use the `configure' approach, compile psgml with `make' and
133 the you can run `make install' to install it in the system library
134 `site-lisp'. The location of `site-lisp' is figured out by
135 `configure', but you can change it in the `Makefile'.
137 Put the following line in your .emacs:
139 (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
140 (autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
142 You may also want to set up search paths for external entities,
143 *Note Entity manager::.
145 The `psgml.info' is the documentation for PSGML in the info format.
146 You can read this with the Emacs command `C-u C-h i'. You can also
147 install the file in your systems info directory and edit the `dir' file
148 to include `psgml.info' in the menu.
150 The info file `psgml.info' is created from the texinfo file
151 `psgml.texi'. The texinfo file can also be used to create a hard copy
152 of the documentation. To do this you need the TeX program and a copy
156 File: psgml.info, Node: Invoke, Next: Entity manager, Prev: Install, Up: Top
161 PSGML defines major modes called `sgml-mode' and `xml-mode'. Files
162 with extensions `.sgml', `.sgm' or `.dtd' will automatically be edited
163 in SGML mode. To edit some other file in SGML mode, type `M-x
164 sgml-mode <RET>' after finding the file. To edit XML files, type `M-x
167 If you can modify the file you can add a "Local Variables" list
168 (*note Local Variables in Files: (emacs)file variables.) to the end of
169 the file. This can make Emacs automatically set sgml mode and user
170 options when the file is loaded. The simplest Local Variables list
179 You can also put a line at the top of the file to tell emacs to use
182 <!-- -*- sgml -*- -->
184 For XML replace `sgml' with `xml' in the above examples. But
185 remember that you can't have a comment before the _SGML declaration_ or
186 the _XML declaration_.
189 File: psgml.info, Node: Entity manager, Next: Validate, Prev: Invoke, Up: Top
194 SGML can refer to an external file (really entity) with an _external
195 identifier_, this is a _public identifier_ or a _system identifier_, or
198 A typical public identifier looks like
200 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN"
202 where "ISO 8879:1986" is the owner, "ENTITIES" is the text class and
203 "Added Latin 1" is the text description (and "EN" is language).
205 A system identifier looks like
207 SYSTEM "htmlplus.dtd"
209 where "htmlplus.dtd" is a system-specific identifier.
211 To map external identifiers to file names, PSGML first searches
212 entity catalog files and then search the list of file name templates in
213 the variable `sgml-public-map'.
215 The catalog format is according to SGML/Opens resolution on entity
216 management. The catalog consists of a series of entries and comments.
217 A comment is delimited by `--' like in a markup declaration. The entry
218 types recognized are described in the following table.
221 The FILE will be used for the entity text of an entity with the
222 public identifier PUBID.
225 The FILE will be used for the entity text of an entity with the
226 name NAME. If the NAME starts with a `%' the rest of the name
227 will be matched against parameter entities.
230 The FILE will be used for the entity text of an entity used as
231 external subset of a document declaration with NAME as document
235 Used to specify a default SGML declaration. Recognized but not
236 used by PSGML other than to pass to an external validation command
237 (`sgml-validate-command').
239 When PSGML is looking for the file containing an external entity, the
240 following things will be tried in order:
242 1. Try the system identifier, as a file name, if there is a system
243 identifier and the variable `sgml-system-identifiers-are-preferred'
244 is non-`nil' and there is no elements containing `%s' in
245 `sgml-public-map'. If the system identifier is a relative file
246 name it will be relative to the directory containing the defining
249 2. Look thru each catalog in `sgml-local-catalogs' and
250 `sgml-catalog-files' in order. For each catalog look first for
251 entries matching the public identifier, if any. Then look for
252 other matching entries in the order they appear in the catalog.
254 Currently an entry will be ignored if it is matching but its file
255 is non-existent or unreadable. (This is under reconsideration,
256 perhaps it should signal error instead).
258 3. Try the system identifier, if any, as a file name. If
259 `sgml-system-identifiers-are-preferred' is `nil' and there is no
260 elements containing `%s' in `sgml-public-map'.
262 4. Try the entries in `sgml-public-map'. Using the catalogs are
263 preferred. The `sgml-public-map' may disappear in a future version
264 of PSGML (not soon though).
267 The `sgml-public-map' variable can contain a list of file name
268 templates where `%P' will be substituted with the whole public
269 identifier, owner is substituted for `%O', public text class for `%C',
270 and public text description for `%D'. The text class will be converted
271 to lower case and the owner and description will be transliterated
272 according to the variable `sgml-public-transliterations'. The
273 templates in the list is tried in order until an existing file is
274 found. The `sgml-public-map' is modeled after `sgmls' environment
275 variable `SGML_PATH' and psgml understand the following substitution
276 characters: %%, %N, %P, %S, %Y, %C, %L, %O, %T, and %V. The default
277 value of `sgml-public-map' is taken from the environment variable
280 Given the public identifier above and the file name template
281 `/usr/local/lib/sgml/%o/%c/%d', the resulting file name is
283 /usr/local/lib/sgml/ISO_8879:1986/entities/Added_Latin_1
285 Note: blanks are transliterated to `_' (and also `/' to `%') and the
286 text class is down cased.
288 - User Option: sgml-catalog-files
289 This is a list of catalog entry files. The files are in the
290 format defined in the SGML Open Draft Technical Resolution on
291 Entity Management. The Emacs variable is initialized from the
292 environment variable `SGML_CATALOG_FILES' or if this variable is
293 undefined the default is
295 ("CATALOG" "/usr/local/lib/sgml/CATALOG")
297 - User Option: sgml-local-catalogs
298 A list of SGML entity catalogs to be searched first when parsing
299 the buffer. This is used in addition to `sgml-catalog-files', and
300 `sgml-public-map'. This variable is automatically local to the
303 - User Option: sgml-system-identifiers-are-preferred
304 If `nil', PSGML will look up external entities by searching the
305 catalogs in `sgml-local-catalogs' and `sgml-catalog-files' and
306 only if the entity is not found in the catalogs will a given system
307 identifier be used. If the variable is non-nil and a system
308 identifier is given, the system identifier will be used for the
309 entity. If no system identifier is given the catalogs will
312 - User Option: sgml-public-map
313 This should be a list of file name templates. This variable is
314 initialized from the environment variable `SGML_PATH'. This is
315 the same environment variable that `sgmls' uses. If the
316 environment variable is undefined the default is
318 ("%S" "/usr/local/lib/sgml/%o/%c/%d")
321 File: psgml.info, Node: Validate, Next: SGML declaration, Prev: Entity manager, Up: Top
323 Running an external SGML parser
324 *******************************
326 PSGML can not validate an SGML document (see below what it can and
327 can't do). If you have a validating SGML parser, like `sgmls', you can
328 run the parser on your file with the command `C-c C-v'
331 Some variables control this function:
333 - User Option: sgml-validate-command
334 The shell command to validate an SGML document.
336 This is a `format' control string that by default should contain
337 two `%s' conversion specifications: the first will be replaced by
338 the value of `sgml-declaration' (or the empty string, if nil); the
339 second will be replaced by the current buffer's file name (or the
340 empty string, if nil).
342 If `sgml-validate-files' is non-nil, the format string should
343 contain one `%s' conversion specification for each element of its
346 If sgml-validate-command is a list, then every element should be a
347 string. The strings will be tried in order and `%'-sequences in
348 the string will be replaced according to the list below, if the
349 string contains `%'-sequences with no replacement value the next
350 string will be tried.
353 means the visited file of the current buffer
356 means the SGML declaration specified in the sgml-declaration
360 means the file containing the DOCTYPE declaration, if not in
363 The default value is `nsgmls -s %s %s'.
365 - User Option: sgml-validate-files
366 If non-nil, a function of no arguments that returns a list of file
367 names. These file names will serve as the arguments to the
368 `sgml-validate-command' format control string instead of the
371 - User Option: sgml-declaration
372 The name of the SGML declaration file.
374 - User Option: sgml-offer-save
375 If non-nil, `C-c C-v' (`sgml-validate') will ask about saving
376 modified buffers before running the validate command. The default
379 The built-in parser can find some markup errors. The command `C-c
380 C-o' (`sgml-next-trouble-spot') is the best way to use the built-in
381 parser for this. To check the whole file go to the beginning of the
382 buffer and use `C-c C-o'.
384 Some of the markup errors not found are:
386 * Errors in the SGML declaration.
388 * Errors in attribute specifications.
390 * Omitted start-tags for empty elements.
393 File: psgml.info, Node: SGML declaration, Next: Managing the DTD, Prev: Validate, Up: Top
398 PSGML does not understand the SGML declaration, it accepts one in the
399 file but it is ignored. If you have the SGML declaration in another
400 file you can make `sgmls' use it when you use the `C-c C-v'
401 (`sgml-validate') command (*note Validate::).
403 PSGML has some options in what features it uses and what markup it
404 creates. You have to set these options to make PSGML's behavior
405 consistent with your SGML declaration and personal preferences.
407 - User Option: sgml-omittag
408 Set this to `t' if the SGML declaration has `OMITTAG YES' and to
411 - User Option: sgml-shorttag
412 Set this to `t' if the SGML declaration has `SHORTTAG YES' and to
415 - User Option: sgml-always-quote-attributes
416 If non-nil, quote all attribute values inserted after finishing
417 edit attributes. If this variable is `nil' and `sgml-shorttag' is
418 non-`nil', attribute values that consists of only name characters
421 - User Option: sgml-minimize-attributes
422 Determines minimization of attributes inserted by edit-attributes.
423 If non-nil, omit attribute name if the attribute value is from a
424 token group. If `max', omit attributes with default value.
425 Minimization will only be done if they produce legal SGML (assuming
426 `sgml-omittag' and `sgml-shorttag' are set correctly).
429 File: psgml.info, Node: Managing the DTD, Next: Edit, Prev: SGML declaration, Up: Top
431 Document Type Declaration
432 *************************
434 PSGML needs to know about the DTD you are using for many of its
435 commands. If you do not have a `DOCTYPE' declaration in your file,
436 PSGML will try assume that there is one of the form
438 <!DOCTYPE NAME SYSTEM>
440 where NAME is the value of `sgml-default-doctype-name', if the value
441 is non-`nil', else the GI of the first tag will be used.
443 PSGML will try to parse the document type declaration the first time
444 you do something that needs to parse the document or immediately if the
445 variable `sgml-auto-activate-dtd' is `t'. You can also initiate the
446 parsing of the document type declaration with the command
447 `sgml-parse-prolog'. Big DTDs take some time to parse.
449 When the DTD has been parsed or loaded the name of the document
450 element will be displayed in the mode line inside brackets. If there
451 was an error parsing the DTD or there is no DTD, the mode line will
452 display `[ANY]' (*** this is not really correct! a DTD will be
453 established even if there are missing entities, it may even be empty).
457 * Precompiled DTD Subsets::
458 * Using a Split Document::
459 * Inserting a DOCTYPE::
460 * Information from the DTD::
463 File: psgml.info, Node: Precompiled DTD Subsets, Next: Using a Split Document, Prev: Managing the DTD, Up: Managing the DTD
465 Precompiled DTD Subsets
466 =======================
468 If parsing the DTD takes too long time you can arrange to have PSGML
469 cache an internal complied version of the DTD. Caching can be done of
470 DTD fragments in favourable situations. It is possible to have an
471 external DTD subset cached but still have an internal DTD subset as long
472 as the internal subset does not define parameter entities that affect
473 the parsing of the external subset (*** what is the exact conditions?,
474 probably you can't use the cached external subset if the internal subset
475 defines parameter entities that are also defined in the external subset
478 To enable caching you have to create special catalog files, hereafter
479 called ECAT files due to (temporary) lack of imagination. These
480 catalogs have similar syntax to the entity catalogs and there are two
481 variables containing lists of catalogs to search: `sgml-ecat-files' and
482 `sgml-local-ecat-files'. The ECAT files can contain the following
485 `file DTDFILE ENTITYDEF CFILE'
486 The DTDFILE is the name of a file containing a DTD subset that
487 should be cached in CFILE. The ENTITYDEF is optional and if given
488 have the following syntax:
489 [ NAME1 LITERAL1 NAME2 LITERAL2 ... ]
490 Using ENTITYDEF will modify the DTD subset by defining the
491 parameter entity with name NAME1 to be LITERAL1, .... The cached
492 version of the subset will be created with those entity
493 definitions, and when PSGML search for a matching cached subset
494 will check that the parameter entities in ENTITYDEF has been
495 defined with those values before trying to use `cfile'.
497 `public PUBID ENTITYDEF CFILE'
498 Cache the DTD subset with public identifier PUBID in file CFILE.
500 - User Option: sgml-recompile-out-of-date-cdtd
501 If non-`nil', out of date compiled DTDs will be automatically
502 recompiled. If the value is `ask', PSGML will ask before
503 recompiling. A `nil' value will cause PSGML to silently load an
504 out of date compiled DTD. A DTD that refers to undefined external
505 entities is always out of date, thus in such case it can be useful
506 to set this variable to `nil'.
508 Previous versions of PSGML have had another way of speeding up DTD
509 parsing. This code remains in this version of PSGML, but is not
510 actively maintained and may disappear in the future.
512 You can save the parsed DTD in a file using the command `M-x
513 sgml-save-dtd'. Next time PSGML can load that file instead of parsing
514 the DTD. For PSGML to find the saved DTD you must either save the DTD
515 using the default name or do a `M-x sgml-save-options' after saving the
516 DTD. To directly use an already parsed and saved DTD, load the file
517 containing the saved DTD with the command `M-x sgml-load-dtd'.
519 - User Option: sgml-default-dtd-file
520 This is the default file name for saved DTD. This is set by
521 `sgml-mode' to the buffer file name less extension plus the
522 extension `.ced', if that file exists. Can be changed in the Local
523 variables section of the file.
526 File: psgml.info, Node: Using a Split Document, Next: Inserting a DOCTYPE, Prev: Precompiled DTD Subsets, Up: Managing the DTD
528 Using a Split Document
529 ======================
531 You can have the `DOCTYPE' declaration in another file by setting
532 `sgml-doctype' to the other file.
534 - User Option: sgml-parent-document
535 Used when the current file is part of a bigger document.
537 The variable describes how the current file's content fit into the
538 element hierarchy. The variable should have the form
540 (PARENT-FILE CONTEXT-ELEMENT* TOP-ELEMENT (HAS-SEEN-ELEMENT*)?)
543 is a string, the name of the file containing the document
547 is a string, that is the name of an element type. It can
548 occur 0 or more times and is used to set up exceptions and
549 short reference map. Good candidates for these elements are
550 the elements open when the entity pointing to the current
554 is a string that is the name of the element type of the top
555 level element in the current file. The file should contain
556 one instance of this element, unless the last (lisp) element
557 of sgml-parent-document is a list. If it is a list, the top
558 level of the file should follow the content model of
562 is a string that is the name of an element type. This
563 element is satisfied in the content model of top-element.
566 File: psgml.info, Node: Inserting a DOCTYPE, Next: Information from the DTD, Prev: Using a Split Document, Up: Managing the DTD
571 *** Describe the DTD menu in general. Describe customized entries
572 for special DTDs. Mention `C-c C-u C-d' for inserting a DOCTYPE from
575 If you change the doctype you must execute `sgml-parse-prolog',
576 changes in the doctype are not automatically recognized.
578 - User Option: sgml-custom-dtd
579 Menu entries to be added to the DTD menu. The value should be a
580 list of entries to be added to the DTD menu.
582 Every entry should be a list. The first element of the entry is a
583 string used as the menu entry. The second element is a string
584 containing a doctype declaration (this can be nil if no doctype).
585 The rest of the list should be a list of variables and values.
586 For backward compatibility a single string instead of a variable
587 is assigned to `sgml-default-dtd-file'. All variables are made
588 buffer local and are also added to the buffers local variables
591 When an entry is selected from the DTD menu, the doctype
592 declaration will be inserted, the variables will be set to the
593 values in the entry and a local variables list will be created in
599 sgml-default-dtd-file "~/sgml/html.ced"
600 sgml-omittag nil sgml-shorttag nil)
601 ("HTML+" "<!doctype htmlplus system 'htmlplus.dtd'>"
602 "~/sgml/htmlplus.ced"
603 sgml-omittag t sgml-shorttag nil)
604 ("DOCBOOK" "<!doctype docbook system 'docbook.dtd'>"
606 sgml-omittag nil sgml-shorttag t)))
609 File: psgml.info, Node: Information from the DTD, Prev: Inserting a DOCTYPE, Up: Managing the DTD
611 Information from the DTD
612 ========================
614 PSGML can list various information about the current DTD. The
615 following commands can be used via `M-x' and can also be found in the
618 `sgml-general-dtd-info'
619 Display information about the current DTD.
621 `sgml-describe-element-type'
622 Describe the properties of an element type as declared in the
625 `sgml-describe-entity'
626 Describe the properties of an entity as declared in the current
630 Will list all elements and the attributes declared for the element.
632 `sgml-list-attributes'
633 Will list all attributes declared and the elements that use them.
635 `sgml-list-terminals'
636 Will list all elements that can contain data.
638 `sgml-list-occur-in-elements'
639 Will list all element types and where it can occur.
641 `sgml-list-content-elements'
642 Will list all element types and the element types that can occur
646 File: psgml.info, Node: Edit, Next: Display, Prev: Managing the DTD, Up: Top
653 * Insert:: Inserting Markup
654 * Complete:: Markup completion
655 * Information:: Showing information
656 * Indent:: Indentation according to structure
657 * Move:: Move in the element structure
658 * Attributes:: Editing attributes
659 * Change and delete:: Changing and deleting markup
660 * Translating characters and entities::
663 File: psgml.info, Node: Insert, Next: Complete, Prev: Edit, Up: Edit
668 The commands that insert start-tags works only if the document has an
671 Keyboard commands for inserting:
674 Will ask, for the tag to insert, in the mini-buffer with
675 completion on the tags that are valid at point (`sgml-insert-tag').
677 If `sgml-auto-insert-required-elements' is non-nil, tags for
678 elements required between the inserted tags will also be inserted.
680 The list of valid tags, computed for a position in the buffer, will
683 1. The end-tag for the current element, if it can be ended at
684 the position. Furthermore it will contain end-tags for
685 enclosing elements if the necessary omissible end-tag
686 declarations have been made in the DTD.
688 2. The start-tags of all elements that could occur after point.
689 If `sgml-omittag-transparent' is nil, the above will be
690 limited to the elements that can occur within the current
694 Insert start and end-tags for an element (`sgml-insert-element').
695 The name of the element is read from the mini-buffer with
696 completion on valid elements. If
697 `sgml-insert-end-tag-on-new-line' is non-nil or the element has
698 element content, the end-tag will be inserted on a new line after
701 If `sgml-omittag-transparent' is nil, the list of valid elements
702 will only contain the elements that can be in the content of the
705 Required elements in the content will be automatically inserted if
706 the option `sgml-auto-insert-required-elements' is non-nil. When
707 the content model demands an element but there is more than one to
708 choose from, a comment can be inserted with the available choices
709 if the option `sgml-insert-missing-element-comment' is non-nil.
712 Inserts a new element in the current element where it is legal.
713 Prompts for element name with completion. The completion list
714 contains all elements that could be added to the current element
715 somewhere, without making the content invalid. This assumes that
716 the content is valid to begin with. Currently this list only has
717 regular elements, not inclusions. The new element will be inserted
718 as late as possible in the current element (unless prefix argument
719 is given, then as early as possible.)
722 Makes the region into a new element (`sgml-tag-region'). Reads
723 element name from mini-buffer with completion as for `C-c C-e'.
726 Inserts an end-tag for the current element (`sgml-insert-end-tag').
729 Split the current element at point. If repeated, the containing
730 element will be split before the beginning of then current element.
732 Typical use is to start a new paragraph element when inside a
736 Read attribute name and value from mini-buffer and insert attribute
737 specification (`sgml-insert-attribute'). If point is immediately
738 after a start-tag, this command operates on that start-tag.
739 Otherwise the command will operate on the element after point.
741 The attribute name will be read with completion. If the attribute
742 has a token list as declared value the attribute value will also
743 be read with completion. The prompt for attribute value will
746 Value for ATTRIBUTE (TYPE Default: CURRENT VALUE):
749 Give keyboard access to the customized part of the Markup menu.
750 Emacs will prompt for the markup to insert using the menu line as
751 selector. (See SGML-CUSTOM-MARKUP below.)
756 Selecting from this menu will insert markup. The menu contains
757 sub menus with tags and with entities, some other markup and a user
763 Pops up a menu of valid elements and insert start and end-tags for
764 the selected element. Selections from the menu works like the `C-c
768 Pops up a menu of valid start-tags and insert the selected tag.
769 The menu has the same start-tags as the completion list for `C-c
773 Pops up a menu of valid end-tags and insert the selected tag.
776 Pops up a menu of valid elements and tag the region with the
777 selection. Selections from the menu works like the `C-c C-r'
781 Menu of all general entities defined in the DTD.
783 `Add Element to Element'
784 Pops up a menu of all elements valid somewhere in the current
785 element. The menu contains all elements that could be added to
786 the current element somewhere, without making the content invalid.
787 The new element will be inserted as late as possible in the
791 Pops up a menu with all the attributes of an element. The element
792 is either the one which start-tag is immediately before point or
793 the element after point. Selecting from this menu edits the
794 attribute specification list for the element.
796 The menu has a sub menu for every attribute which declared value
797 is a token list. The rest of the attributes are collected in one
798 sub menu. For the token list attributes, selecting a value will
799 insert that attribute-value pair. Selecting some other attribute
800 reads the attribute-value from the mini-buffer and inserts the
801 attribute value pair.
803 A menu is also available directly with a mouse button click in the
804 buffer. In GNU Emacs it is the first mouse button combined with shift
805 (`S-<mouse-1>'). In Lucid Emacs it is bound to the third mouse button.
806 The mouse button click will pop-up a menu of valid tags or a menu of
807 attributes if the point is in a start-tag. The attributes menu works
808 as the "Insert attribute" menu from the menu-bar. The tags list is the
809 list of valid tags described above for command `C-c <'. Selection from
810 the tags menu works like the `C-c <' command, with the following
813 You can tag a region, with start and end-tag. There are two ways to
814 indicate the region to mark:
816 1. Use the normal mouse commands to mark region.
818 For this to work you must either use "transient mark mode" (*note
819 Transient Mark Mode: (emacs)Transient Mark.) or set the option
820 `sgml-tag-region-if-active' to non-nil (don't set this unless you
821 are sure that you want it).
823 2. Alternatively make a secondary selection, this is done by holding
824 down the meta key and using the mouse buttons. *Note Secondary
825 selection: (emacs)Secondary selection. Some window managers
826 intercept these events, which makes it hard use the secondary
829 - User Option: sgml-balanced-tag-edit
830 If non-nil, inserting a start-tag using the context menu will also
831 insert the corresponding end-tag.
833 - User Option: sgml-auto-insert-required-elements
834 If non-nil, automatically inserts required elements in the content
835 of an inserted element.
837 - User Option: sgml-omittag-transparent
838 If non-nil, will show legal tags inside elements with omissible
839 start-tags and legal tags beyond omissible end-tags.
841 - User Option: sgml-tag-region-if-active
842 If non-nil, the `Insert tags' menu will tag a region if the region
843 is considered active by emacs. If nil, region must be active and
844 `transient-mark-mode' must be on for the region to be tagged.
846 - User Option: sgml-custom-markup
847 Menu entries to be added to the Markup menu. The value should be
848 a list of lists of two strings. The first string is the menu line
849 and the second string is the text inserted when the menu item is
850 selected. The second string can contain a `\r' where the cursor
851 should be left. Also, if a selection is made according to the
852 same rules as for the `S-mouse-1' menu, the selection is replaced
853 with the second string and `\r' is replaced with the selection.
857 (("Version1" "<![%Version1[\r]]>")
858 ("New page" "<?NewPage>"))
860 - User Option: sgml-insert-missing-element-comment
861 If non-nil, and sgml-auto-insert-required-elements also true,
862 `sgml-insert-element' will insert a comment if there is an element
863 required but there is more than one to choose from.
865 - User Option: sgml-insert-end-tag-on-new-line
866 If non-nil, `sgml-insert-element' will put the end-tag on a new
867 line after the start-tag. Useful on slow terminals if you find
868 the end-tag after the cursor irritating.
871 File: psgml.info, Node: Complete, Next: Information, Prev: Insert, Up: Edit
876 If you are typing in markup directly, `M-TAB' will help you by
877 completing a tag name, an entity name or a markup declaration name. If
878 you type `M-TAB' after a plain word, `ispell-complete-word' will be
881 If you have typed (-!- marks the position of point)
885 and type `M-TAB' (assuming you use the `ISOLat1' entity set) you get:
890 File: psgml.info, Node: Information, Next: Indent, Prev: Complete, Up: Edit
895 Commands for showing information obtained by parsing the buffer.
898 Shows in the message area: context at point, if in a tag or in
899 mixed content and the open elements (`sgml-show-context').
902 Shows what element the character after point (under the cursor)
903 belongs to; also shows context of element (`sgml-what-element').
906 List contextually valid tags (`sgml-list-valid-tags'). Displays
907 information about current element, all valid end-tags, valid
908 start-tags in current element, and start-tags valid at this point
909 but in other elements together with the tags omitted.
911 You can make the mode-line display the name of the current open
912 element by setting the `sgml-live-element-indicator' variable. Setting
913 this will make all commands slower due to the work needed to keep the
914 mode-line up to date.
916 - User Option: sgml-live-element-indicator
917 If non-nil, indicate current element in mode line.
919 NOTE: Setting this implies that every command can cause a parse.
922 File: psgml.info, Node: Indent, Next: Move, Prev: Information, Up: Edit
924 Indentation according to structure
925 ==================================
927 You can indent a line according to the depth of element nesting at
928 the beginning of the line. To indent the current line use `<TAB>'.
929 You can also use `<LFD>' (`newline-and-indent') to start a new line
930 with correct indentation.
932 - User Option: sgml-indent-step
933 How much to increment indent for every element level. If nil, no
936 If this is nil, `<TAB>' will insert a tab instead of indenting.
938 - User Option: sgml-indent-data
939 If non-nil, indent in data/mixed context also.
942 File: psgml.info, Node: Move, Next: Attributes, Prev: Indent, Up: Edit
944 Move in the element structure
945 =============================
947 These commands move in the element structure. The commands uses
948 knowledge of SGML syntax, and if available the specific DTD.
951 Move to the (content) beginning of the current element
952 (`sgml-beginning-of-element').
955 Move to the (content) end of the current element
956 (`sgml-end-of-element').
959 Move forward by element (`sgml-forward-element').
962 Move backward by element (`sgml-backward-element').
965 Move up to before current element (`sgml-backward-up-element').
968 Move up to after current element (`sgml-up-element').
971 Move down to the (content) beginning of the next element
972 (`sgml-down-element').
975 Move to the next place where data is allowed
976 (`sgml-next-data-field').
978 You can also move to the next place where there is some structural
979 error with `C-c C-o' (*note Validate::).
982 File: psgml.info, Node: Attributes, Next: Change and delete, Prev: Move, Up: Edit
987 If you want to change the attributes of a start-tag you can simply
988 edit them directly in the buffer. Or you can place the cursor at or
989 after the start-tag and use the `sgml-edit-attributes' command,
990 available from the `SGML'-menu or on `C-c C-a'. This will create a new
991 Emacs window with all possible attributes listed in the form
993 ATTRIBUTE NAME = CURRENT VALUE.
995 The CURRENT VALUE may be shown as `#DEFAULT' if the attribute has
996 not been given a value in the start-tag. The list also contains the
997 attributes declaration as a comment. Note also that the CURRENT VALUE
998 is show without eventual quotes.
1000 It is now possible to edit the attribute values. You can move to the
1001 next attribute with `<TAB>'. If you want to let an attribute have its
1002 default value use `C-c C-d', this will insert a `#DEFAULT' in the value
1005 If Emacs is running in an X window, the `#DEFAULT' will be
1006 underlined to distinguish it from normal values.
1008 Finish the editing with `C-c C-c'; this will replace the attribute
1009 values in the main buffer with those edited. Note that values will be
1012 If you want to abort the editing, you can remove the window with
1013 `C-x 0' or if you want it neat, kill the buffer and remove the window.
1015 Some other keys are:
1017 Go to the beginning of the value field
1018 (`sgml-edit-attrib-field-start').
1021 Go to the end of the value field (`sgml-edit-attrib-field-end').
1024 Clear the value field (`sgml-edit-attrib-clear').
1027 Set the value field to `#DEFAULT' (`sgml-edit-attrib-default').
1028 This is a special value that will make the attribute be implied.
1031 File: psgml.info, Node: Change and delete, Next: Translating characters and entities, Prev: Attributes, Up: Edit
1033 Changing and deleting markup
1034 ============================
1037 Change the name of the current element
1038 (`sgml-change-element-name'). Tries to translate attribute
1039 specifications. An attribute will be translated to an attribute
1040 with the same name. If the new element has no attribute with the
1041 same name, the attribute will be ignored. If there is an
1042 attribute with the same name but different declared content, a
1045 ID attributes are handled specially, an attribute with declared
1046 value ID will always be translated to the attribute with declared
1050 Kill next tag, markup declaration or process instruction
1051 (`sgml-kill-markup').
1054 Kill the element following the cursor (`sgml-kill-element').
1057 Remove tags from current element (`sgml-untag-element').
1060 Convert character after point to a character reference
1061 (`sgml-make-character-reference'). If called with a numeric
1062 argument, convert a character reference back to a normal character.
1065 Fills an element as a paragraph (`sgml-fill-element'). This is a
1066 substitute for the normal `fill-paragraph'. The command uses
1067 heuristics to decide what should be a paragraph.
1069 1. If point is in an element content, recursively fill the
1072 2. Find the biggest element with mixed content containing point.
1074 3. If the above element is mixed but contains elements with pure
1075 element content then fill what is between the pure elements
1076 as paragraphs and fill the pure elements recursively.
1078 `M-x sgml-expand-all-shortrefs'
1079 Short references to text entities are expanded to the replacement
1080 text of the entity other short references are expanded into
1081 general entity references. If argument, TO-ENTITY, is non-`nil',
1082 or if called interactive with numeric prefix argument, all short
1083 references are replaced by generally entity references.
1085 `M-x sgml-normalize'
1086 Normalize the document in the buffer. This will
1088 1. expand short references,
1090 2. insert missing tags,
1092 3. replace minimized tags with full tags,
1094 4. fix attribute specification lists according to options set.
1096 There is one argument, TO-ENTITY, with the same meaning as for
1097 `sgml-expand-all-shortrefs'.
1099 There is one option for the normalize command. With its default
1100 value, normalize may actually change the data content of some
1101 elements. But only by removing some white-space from the end of
1102 elements with omitted end-tags.
1104 - User Option: sgml-normalize-trims
1105 If non-nil, `sgml-normalize' will trim off white space from end of
1106 element when adding end-tag.
1111 File: psgml.info, Node: Translating characters and entities, Prev: Change and delete, Up: Edit
1113 Translating between characters and entity references
1114 ====================================================
1116 Set the variable `sgml-display-char-list-filename' to a file that
1117 contains mappings between all characters present in the presentation
1118 character set, and their "standard replacement text" names, e.g. "Ã¥" ->
1121 The default value for this variable is `iso88591.map'.
1123 Then use the functions (also in the Modify menu)
1125 `sgml-charent-to-display-char'
1127 `sgml-display-char-to-charent'
1128 to translate between entities and characters.
1131 File: psgml.info, Node: Display, Next: Miscellaneous options, Prev: Edit, Up: Top
1133 Appearance of text in the buffer
1134 ********************************
1138 * Fold:: Folding editing
1140 * Highlight:: Highlighting markup
1143 File: psgml.info, Node: Fold, Next: Hiding markup, Prev: Display, Up: Display
1148 With these commands you can make parts of the text temporarily
1149 invisible to make it easier to see the overall structure of your text.
1151 When folding a region all the lines but the first will be invisible.
1152 The first line of the region will still be visible with an ellipsis at
1155 *Note Outline Mode: (emacs)Outline Mode.
1158 The region between point and mark will be folded
1159 (`sgml-fold-region').
1162 The region between the start and end of the current element will be
1163 folded (`sgml-fold-element').
1165 This command can also fold the SGML declaration or the DOCTYPE
1169 Fold all the sub elements of the current element
1170 (`sgml-fold-subelement').
1174 Unfold the current line, assuming it is the first line of a folded
1175 region (`sgml-unfold-line').
1178 Make all lines in current element visible (`sgml-unfold-element').
1181 Make all lines in current buffer visible (`sgml-unfold-all').
1184 Unfold current element and then fold the subelements
1185 (`sgml-expand-element'). If the current element is folded this
1186 expands what is visible.
1189 File: psgml.info, Node: Hiding markup, Next: Highlight, Prev: Fold, Up: Display
1194 *** Describe hide-tags
1197 File: psgml.info, Node: Highlight, Prev: Hiding markup, Up: Display
1202 PSGML can highlight the markup giving the markup a different "face"
1203 (*note Using Multiple Typefaces: (emacs)Faces.). The highlighting will
1204 only be done if the variable `sgml-set-face' is non-`nil'. The default
1205 settings make tags bold and comments italic, but this can be modified
1206 with the variable `sgml-markup-faces'. When highlighting is on PSGML
1207 will parse after every command until the whole buffer has been parsed
1208 or user event occurs.
1210 To remove the highlighting type `M-x sgml-clear-faces'.
1212 - User Option: sgml-set-face
1213 If non-nil, psgml will set the face of parsed markup.
1215 - User Option: sgml-markup-faces
1216 A list of markup to face mappings. Each element looks like
1217 `(MARKUP-TYPE . FACE)'. Possible values for MARKUP-TYPE is:
1229 ignored marked section
1232 marked section end, if not ignored
1235 marked section start, if not ignored
1238 processing instruction
1253 File: psgml.info, Node: Miscellaneous options, Next: Bugs, Prev: Display, Up: Top
1255 Miscellaneous options
1256 *********************
1258 *** describe sgml-save-options
1260 - User Option: sgml-ignore-undefined-elements
1261 Start-tags for undefined elements will either be ignored, if
1262 `sgml-ignore-undefined-elements' is `t', or assumed to be
1263 acceptable in the current element and defined with `O O ANY'
1265 - User Option: sgml-range-indicator-max-length
1266 Maximum number of characters used from the first and last entry of
1267 a sub-menu to indicate the range of that menu.
1269 This is used for long menus of elements, tags or entities that are
1270 split into `sgml-max-menu-size' big sub-menus.
1273 File: psgml.info, Node: Bugs, Next: Index, Prev: Miscellaneous options, Up: Top
1278 If you encounter something that you think is a bug, please report
1279 it. Try to include a clear description of the undesired behaviour. A
1280 test case that exhibits the bug, would also be useful.
1282 You can report a bug with the command `M-x sgml-submit-bug-report'.
1284 When PSGML needs contextual information it parses the document up to
1285 the point. During the parsing, it builds a parse tree. The parse tree
1286 is used to initialize the next parse, to avoid having to parse things
1287 already parsed. Changes to the buffer is supposed to prune the tree of
1288 all outdated information. But if you get strange complaints from the
1289 parser, try and back up a bit and use `C-c C-o'
1290 (`sgml-next-trouble-spot').
1293 File: psgml.info, Node: Index, Prev: Bugs, Up: Top
1301 * <TAB> <1>: Indent.
1302 * <TAB>: Attributes.
1304 * C-c #: Change and delete.
1306 * C-c -: Change and delete.
1309 * C-c =: Change and delete.
1310 * C-c C-a: Attributes.
1311 * C-c C-c <1>: Information.
1312 * C-c C-c: Attributes.
1313 * C-c C-d <1>: Attributes.
1314 * C-c C-d <2>: Move.
1315 * C-c C-d: Attributes.
1317 * C-c C-f C-e: Fold.
1318 * C-c C-f C-r: Fold.
1319 * C-c C-f C-s: Fold.
1320 * C-c C-f C-x: Fold.
1322 * C-c C-k <1>: Attributes.
1323 * C-c C-k: Change and delete.
1325 * C-c C-o: Validate.
1326 * C-c C-q: Change and delete.
1329 * C-c C-t: Information.
1330 * C-c C-u C-a: Fold.
1331 * C-c C-u C-d: Inserting a DOCTYPE.
1332 * C-c C-u C-e: Fold.
1333 * C-c C-u C-l: Fold.
1334 * C-c C-u C-m: Insert.
1335 * C-c C-v: Validate.
1336 * C-c C-w: Information.
1344 * C-M-k: Change and delete.
1346 * CONCUR: Introduction.
1347 * DATATAG: Introduction.
1348 * DOCTYPE: Managing the DTD.
1349 * DTD <1>: Information from the DTD.
1350 * DTD: Managing the DTD.
1351 * Element: Information from the DTD.
1352 * entity: Information from the DTD.
1353 * entity catalog: Entity manager.
1354 * external identifier: Entity manager.
1356 * LINK: Introduction.
1358 * major mode: Invoke.
1359 * newline-and-indent: Indent.
1360 * OMITTAG: SGML declaration.
1361 * public identifier: Entity manager.
1362 * RANK: Introduction.
1363 * S-<mouse-1>: Insert.
1364 * SGML Declaration: Introduction.
1365 * sgml-add-element-to-element: Insert.
1366 * sgml-always-quote-attributes: SGML declaration.
1367 * sgml-auto-activate-dtd: Managing the DTD.
1368 * sgml-auto-insert-required-elements: Insert.
1369 * sgml-backward-element: Move.
1370 * sgml-backward-up-element: Move.
1371 * sgml-balanced-tag-edit: Insert.
1372 * sgml-beginning-of-element: Move.
1373 * sgml-catalog-files: Entity manager.
1374 * sgml-change-element-name: Change and delete.
1375 * sgml-charent-to-display-char: Translating characters and entities.
1376 * sgml-clear-faces: Highlight.
1377 * sgml-complete: Complete.
1378 * sgml-custom-dtd: Inserting a DOCTYPE.
1379 * sgml-custom-markup: Insert.
1380 * sgml-declaration: Validate.
1381 * sgml-default-doctype-name: Managing the DTD.
1382 * sgml-default-dtd-file: Precompiled DTD Subsets.
1383 * sgml-describe-element-type: Information from the DTD.
1384 * sgml-describe-entity: Information from the DTD.
1385 * sgml-display-char-to-charent: Translating characters and entities.
1386 * sgml-doctype: Using a Split Document.
1387 * sgml-down-element: Move.
1388 * sgml-ecat-files: Precompiled DTD Subsets.
1389 * sgml-edit-attrib-clear: Attributes.
1390 * sgml-edit-attrib-default: Attributes.
1391 * sgml-edit-attrib-field-end: Attributes.
1392 * sgml-edit-attrib-field-start: Attributes.
1393 * sgml-edit-attributes: Attributes.
1394 * sgml-end-of-element: Move.
1395 * sgml-expand-all-shortrefs: Change and delete.
1396 * sgml-expand-element: Fold.
1397 * sgml-fill-element: Change and delete.
1398 * sgml-fold-element: Fold.
1399 * sgml-fold-region: Fold.
1400 * sgml-fold-subelement: Fold.
1401 * sgml-forward-element: Move.
1402 * sgml-general-dtd-info: Information from the DTD.
1403 * sgml-ignore-undefined-elements: Miscellaneous options.
1404 * sgml-indent-data: Indent.
1405 * sgml-indent-or-tab: Indent.
1406 * sgml-indent-step: Indent.
1407 * sgml-insert-attribute: Insert.
1408 * sgml-insert-element: Insert.
1409 * sgml-insert-end-tag: Insert.
1410 * sgml-insert-end-tag-on-new-line: Insert.
1411 * sgml-insert-missing-element-comment: Insert.
1412 * sgml-insert-tag: Insert.
1413 * sgml-kill-element: Change and delete.
1414 * sgml-kill-markup: Change and delete.
1415 * sgml-list-attributes: Information from the DTD.
1416 * sgml-list-content-elements: Information from the DTD.
1417 * sgml-list-elements: Information from the DTD.
1418 * sgml-list-occur-in-elements: Information from the DTD.
1419 * sgml-list-terminals: Information from the DTD.
1420 * sgml-list-valid-tags: Information.
1421 * sgml-live-element-indicator: Information.
1422 * sgml-load-dtd: Precompiled DTD Subsets.
1423 * sgml-local-catalogs: Entity manager.
1424 * sgml-local-ecat-files: Precompiled DTD Subsets.
1425 * sgml-make-character-reference: Change and delete.
1426 * sgml-markup-faces: Highlight.
1427 * sgml-max-menu-size: Miscellaneous options.
1428 * sgml-minimize-attributes: SGML declaration.
1429 * sgml-mode: Invoke.
1430 * sgml-next-data-field: Move.
1431 * sgml-next-trouble-spot: Validate.
1432 * sgml-normalize: Change and delete.
1433 * sgml-normalize-trims: Change and delete.
1434 * sgml-offer-save: Validate.
1435 * sgml-omittag: SGML declaration.
1436 * sgml-omittag-transparent: Insert.
1437 * sgml-parent-document: Using a Split Document.
1438 * sgml-parse-prolog: Managing the DTD.
1439 * sgml-public-map: Entity manager.
1440 * sgml-range-indicator-max-length: Miscellaneous options.
1441 * sgml-recompile-out-of-date-cdtd: Precompiled DTD Subsets.
1442 * sgml-save-dtd: Precompiled DTD Subsets.
1443 * sgml-set-face: Highlight.
1444 * sgml-shorttag: SGML declaration.
1445 * sgml-show-context: Information.
1446 * sgml-split-element: Insert.
1447 * sgml-system-identifiers-are-preferred: Entity manager.
1448 * sgml-tag-region: Insert.
1449 * sgml-tag-region-if-active: Insert.
1450 * sgml-unfold-all: Fold.
1451 * sgml-unfold-element: Fold.
1452 * sgml-unfold-line: Fold.
1453 * sgml-untag-element: Change and delete.
1454 * sgml-up-element: Move.
1455 * sgml-validate: Validate.
1456 * sgml-validate-command: Validate.
1457 * sgml-validate-files: Validate.
1458 * sgml-what-element: Information.
1459 * SHORTTAG: SGML declaration.
1461 * system identifier: Entity manager.
1467 Node: Introduction
\x7f1751
1468 Node: Install
\x7f4353
1469 Node: Invoke
\x7f6197
1470 Node: Entity manager
\x7f7248
1471 Node: Validate
\x7f12794
1472 Node: SGML declaration
\x7f15320
1473 Node: Managing the DTD
\x7f16812
1474 Node: Precompiled DTD Subsets
\x7f18091
1475 Node: Using a Split Document
\x7f21282
1476 Node: Inserting a DOCTYPE
\x7f22838
1477 Node: Information from the DTD
\x7f24615
1479 Node: Insert
\x7f26250
1480 Node: Complete
\x7f34955
1481 Node: Information
\x7f35456
1482 Node: Indent
\x7f36623
1484 Node: Attributes
\x7f38333
1485 Node: Change and delete
\x7f40122
1486 Node: Translating characters and entities
\x7f43046
1487 Node: Display
\x7f43709
1489 Node: Hiding markup
\x7f45325
1490 Node: Highlight
\x7f45468
1491 Node: Miscellaneous options
\x7f46842
1493 Node: Index
\x7f48351