Debian Codegraph @

psgml.texi

raw ◀ ▶
1 Debian patch touch this file
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename psgml.info
4 @settitle psgml
5 @c @setchapternewpage odd
6 @syncodeindex fn cp
7 @syncodeindex vr cp
8 @synindex ky cp
9 @c %**end of header
10 @c $Id: psgml.texi,v 1.8 2005/03/02 19:44:20 lenst Exp $
11
12 @ifinfo
•13 @dircategory Emacs editing modes
14 @format
•15 INFO-DIR-SECTION Emacs editing modes
16 START-INFO-DIR-ENTRY
17 * PSGML: (psgml). PSGML, a major mode for SGML documents.
18 END-INFO-DIR-ENTRY
19 @end format
20 @end ifinfo
21
22 @ifinfo
23 Documentation for PSGML, a major mode for SGML.
24
25 Copyright 1994, 1996, 1998 Lennart Staflin
26
27 Permission is granted to make and distribute verbatim
28 copies of this manual provided the copyright notice and
29 this permission notice are preserved on all copies.
30
31 @ignore
32 Permission is granted to process this file through TeX
33 and print the results, provided the printed document
34 carries a copying permission notice identical to this
35 one except for the removal of this paragraph (this
36 paragraph not being relevant to the printed manual).
37
38 @end ignore
39 Permission is granted to copy and distribute modified
40 versions of this manual under the conditions for
41 verbatim copying, and provided that the entire
42 resulting derived work is distributed under the terms
43 of a permission notice identical to this one.
44
45 Permission is granted to copy and distribute
46 translations of this manual into another language,
47 under the above conditions for modified versions,
48 except that this permission notice may be stated in a
49 translation approved by the Free Software Foundation.
50
51 @end ifinfo
52
53 @titlepage
54
55 @title Editing SGML with Emacs and PSGML
56 @author Lennart Staflin
57
58 @c The following two commands
59 @c start the copyright page.
60 @page
61 @vskip 0pt plus 1filll
62 Copyright @copyright{} 1994, 1996, 1998 Lennart Staflin
63
64 @c Published by ...
65
66 Permission is granted to make and distribute verbatim
67 copies of this manual provided the copyright notice and
68 this permission notice are preserved on all copies.
69
70 @ignore
71 Permission is granted to process this file through TeX
72 and print the results, provided the printed document
73 carries a copying permission notice identical to this
74 one except for the removal of this paragraph (this
75 paragraph not being relevant to the printed manual).
76
77 @end ignore
78 Permission is granted to copy and distribute modified
79 versions of this manual under the conditions for
80 verbatim copying, and provided that the entire
81 resulting derived work is distributed under the terms
82 of a permission notice identical to this one.
83
84 Permission is granted to copy and distribute
85 translations of this manual into another language,
86 under the above conditions for modified versions,
87 except that this permission notice may be stated in a
88 translation approved by the Free Software Foundation.
89 @end titlepage
90
91 @node Top, Introduction, (dir), (dir)
92 @comment node-name, next, previous, up
93 @ifinfo
94 @top PSGML
95
96 PSGML is a major mode for editing SGML documents. This is the DRAFT
97 documentation for PSGML version 1.4.
98 @end ifinfo
99
100 @menu
101 * Introduction:: Introduction
102 * Install:: How to install PSGML
103 * Invoke:: How to invoke PSGML
104 * Entity manager:: The Entity Manager
105 * Validate:: Running an external SGML parser
106 * SGML declaration:: Using an SGML declaration
107 * Managing the DTD:: Specifying what DTD to use
108 * Edit:: Commands for editing
109 * Display:: Appearance of text in the buffer
110 * Miscellaneous options::
111 * Bugs:: Reporting bugs
112 * Index::
113 @end menu
114
115
116 @c *** section about error recovery ??
117
118
119 @c ------------------------------------------------------------------
120
121 @node Introduction, Install, Top, Top
122 @comment node-name, next, previous, up
123 @chapter Introduction
124 @cindex CONCUR
125 @cindex DATATAG
126 @cindex LINK
127 @cindex RANK
128 @cindex SGML Declaration
129
130 PSGML is a major mode for editing SGML and XML documents. It works with
131 GNU Emacs 19.34, 20.3 and later or with XEmacs 19.9 and later. PSGML
132 contains a simple SGML parser and can work with any DTD. Functions
133 provided includes menus and commands for inserting tags with only the
134 contextually valid tags, identification of structural errors, editing of
135 attribute values in a separate window with information about types and
136 defaults, and structure based editing.
137
138 SGML, a language for encoding the structure of a document, is an ISO
139 standard: ISO 8879:1986 ``Information processing -- Text and office
140 systems -- Standard Generalized Markup Language (SGML)''.
141
142 A good introduction to SGML is @cite{A Gentle Introduction to SGML}
143 produced by Text Encoding Initiative (this is really chapter 2 of TEI
144 P3). This can be found on
145
146 @display
147 @file{ftp://ftp.ifi.uio.no/pub/SGML/TEI/P3SG.DOC}.
148 @end display
149
150 A SGML document has three major parts, in order:
151
152 @enumerate
153 @item
154 SGML Declaration (@samp{<!SGML "ISO 8879:1986" @dots{} >})
155 @item
156 Document Type Declaration (@samp{<!DOCTYPE @var{name} @dots{} >})
157 @item
158 Document Element (@samp{<@var{name}> @dots{} </@var{name}>})
159 @end enumerate
160
161 The SGML declaration contains general information about character sets,
162 concrete syntax, and SGML features used. PSGML does not use the SGML
163 Declaration, it can be left out, and if included is ignored. Many SGML
164 systems allow the SGML declaration to be defaulted. PSGML always use
165 the Concrete Reference Syntax but without limitations on
166 lengths. Features used has to be indicated with variables (@pxref{SGML
167 declaration}).
168
169 The document type declaration specifies the valid elements and entities
170 and how they can be nested. A document type is usually needed, but can
171 reside in another file (@pxref{Managing the DTD}).
172
173 The system declaration for PSGML:
174 @example
175 SYSTEM "ISO 8879:1986"
176 CHARSET
177 BASESET "ISO 646-1983//CHARSET
178 International Reference Version (IRV)//ESC 2/5 4/0"
179 DESCSET 0 128 0
180 CAPACITY PUBLIC "ISO 8879:1986//CAPACITY Reference//EN"
181 FEATURES
182 MINIMIZE DATATAG NO OMITTAG YES RANK NO SHORTTAG YES
183 LINK SIMPLE NO IMPLICIT NO EXPLICIT NO
184 OTHER CONCUR NO SUBDOC YES 1 FORMAL YES
185 SCOPE DOCUMENT
186 SYNTAX PUBLIC "ISO 8879:1986//SYNTAX Reference//EN"
187 @c SYNTAX PUBLIC "ISO 8879:1986//SYNTAX Core//EN"
188 VALIDATE
189 GENERAL NO MODEL NO EXCLUDE NO CAPACITY NO
190 NONSGML NO SGML NO FORMAL NO
191 SDIF PACK NO UNPACK NO
192 @end example
193
194
195 @c -------------------------------------------------------------------------
196 @node Install, Invoke, Introduction, Top
197 @comment node-name, next, previous, up
198 @chapter Installing PSGML
199
200 To install PSGML you first need to uncompress and unpack the source
201 archive. This is done with the @code{gunzip} and @code{tar} commands.
202
203 @example
204 gunzip psgml-1.2.0.tar.gz; tar xf psgml-1.2.0.tar
205 @end example
206
207 This should create a subdirectory to the current directory with the
208 source code. This directory contains a @code{configure} command (see the
209 file INSTALL for more information about configure). You can use the
210 @code{configure} command to configure the package or you can load the
211 file @file{psgml-maint} and execute the @code{psgml-compile-files}
212 command.
213
214 Place the @file{*.el} and the @file{*.elc} files in a directory where
215 Emacs can find it (i.e. one of the directories in the @code{load-path}
216 variable, you can add a directory to this variable in your
217 @file{.emacs}.)
218
219 If you use the @code{configure} approach, compile psgml with @code{make}
220 and the you can run @code{make install} to install it in the system
221 library @file{site-lisp}. The location of @file{site-lisp} is figured
222 out by @code{configure}, but you can change it in the @file{Makefile}.
223
224 Put the following line in your .emacs:
225
226 @lisp
227 (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
228 (autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
229 @end lisp
230
231 You may also want to set up search paths for external entities,
232 @xref{Entity manager}.
233
234 The @file{psgml.info} is the documentation for PSGML in the info format.
235 You can read this with the Emacs command @kbd{C-u C-h i}. You can also
236 install the file in your systems info directory and edit the
237 @file{dir} file to include @file{psgml.info} in the menu.
238
239 The info file @file{psgml.info} is created from the texinfo file
240 @file{psgml.texi}. The texinfo file can also be used to create a hard
241 copy of the documentation. To do this you need the @TeX{} program and a
242 copy of @file{texinfo.tex}.
243
244
245
246
247 @c --------------------------------------------------------------------------
248 @node Invoke, Entity manager, Install, Top
249 @comment node-name, next, previous, up
250 @chapter How to invoke PSGML
251 @cindex invoke
252 @cindex start up
253 @cindex major mode
254
255 @findex sgml-mode
256 PSGML defines major modes called @code{sgml-mode} and @code{xml-mode}.
257 Files with extensions @file{.sgml}, @file{.sgm} or @file{.dtd} will
258 automatically be edited in SGML mode. To edit some other file in SGML
259 mode, type @kbd{M-x sgml-mode @key{RET}} after finding the file.
260 To edit XML files, type @kbd{M-x xml-mode @key{RET}}.
261
262 If you can modify the file you can add a @dfn{Local Variables} list
263 (@pxref{file variables, , Local Variables in Files, emacs, The Emacs
264 Editor}) to the end of the file. This can make Emacs
265 automatically set sgml mode and user options when the file is loaded.
266 The simplest Local Variables list would look like:
267
268 @example
269 <!--
270 Local Variables:
271 mode: sgml
272 End:
273 -->
274 @end example
275
276 You can also put a line at the top of the file to tell emacs to use sgml
277 mode:
278
279 @example
280 <!-- -*- sgml -*- -->
281 @end example
282
283 For XML replace @samp{sgml} with @samp{xml} in the above examples.
284 But remember that you can't have a comment before the @emph{SGML
285 declaration} or the @emph{XML declaration}.
286
287
288 @c -------------------------------------------------------------------------
289 @node Entity manager, Validate, Invoke, Top
290 @comment node-name, next, previous, up
291 @chapter The Entity Manager
292 @cindex public identifier
293 @cindex system identifier
294 @cindex external identifier
295 @cindex entity catalog
296
297 @c *** sgml-sysid-resolve-functions
298
299 SGML can refer to an external file (really entity) with an
300 @emph{external identifier}, this is a @emph{public identifier} or a
301 @emph{system identifier}, or both.
302
303 A typical public identifier looks like
304
305 @example
306 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN"
307 @end example
308
309 @noindent
310 where ``ISO 8879:1986'' is the owner, ``ENTITIES'' is the text class and
311 ``Added Latin 1'' is the text description (and ``EN'' is language).
312
313 A system identifier looks like
314
315 @example
316 SYSTEM "htmlplus.dtd"
317 @end example
318
319 @noindent where ``htmlplus.dtd'' is a system-specific identifier.
320
321 To map external identifiers to file names, PSGML first searches entity
322 catalog files and then search the list of file name templates in the
323 variable @code{sgml-public-map}.
324
325 The catalog format is according to SGML/Opens resolution on entity
326 management. The catalog consists of a series of entries and comments. A
327 comment is delimited by @samp{--} like in a markup declaration.
328 The entry types recognized are described in the following table.
329
330 @table @samp
331
332 @item public @var{pubid} @var{file}
333 The @var{file} will be used for the entity text of an entity
334 with the public identifier @var{pubid}.
335
336 @item entity @var{name} @var{file}
337 The @var{file} will be used for the entity text of an entity
338 with the name @var{name}. If the @var{name} starts with a @samp{%} the
339 rest of the name will be matched against parameter entities.
340
341 @item doctype @var{name} @var{file}
342 The @var{file} will be used for the entity text of an entity
343 used as external subset of a document declaration with @var{name} as
344 document type name.
345
346 @item sgmldecl @var{file}
347 Used to specify a default SGML declaration. Recognized but not used by
348 PSGML other than to pass to an external validation command
349 (@code{sgml-validate-command}).
350
351 @end table
352
353 When PSGML is looking for the file containing an external entity, the
354 following things will be tried in order:
355
356 @enumerate
357
358 @vindex sgml-system-identifiers-are-preferred
359 @item
360 Try the system identifier, as a file name, if there is a system
361 identifier and the variable @code{sgml-system-identifiers-are-preferred}
362 is non-@code{nil} and there is no elements containing @samp{%s} in
363 @code{sgml-public-map}. If the system identifier is a relative file name
364 it will be relative to the directory containing the defining entity.
365
366 @item
367 Look thru each catalog in @code{sgml-local-catalogs} and
368 @code{sgml-catalog-files} in order. For each catalog look first for
369 entries matching the public identifier, if any. Then look for other
370 matching entries in the order they appear in the catalog.
371
372 Currently an entry will be ignored if it is matching but its file is
373 non-existent or unreadable. (This is under reconsideration, perhaps it
374 should signal error instead).
375
376 @item
377 Try the system identifier, if any, as a file name.
378 If @code{sgml-system-identifiers-are-preferred} is @code{nil}
379 and there is no elements containing @samp{%s} in @code{sgml-public-map}.
380
381 @item
382 Try the entries in @code{sgml-public-map}. Using the catalogs are
383 preferred. The @code{sgml-public-map} may disappear in a future version
384 of PSGML (not soon though).
385
386 @end enumerate
387
388 The @code{sgml-public-map} variable can contain a list of file name
389 templates where @samp{%P} will be substituted with the whole public
390 identifier, owner is substituted for @samp{%O}, public text class for
391 @samp{%C}, and public text description for @samp{%D}. The text class
392 will be converted to lower case and the owner and description will be
393 transliterated according to the variable
394 @code{sgml-public-transliterations}. The templates in the list is tried
395 in order until an existing file is found. The @code{sgml-public-map} is
396 modeled after @file{sgmls} environment variable @code{SGML_PATH} and
397 psgml understand the following substitution characters: %%, %N, %P, %S,
398 %Y, %C, %L, %O, %T, and %V. The default value of
399 @code{sgml-public-map} is taken from the environment variable
400 @code{SGML_PATH}.
401
402 Given the public identifier above and the file name template
403 @samp{/usr/local/lib/sgml/%o/%c/%d}, the resulting file name is
404
405 @example
406 /usr/local/lib/sgml/ISO_8879:1986/entities/Added_Latin_1
407 @end example
408
409 Note: blanks are transliterated to @samp{_} (and also @samp{/} to
410 @samp{%}) and the text class is down cased.
411
412
413
414 @defopt sgml-catalog-files
415 This is a list of catalog entry files.
416 The files are in the format defined in the SGML Open Draft Technical
417 Resolution on Entity Management. The Emacs variable is initialized from
418 the environment variable @code{SGML_CATALOG_FILES} or if this variable
419 is undefined the default is
420
421 @lisp
422 ("CATALOG" "/usr/local/lib/sgml/CATALOG")
423 @end lisp
424 @end defopt
425
426 @defopt sgml-local-catalogs
427 A list of SGML entity catalogs to be searched first when parsing the
428 buffer. This is used in addition to @code{sgml-catalog-files}, and
429 @code{sgml-public-map}. This variable is automatically local to the
430 buffer.
431 @end defopt
432
433 @defopt sgml-system-identifiers-are-preferred
434 If @code{nil}, PSGML will look up external entities by searching the
435 catalogs in @code{sgml-local-catalogs} and @code{sgml-catalog-files} and
436 only if the entity is not found in the catalogs will a given system
437 identifier be used. If the variable is non-nil and a system identifier is
438 given, the system identifier will be used for the entity. If no system
439 identifier is given the catalogs will searched.
440 @end defopt
441
442
443 @defopt sgml-public-map
444 This should be a list of file name templates. This variable is
445 initialized from the environment variable @code{SGML_PATH}. This is
446 the same environment variable that @file{sgmls} uses. If the
447 environment variable is undefined the default is
448
449 @lisp
450 ("%S" "/usr/local/lib/sgml/%o/%c/%d")
451 @end lisp
452 @c Mapping from public identifiers to file names.
453 @end defopt
454
455 @c the colon separated list in @code{SGML_PATH} is converted to a lisp list
456
457 @c -------------------------------------------------------------------------
458 @node Validate, SGML declaration, Entity manager, Top
459 @comment node-name, next, previous, up
460 @chapter Running an external SGML parser
461
462 @kindex C-c C-v
463 @findex sgml-validate
464 PSGML can not validate an SGML document (see below what it can
465 and can't do). If you have a validating SGML parser, like
466 @file{sgmls}, you can run the parser on your file with the
467 command @kbd{C-c C-v} (@code{sgml-validate}).
468
469 Some variables control this function:
470
471 @defopt sgml-validate-command
472 The shell command to validate an SGML document.
473
474 This is a @code{format} control string that by default should contain two
475 @code{%s} conversion specifications: the first will be replaced by the
476 value of @code{sgml-declaration} (or the empty string, if nil); the
477 second will be replaced by the current buffer's file name (or the
478 empty string, if nil).
479
480 If @code{sgml-validate-files} is non-nil, the format string should contain
481 one @code{%s} conversion specification for each element of its result.
482
483 If sgml-validate-command is a list, then every element should be a
484 string. The strings will be tried in order and @samp{%}-sequences in the
485 string will be replaced according to the list below, if the string contains
486 @samp{%}-sequences with no replacement value the next string will be tried.
487
488 @table @code
489 @item %b
490 means the visited file of the current buffer
491
492 @item %s
493 means the SGML declaration specified in the sgml-declaration variable
494
495 @item %d
496 means the file containing the DOCTYPE declaration, if not in the buffer
497 @end table
498
499 The default value is @code{nsgmls -s %s %s}.
500 @end defopt
501
502 @defopt sgml-validate-files
503 If non-nil, a function of no arguments that returns a list of
504 file names. These file names will serve as the arguments to the
505 @code{sgml-validate-command} format control string instead of
506 the defaults.
507 @end defopt
508
509 @defopt sgml-declaration
510 The name of the SGML declaration file.
511 @end defopt
512
513 @defopt sgml-offer-save
514 If non-nil, @kbd{C-c C-v} (@code{sgml-validate}) will ask about
515 saving modified buffers before running the validate command.
516 The default value is @code{t}.
517 @end defopt
518
519
520 @kindex C-c C-o
521 @findex sgml-next-trouble-spot
522 The built-in parser can find some markup errors. The command @kbd{C-c
523 C-o} (@code{sgml-next-trouble-spot}) is the best way to use the built-in
524 parser for this. To check the whole file go to the beginning of the
525 buffer and use @kbd{C-c C-o}.
526
527 Some of the markup errors not found are:
528
529 @itemize @bullet
530 @item
531 Errors in the SGML declaration.
532 @item
533 Errors in attribute specifications.
534 @item
535 Omitted start-tags for empty elements.
536 @end itemize
537
538
539 @c --------------------------------------------------------------------------
540 @node SGML declaration, Managing the DTD, Validate, Top
541 @comment node-name, next, previous, up
542 @chapter SGML Declaration
543 @cindex SHORTTAG
544 @cindex OMITTAG
545 @cindex NAMECASE GENERAL
546 @cindex case sensitivity
547
548 PSGML does not understand the SGML declaration, it accepts one in the
549 file but it is ignored. If you have the SGML declaration in another
550 file you can make @file{sgmls} use it when you use the @kbd{C-c C-v}
551 (@code{sgml-validate}) command (@pxref{Validate}).
552
553 PSGML has some options in what features it uses and what markup it
554 creates. You have to set these options to make PSGML's behavior
555 consistent with your SGML declaration and personal preferences.
556
557 @defopt sgml-omittag
558 Set this to @code{t} if the SGML declaration has @samp{OMITTAG YES} and
559 to @code{nil} otherwise.
560 @end defopt
561
562 @defopt sgml-shorttag
563 Set this to @code{t} if the SGML declaration has @samp{SHORTTAG YES} and
564 to @code{nil} otherwise.
565 @end defopt
566
567 @defopt sgml-namecase-general
568 Set this to @code{t} if the SGML declaration has @samp{NAMECASE
569 GENERAL YES} and to @code{nil} otherwise. I.e., this controls whether
570 names, except entity names, will be case insensitive (translated to
571 upper case).
572 @end defopt
573
574 @defopt sgml-always-quote-attributes
575 If non-nil, quote all attribute values inserted after finishing edit
576 attributes. If this variable is @code{nil} and @code{sgml-shorttag} is
577 non-@code{nil}, attribute values that consists of only name characters
578 will not be quoted.
579 @end defopt
580
581 @defopt sgml-minimize-attributes
582 Determines minimization of attributes inserted by edit-attributes. If
583 non-nil, omit attribute name if the attribute value is from a token
584 group. If @code{max}, omit attributes with default value. Minimization
585 will only be done if they produce legal SGML (assuming
586 @code{sgml-omittag} and @code{sgml-shorttag} are set correctly).
587 @end defopt
588
589
590 @c --------------------------------------------------------------------------
591 @node Managing the DTD, Edit, SGML declaration, Top
592 @comment node-name, next, previous, up
593 @chapter Document Type Declaration
594 @cindex DOCTYPE
595 @cindex DTD
596
597 @vindex sgml-default-doctype-name
598 PSGML needs to know about the DTD you are using for many of its commands.
599 If you do not have a @samp{DOCTYPE} declaration in your file,
600 PSGML will try assume that there is one of the form
601
602 @example
603 <!DOCTYPE @var{name} SYSTEM>
604 @end example
605
606 where @var{name} is the value of @code{sgml-default-doctype-name}, if
607 the value is non-@code{nil}, else the GI of the first tag will be used.
608
609 @findex sgml-parse-prolog
610 @vindex sgml-auto-activate-dtd
611 PSGML will try to parse the document type declaration the first time
612 you do something that needs to parse the document or immediately if the
613 variable @code{sgml-auto-activate-dtd} is @code{t}. You can also
614 initiate the parsing of the document type declaration with the command
615 @code{sgml-parse-prolog}. Big DTDs take some time to parse.
616
617 When the DTD has been parsed or loaded the name of the document element
618 will be displayed in the mode line inside brackets. If there was an
619 error parsing the DTD or there is no DTD, the mode line will display
620 @samp{[ANY]} (*** this is not really correct! a DTD will be established
621 even if there are missing entities, it may even be empty).
622
623 @menu
624 * Precompiled DTD Subsets::
625 * Using a Split Document::
626 * Inserting a DOCTYPE::
627 * Information from the DTD::
628 * Customizing DTD::
629 @end menu
630
631
632 @c ------------------------------------------------------------
633 @node Precompiled DTD Subsets, Using a Split Document, Managing the DTD, Managing the DTD
634 @comment node-name, next, previous, up
635 @section Precompiled DTD Subsets
636
637 If parsing the DTD takes too long time you can arrange to have PSGML
638 cache an internal complied version of the DTD. Caching can be done of
639 DTD fragments in favourable situations. It is possible to have an
640 external DTD subset cached but still have an internal DTD subset as long
641 as the internal subset does not define parameter entities that affect
642 the parsing of the external subset (*** what is the exact conditions?,
643 probably you can't use the cached external subset if the internal subset
644 defines parameter entities that are also defined in the external subset
645 with another value).
646
647 @vindex sgml-ecat-files
648 @vindex sgml-local-ecat-files
649 To enable caching you have to create special catalog files, hereafter
650 called ECAT files due to (temporary) lack of imagination. These catalogs
651 have similar syntax to the entity catalogs and there are two variables
652 containing lists of catalogs to search: @code{sgml-ecat-files} and
653 @code{sgml-local-ecat-files}. The ECAT files can contain the following
654 types of entries:
655
656 @table @samp
657 @item file @var{dtdfile} @var{entitydef} @var{cfile}
658 The @var{dtdfile} is the name of a file containing a DTD subset that
659 should be cached in @var{cfile}. The @var{entitydef} is optional and if
660 given have the following syntax:
661 @example
662 [ @var{name1} @var{literal1} @var{name2} @var{literal2} @dots{} ]
663 @end example
664 Using @var{entitydef} will modify the DTD subset by defining the
665 parameter entity with name @var{name1} to be @var{literal1}, @dots{}. The
666 cached version of the subset will be created with those entity
667 definitions, and when PSGML search for a matching cached subset will check
668 that the parameter entities in @var{entitydef} has been defined with
669 those values before trying to use @file{cfile}.
670
671 @item public @var{pubid} @var{entitydef} @var{cfile}
672 Cache the DTD subset with public identifier @var{pubid} in file
673 @var{cfile}.
674 @end table
675
676
677 @defopt sgml-recompile-out-of-date-cdtd
678 If non-@code{nil}, out of date compiled DTDs will be automatically
679 recompiled. If the value is @code{ask}, PSGML will ask before
680 recompiling. A @code{nil} value will cause PSGML to silently load an out
681 of date compiled DTD. A DTD that refers to undefined external entities
682 is always out of date, thus in such case it can be useful to set this
683 variable to @code{nil}.
684 @end defopt
685
686
687 Previous versions of PSGML have had another way of speeding up DTD
688 parsing. This code remains in this version of PSGML, but is not actively
689 maintained and may disappear in the future.
690
691 @findex sgml-save-dtd
692 @findex sgml-load-dtd
693 @vindex sgml-default-dtd-file
694 You can save the parsed DTD in a file using the command @kbd{M-x
695 sgml-save-dtd}. Next time PSGML can load that file instead of parsing
696 the DTD. For PSGML to find the saved DTD you must either save the DTD
697 using the default name or do a @kbd{M-x sgml-save-options} after saving
698 the DTD. To directly use an already parsed and saved DTD, load the file
699 containing the saved DTD with the command @kbd{M-x sgml-load-dtd}.
700
701 @defopt sgml-default-dtd-file
702 This is the default file name for saved DTD. This is set by
703 @code{sgml-mode} to the buffer file name less extension plus the
704 extension @code{.ced}, if that file exists. Can be changed in the Local
705 variables section of the file.
706 @end defopt
707
708 @c true with system-path
709 @c either or by creating a saved DTD and setting
710 @c @code{sgml-default-dtd-file} to that file. If
711 @c @code{sgml-default-dtd-file} contains a relative file name, the
712 @c directories in @code{sgml-system-path} will be searched for the file.
713
714
715 @c ------------------------------------------------------------
716 @node Using a Split Document, Inserting a DOCTYPE, Precompiled DTD Subsets, Managing the DTD
717 @comment node-name, next, previous, up
718 @section Using a Split Document
719
720 @c *** why not defopt??
721 @vindex sgml-doctype
722 You can have the @samp{DOCTYPE} declaration in another file by setting
723 @code{sgml-doctype} to the other file.
724
725 @defopt sgml-parent-document
726 Used when the current file is part of a bigger document.
727
728 The variable describes how the current file's content fit into the element
729 hierarchy. The variable should have the form
730
731 @lisp
732 (@var{parent-file} @var{context-element}* @var{top-element} (@var{has-seen-element}*)?)
733 @end lisp
734
735 @table @var
736 @item parent-file
737 is a string, the name of the file containing the
738 document entity.
739
740 @item context-element
741 is a string, that is the name of an element type.
742 It can occur 0 or more times and is used to set up
743 exceptions and short reference map. Good candidates
744 for these elements are the elements open when the
745 entity pointing to the current file is used.
746
747 @item top-element
748 is a string that is the name of the element type
749 of the top level element in the current file. The file
750 should contain one instance of this element, unless
751 the last (lisp) element of sgml-parent-document is a
752 list. If it is a list, the top level of the file
753 should follow the content model of top-element.
754
755 @item has-seen-element
756 is a string that is the name of an element type. This
757 element is satisfied in the content model of top-element.
758 @end table
759 @end defopt
760
761
762 @c ------------------------------------------------------------
763 @node Inserting a DOCTYPE, Information from the DTD, Using a Split Document, Managing the DTD
764 @comment node-name, next, previous, up
765 @section Inserting a DOCTYPE
766
767 @kindex C-c C-u C-d
768 @findex sgml-custom-dtd
769 *** Describe the DTD menu in general. Describe customized entries for
770 special DTDs. Mention @kbd{C-c C-u C-d} for inserting a DOCTYPE from
771 keyboard.
772
773 If you change the doctype you must execute @code{sgml-parse-prolog},
774 changes in the doctype are not automatically recognized.
775
776 @defopt sgml-custom-dtd
777 Menu entries to be added to the DTD menu. The value should be a list of
778 entries to be added to the DTD menu.
779
780 Every entry should be a list. The first element of the entry is a string
781 used as the menu entry. The second element is a string containing a
782 doctype declaration (this can be nil if no doctype). The rest of the
783 list should be a list of variables and values. For backward
784 compatibility a single string instead of a variable is assigned to
785 @code{sgml-default-dtd-file}. All variables are made buffer local and
786 are also added to the buffers local variables list.
787
788 When an entry is selected from the DTD menu, the doctype declaration will
789 be inserted, the variables will be set to the values in the entry and a
790 local variables list will be created in the buffer.
791
792 Example:
793
794 @example
795 (("HTML" nil
796 sgml-default-dtd-file "~/sgml/html.ced"
797 sgml-omittag nil sgml-shorttag nil)
798 ("HTML+" "<!doctype htmlplus system 'htmlplus.dtd'>"
799 "~/sgml/htmlplus.ced"
800 sgml-omittag t sgml-shorttag nil)
801 ("DOCBOOK" "<!doctype docbook system 'docbook.dtd'>"
802 "~/sgml/docbook.ced"
803 sgml-omittag nil sgml-shorttag t)))
804 @end example
805 @end defopt
806
807
808 @c ------------------------------------------------------------
809 @node Information from the DTD, Customizing DTD, Inserting a DOCTYPE, Managing the DTD
810 @comment node-name, next, previous, up
811 @section Information from the DTD
812 @cindex DTD
813 @cindex Element
814
815 PSGML can list various information about the current DTD.
816 The following commands can be used via @kbd{M-x} and
817 can also be found in the DTD menu.
818
819 @table @code
820 @findex sgml-describe-dtd
821 @item sgml-describe-dtd
822 Display information about the current DTD.
823
824 @findex sgml-describe-element-type
825 @item sgml-describe-element-type
826 Describe the properties of an element type as declared in the current DTD.
827
828 @cindex entity
829 @findex sgml-describe-entity
830 @item sgml-describe-entity
831 Describe the properties of an entity as declared in the current DTD.
832
833 @findex sgml-list-elements
834 @item sgml-list-elements
835 Will list all elements and the attributes declared for the element.
836
837 @findex sgml-list-attributes
838 @item sgml-list-attributes
839 Will list all attributes declared and the elements that use them.
840
841 @findex sgml-list-terminals
842 @item sgml-list-terminals
843 Will list all elements that can contain data.
844
845 @findex sgml-list-occur-in-elements
846 @item sgml-list-occur-in-elements
847 Will list all element types and where it can occur.
848
849 @findex sgml-list-content-elements
850 @item sgml-list-content-elements
851 Will list all element types and the element types that can occur
852 in its content.
853 @end table
854
855
856 @c ---------------------------------------------------------------------------
857 @node Customizing DTD, , Information from the DTD, Managing the DTD
858 @comment node-name, next, previous, up
859 @section Customizing DTD
860
861 PSGML can be customized by process instructions starting with ``PSGML''
862 in the DTD. Generally this associates some information with element
863 types. E.g., if @code{sgml-fill-element} should skip the element type
864 or if the content should be displayed with a special font.
865
866 The general syntax is
867 @display
868 @samp{<?PSGML ELEMENT} @var{gi} (@var{prop} = @var{value})* @samp{>}
869 @end display
870
871 Note: in XML the ending delimiter is @samp{?>}, in SGML mode a
872 trailing @samp{?} will be ignored if preceded by a space.
873
874 Where @var{gi} is the element type, @var{prop} is a propery
875 described below, and @var{value} is the value for the property. The
876 first part from @samp{PSGML} to @var{gi} is read with current setting
877 for @samp{NAMECASE GENERAL}, i.e., case insensitive for normal SGML
878 but case sensitive in XML mode. The @var{prop} and @var{value} is read
879 using Emacs Lisp conventions, i.e. case sensitive and @var{value} is a
880 lisp expression (not evaluated).
881
882 Example
883
884 @example
885 <?PSGML ELEMENT PRE nofill=t face=fixed-pitch>
886 @end example
887
888 Properties
889
890 @table @code
891 @item nofill
892 Set to either @code{t} or @code{nil}. If @code{t} the elements of this
893 type will be ignored when filling with @code{sgml-fill-element}.
894 Note that Emacs normal filling functions will not honor this.
895
896 @item font
897 Set to the name of an Emacs face. Should be a face that exists in
898 Emacs. E.g. @code{bold}, @code{italic}, @code{fixed-pitch}. The
899 content of elements of this type will be displayed in that face.
900
901 @item attnames
902 Set to a list of attribute names. E.g., @code{attnames=("ID" "CLASS"
903 "ONCLICK")}. This controls the attributes included when using the
904 @code{sgml-edit-attributes} (@kbd{C-c C-a}) command. Only the
905 attributes in the list will be included and in that order. You can
906 also end the list with a @code{*} to include all attributes, but the
907 listed attributes will be on the top. E.g.,
908 @code{attnames=("ID" "CLASS" "ONCLICK" *)}.
909 Note: that the attribute names need to be written with the correct
910 case and in string quotes.
911
912 @item structure
913 Control if element is included in @code{sgml-show-structure} (@kbd{C-c
914 C-s}). If set to @code{t}, the element is included and if set to
915 @code{ignore} it will not be included. @xref{Information, Showing information}.
916
917 @item help-text
918 Should be a string. The string will be displayed by
919 @code{sgml-show-current-element-type} (@kbd{C-c C-t}).
920
921 @end table
922
923
924 @c ---------------------------------------------------------------------------
925 @node Edit, Display, Managing the DTD, Top
926 @comment node-name, next, previous, up
927 @chapter Commands for editing
928
929 @menu
930 * Insert:: Inserting Markup
931 * Complete:: Markup completion
932 * Information:: Showing information
933 * Indent:: Indentation according to structure
934 * Move:: Move in the element structure
935 * Attributes:: Editing attributes
936 * Change and delete:: Changing and deleting markup
937 * Translating characters and entities::
938 @end menu
939
940 @c ------------------------------------------------------------------
941 @node Insert, Complete, Edit, Edit
942 @comment node-name, next, previous, up
943 @section Inserting Markup
944
945 @c erik says "inserts" ??
946 The commands that insert start-tags works only if the document has an
947 associated DTD.
948
949 Keyboard commands for inserting:
950
951 @table @kbd
952 @kindex C-c <
953 @findex sgml-insert-tag
954 @item C-c <
955 Will ask, for the tag to insert, in the mini-buffer with completion on the
956 tags that are valid at point (@code{sgml-insert-tag}).
957
958 If @code{sgml-auto-insert-required-elements} is non-nil, tags for elements
959 required between the inserted tags will also be inserted.
960
961 The list of valid tags, computed for a position in the buffer, will
962 contain:
963
964 @enumerate
965 @item
966 The end-tag for the current element, if it can be ended at the position.
967 Furthermore it will contain end-tags for enclosing elements if the
968 necessary omissible end-tag declarations have been made in the DTD.
969
970 @item
971 The start-tags of all elements that could occur after point. If
972 @code{sgml-omittag-transparent} is nil, the above will be limited to the
973 elements that can occur within the current element.
974 @end enumerate
975
976
977 @kindex C-c C-e
978 @findex sgml-insert-element
979 @vindex sgml-insert-end-tag-on-new-line
980 @item C-c C-e
981 Insert start and end-tags for an element
982 (@code{sgml-insert-element}). The name of the element is read
983 from the mini-buffer with completion on valid elements. If
984 @code{sgml-insert-end-tag-on-new-line} is non-nil or the
985 element has element content, the end-tag will be inserted on a
986 new line after the start-tag.
987
988 @vindex sgml-omittag-transparent
989 If @code{sgml-omittag-transparent} is nil, the list of valid elements
990 will only contain the elements that can be in the content of the current
991 element.
992
993 @vindex sgml-auto-insert-required-elements
994 @vindex sgml-insert-missing-element-comment
995 Required elements in the content will be automatically inserted if the
996 option @code{sgml-auto-insert-required-elements} is non-nil.
997 When the content model demands an element but there is more
998 than one to choose from, a comment can be inserted with the
999 available choices if the option
1000 @code{sgml-insert-missing-element-comment} is non-nil.
1001
1002 @kindex C-c C-i
1003 @findex sgml-add-element-to-element
1004 @item C-c C-i
1005 Inserts a new element in the current element where it is legal. Prompts
1006 for element name with completion. The completion list contains all
1007 elements that could be added to the current element somewhere, without
1008 making the content invalid. This assumes that the content is valid to
1009 begin with. Currently this list only has regular elements, not
1010 inclusions. The new element will be inserted as late as possible in the
1011 current element (unless prefix argument is given, then as early as
1012 possible.)
1013
1014 @kindex C-c C-r
1015 @findex sgml-tag-region
1016 @item C-c C-r
1017 Makes the region into a new element (@code{sgml-tag-region}). Reads
1018 element name from mini-buffer with completion as for @kbd{C-c C-e}.
1019
1020 @kindex C-c /
1021 @findex sgml-insert-end-tag
1022 @item C-c /
1023 Inserts an end-tag for the current element (@code{sgml-insert-end-tag}).
1024
1025 @c note that this keybinding doesn't follow the conventions for
1026 @c major-modes. Perhaps warn that this binding may change in the next
1027 @c major release?
1028
1029
1030 @kindex C-c RET
1031 @findex sgml-split-element
1032 @item C-c RET
1033 Split the current element at point. If repeated, the containing element
1034 will be split before the beginning of then current element.
1035
1036 Typical use is to start a new paragraph element when inside a paragraph.
1037
1038 @kindex C-c +
1039 @findex sgml-insert-attribute
1040 @item C-c +
1041 Read attribute name and value from mini-buffer and insert attribute
1042 specification (@code{sgml-insert-attribute}). If point is immediately
1043 after a start-tag, this command operates on that start-tag. Otherwise
1044 the command will operate on the element after point.
1045
1046 The attribute name will be read with completion. If the attribute has a
1047 token list as declared value the attribute value will also be read with
1048 completion. The prompt for attribute value will typically look like:
1049
1050 @example
1051 Value for @var{attribute} (@var{type} Default: @var{current value}):
1052 @end example
1053
1054 @c note that this keybinding doesn't follow the conventions for
1055 @c major-modes. Perhaps warn that this binding may change in the next
1056 @c major release?
1057
1058 @kindex C-c C-u C-m
1059 @findex sgml-custom-markup
1060 @item C-c C-u C-m
1061 Give keyboard access to the customized part of the Markup menu.
1062 Emacs will prompt for the markup to insert using the menu line as
1063 selector. (See @var{sgml-custom-markup} below.)
1064
1065 @end table
1066
1067 Menu bar:
1068
1069 @table @samp
1070 @item Markup
1071 Selecting from this menu will insert markup. The menu contains
1072 sub menus with tags and with entities, some other markup and a user
1073 defined section.
1074
1075 Sub menus:
1076
1077 @item Insert element
1078 Pops up a menu of valid elements and insert start and end-tags for
1079 the selected element. Selections from the menu works like the @kbd{C-c
1080 C-e} command.
1081
1082 @item Insert start-tag
1083 Pops up a menu of valid start-tags and insert the selected tag. The
1084 menu has the same start-tags as the completion list for @kbd{C-c <}.
1085
1086 @item Insert end-tag
1087 Pops up a menu of valid end-tags and insert the selected tag.
1088
1089 @item Tag region
1090 Pops up a menu of valid elements and tag the region with the
1091 selection. Selections from the menu works like the @kbd{C-c C-r}
1092 command.
1093
1094 @item Insert entity
1095 Menu of all general entities defined in the DTD.
1096
1097 @item Add Element to Element
1098 Pops up a menu of all elements valid somewhere in the current element.
1099 The menu contains all elements that could be added to the current
1100 element somewhere, without making the content invalid. The new element
1101 will be inserted as late as possible in the current element.
1102
1103 @item Insert attribute
1104 Pops up a menu with all the attributes of an element. The element is
1105 either the one which start-tag is immediately before point or the
1106 element after point. Selecting from this menu edits the attribute
1107 specification list for the element.
1108
1109 The menu has a sub menu for every attribute which declared value is a
1110 token list. The rest of the attributes are collected in one sub menu.
1111 For the token list attributes, selecting a value will insert that
1112 attribute-value pair. Selecting some other attribute reads the
1113 attribute-value from the mini-buffer and inserts the attribute value
1114 pair.
1115 @end table
1116
1117 @kindex S-@key{mouse-3}
1118 A menu is also available directly with a mouse button click in the
1119 buffer. In GNU Emacs it is the first mouse button combined with shift
1120 (@kbd{S-@key{mouse-3}}). In Lucid Emacs it is bound to the third mouse
1121 button. The mouse button click will pop-up a menu of valid tags or a
1122 menu of attributes if the point is in a start-tag. The attributes menu
1123 works as the ``Insert attribute'' menu from the menu-bar. The tags list
1124 is the list of valid tags described above for command @kbd{C-c <}.
1125 Selection from the tags menu works like the @kbd{C-c <} command, with
1126 the following exception:
1127
1128 You can tag a region, with start and end-tag. There are two ways to
1129 indicate the region to mark:
1130
1131 @enumerate
1132 @item
1133 Use the normal mouse commands to mark region.
1134
1135 For this to work you must either use @dfn{transient mark mode}
1136 (@pxref{Transient Mark, , Transient Mark Mode, emacs, The Emacs
1137 Editor}) or set the option @code{sgml-tag-region-if-active} to non-nil
1138 (don't set this unless you are sure that you want it).
1139
1140 @item
1141 Alternatively make a secondary selection, this is done by holding down
1142 the meta key and using the mouse buttons.
1143 @xref{Secondary selection, , , emacs, The Emacs Editor}.
1144 Some window managers intercept these events, which makes it hard use the
1145 secondary selection in Emacs.
1146 @end enumerate
1147
1148 @defopt sgml-balanced-tag-edit
1149 If non-nil, inserting a start-tag using the context menu will also
1150 insert the corresponding end-tag.
1151 @end defopt
1152
1153 @defopt sgml-auto-insert-required-elements
1154 If non-nil, automatically inserts required elements in the content
1155 of an inserted element.
1156 @end defopt
1157
1158 @defopt sgml-omittag-transparent
1159 If non-nil, will show legal tags inside elements with omissible start-tags
1160 and legal tags beyond omissible end-tags.
1161 @end defopt
1162
1163 @defopt sgml-tag-region-if-active
1164 If non-nil, the @samp{Insert tags} menu will tag a region if the region
1165 is considered active by emacs. If nil, region must be active and
1166 @code{transient-mark-mode} must be on for the region to be tagged.
1167 @end defopt
1168
1169 @defopt sgml-custom-markup
1170 Menu entries to be added to the Markup menu. The value should be a list
1171 of lists of two strings. The first string is the menu line and the
1172 second string is the text inserted when the menu item is selected. The
1173 second string can contain a @samp{\r} where the cursor should be left.
1174 Also, if a selection is made according to the same rules as for the
1175 @kbd{S-mouse-1} menu, the selection is replaced with the second string
1176 and @samp{\r} is replaced with the selection.
1177
1178 Example:
1179
1180 @example
1181 (("Version1" "<![%Version1[\r]]>")
1182 ("New page" "<?NewPage>"))
1183 @end example
1184 @end defopt
1185
1186
1187 @defopt sgml-insert-missing-element-comment
1188 If non-nil, and sgml-auto-insert-required-elements also true,
1189 @code{sgml-insert-element} will insert a comment if there is an
1190 element required but there is more than one to choose from.
1191 @end defopt
1192
1193 @defopt sgml-insert-end-tag-on-new-line
1194 If non-nil, @code{sgml-insert-element} will put the end-tag on
1195 a new line after the start-tag. Useful on slow terminals if you
1196 find the end-tag after the cursor irritating.
1197 @end defopt
1198
1199
1200 @c -------------------------------------------------------------------------
1201 @node Complete, Information, Insert, Edit
1202 @comment node-name, next, previous, up
1203 @section Markup completion
1204
1205 @kindex M-TAB
1206 @findex sgml-complete
1207 If you are typing in markup directly, @kbd{M-TAB} will help you by
1208 completing a tag name, an entity name or a markup declaration name. If
1209 you type @kbd{M-TAB} after a plain word, @code{ispell-complete-word}
1210 will be invoked instead.
1211
1212 If you have typed (@point{} marks the position of point)
1213
1214 @example
1215 &At@point{}
1216 @end example
1217
1218 @noindent and type @kbd{M-TAB} (assuming you use the @file{ISOLat1}
1219 entity set) you get:
1220
1221 @example
1222 &Atilde@point{}
1223 @end example
1224
1225
1226 @c ---------------------------------------------------------------------------
1227 @node Information, Indent, Complete, Edit
1228 @comment node-name, next, previous, up
1229 @section Showing information
1230
1231 Commands for showing information obtained by parsing the buffer.
1232
1233 @table @kbd
1234 @kindex C-c C-c
1235 @findex sgml-show-context
1236 @item C-c C-c
1237 Shows in the message area: context at point, if in a tag or in mixed
1238 content and the open elements (@code{sgml-show-context}). The form of
1239 the string is controled by the user option
1240 @code{sgml-show-context-function}.
1241
1242 @kindex C-c C-w
1243 @findex sgml-what-element
1244 @item C-c C-w
1245 Shows what element the character after point (under the cursor) belongs
1246 to; also shows context of element (@code{sgml-what-element}).
1247
1248 @kindex C-c C-t
1249 @findex sgml-show-current-element-type
1250 @item C-c C-t
1251 Show information about the current element type and the valid element
1252 following the point.
1253
1254 @kindex C-c C-s
1255 @findex sgml-show-structure
1256 @item C-c C-s
1257 Show the major element structure in a separate buffer (@samp{*Document
1258 structure*}). That buffer can be used to navigate the document, like
1259 an Occur buffer (@pxref{Other Repeating Search, , Other
1260 Search-and-Loop Commands, emacs, The Emacs Editor}). The structure
1261 shows container elements and the text of the first child element (if
1262 it is not a container). This works best for document types which uses
1263 containers and title structure (e.g. @samp{<div> <title>Heder</title>
1264 ..</div>}). PSGML uses a heuristic rule to identify container
1265 elements: it should have element content and be non empty. You can
1266 configure exceptions from this rule using a process instruction in the
1267 DTD (@pxref{Customizing DTD}).
1268
1269 To include an element type @var{el1} that would otherwise be excluded:
1270 @example
1271 <?PSGML element @var{el1} structure=t?>
1272 @end example
1273
1274 To exclude an element type @var{el2} that would otherwise be included:
1275 @example
1276 <?PSGML element @var{el2} structure=ignore?>
1277 @end example
1278
1279 @end table
1280
1281 @findex sgml-list-valid-tags
1282 List contextually valid tags (@code{sgml-list-valid-tags}). Displays
1283 information about current element, all valid end-tags, valid start-tags
1284 in current element, and start-tags valid at this point but in other
1285 elements together with the tags omitted.
1286
1287 @ignore
1288 *** This is no longer working
1289
1290 You can make the mode-line display the name of the current open element
1291 by setting the @code{sgml-live-element-indicator} variable. Setting
1292 this will make all commands slower due to the work needed to keep the
1293 mode-line up to date.
1294
1295 @defopt sgml-live-element-indicator
1296 If non-nil, indicate current element in mode line.
1297
1298 NOTE: Setting this implies that every command can cause a parse.
1299 @end defopt
1300
1301 @end ignore
1302
1303 @defopt sgml-show-context-function
1304 The value shold be a function that generates a string from an element
1305 and the current markup type (if any). There are two ready made
1306 functions for this. The function @code{sgml-show-context-standard},
1307 the default, generates a string like @samp{#PCDATA in para in chapter
1308 in book}. The function @code{sgml-show-context-backslash} generates a
1309 string like @samp{book\chapter\para}.
1310 @end defopt
1311
1312
1313 @c --------------------------------------------------------------------------
1314 @node Indent, Move, Information, Edit
1315 @comment node-name, next, previous, up
1316 @section Indentation according to structure
1317
1318 @kindex @key{TAB}
1319 @kindex @key{LFD}
1320 @findex sgml-indent-or-tab
1321 @findex newline-and-indent
1322 You can indent a line according to the depth of element nesting at the
1323 beginning of the line. To indent the current line use @kbd{@key{TAB}}.
1324 You can also use @kbd{@key{LFD}} (@code{newline-and-indent}) to start a
1325 new line with correct indentation.
1326
1327 @defopt sgml-indent-step
1328 How much to increment indent for every element level. If nil, no
1329 indentation.
1330
1331 If this is nil, @kbd{@key{TAB}} will insert a tab instead of indenting.
1332 @end defopt
1333
1334 @defopt sgml-indent-data
1335 If non-nil, indent in data/mixed context also.
1336 @end defopt
1337
1338
1339
1340 @c ---------------------------------------------------------------------------
1341 @node Move, Attributes, Indent, Edit
1342 @comment node-name, next, previous, up
1343 @section Move in the element structure
1344
1345 These commands move in the element structure. The commands uses
1346 knowledge of SGML syntax, and if available the specific DTD.
1347
1348 @table @kbd
1349 @kindex C-M-a
1350 @findex sgml-beginning-of-element
1351 @item C-M-a
1352 Move to the (content) beginning of the current element
1353 (@code{sgml-beginning-of-element}).
1354
1355 @kindex C-M-e
1356 @findex sgml-end-of-element
1357 @item C-M-e
1358 Move to the (content) end of the current element (@code{sgml-end-of-element}).
1359
1360 @kindex C-M-f
1361 @findex sgml-forward-element
1362 @item C-M-f
1363 Move forward by element (@code{sgml-forward-element}).
1364
1365 @kindex C-M-b
1366 @findex sgml-backward-element
1367 @item C-M-b
1368 Move backward by element (@code{sgml-backward-element}).
1369
1370 @kindex C-M-u
1371 @findex sgml-backward-up-element
1372 @item C-M-u
1373 Move up to before current element (@code{sgml-backward-up-element}).
1374
1375 @kindex C-c C-n
1376 @findex sgml-up-element
1377 @item C-c C-n
1378 Move up to after current element (@code{sgml-up-element}).
1379
1380 @kindex C-M-d
1381 @findex sgml-down-element
1382 @item C-M-d
1383 Move down to the (content) beginning of the next element
1384 (@code{sgml-down-element}).
1385
1386 @kindex C-c C-d
1387 @findex sgml-next-data-field
1388 @item C-c C-d
1389 Move to the next place where data is allowed (@code{sgml-next-data-field}).
1390 @end table
1391
1392 You can also move to the next place where there is some structural error
1393 with @kbd{C-c C-o} (@pxref{Validate}).
1394
1395
1396 @c ---------------------------------------------------------------------------
1397 @node Attributes, Change and delete, Move, Edit
1398 @comment node-name, next, previous, up
1399 @section Editing attributes
1400
1401 @findex sgml-edit-attributes
1402 @kindex C-c C-a
1403 If you want to change the attributes of a start-tag you can simply edit
1404 them directly in the buffer. Or you can place the cursor at or after
1405 the start-tag and use the @code{sgml-edit-attributes} command, available
1406 from the @samp{SGML}-menu or on @kbd{C-c C-a}. This will create a new
1407 Emacs window with all possible attributes listed in the form
1408
1409 @example
1410 @var{attribute name} = @var{current value}.
1411 @end example
1412
1413 The @var{current value} may be shown as @samp{#DEFAULT} if the attribute
1414 has not been given a value in the start-tag. The list also contains the
1415 attributes declaration as a comment. Note also that the @var{current
1416 value} is show without eventual quotes.
1417
1418 @kindex C-c C-d
1419 @kindex @key{TAB}
1420 It is now possible to edit the attribute values. You can move to the
1421 next attribute with @kbd{@key{TAB}}. If you want to let an attribute
1422 have its default value use @kbd{C-c C-d}, this will insert a
1423 @samp{#DEFAULT} in the value field.
1424
1425 If Emacs is running in an X window, the @samp{#DEFAULT} will be
1426 underlined to distinguish it from normal values.
1427
1428 @kindex C-c C-c
1429 Finish the editing with @kbd{C-c C-c}; this will replace the attribute
1430 values in the main buffer with those edited. Note that values will be
1431 quoted as needed.
1432
1433 If you want to abort the editing, you can remove the window with
1434 @kbd{C-x 0} or if you want it neat, kill the buffer and remove the
1435 window.
1436
1437 Some other keys are:
1438 @table @kbd
1439 @kindex C-a
1440 @findex sgml-edit-attrib-field-start
1441 @item C-a
1442 Go to the beginning of the value field
1443 (@code{sgml-edit-attrib-field-start}).
1444
1445 @kindex C-e
1446 @findex sgml-edit-attrib-field-end
1447 @item C-e
1448 Go to the end of the value field
1449 (@code{sgml-edit-attrib-field-end}).
1450
1451 @kindex C-c C-k
1452 @findex sgml-edit-attrib-clear
1453 @item C-c C-k
1454 Clear the value field
1455 (@code{sgml-edit-attrib-clear}).
1456
1457 @kindex C-c C-d
1458 @findex sgml-edit-attrib-default
1459 @item C-c C-d
1460 Set the value field to @samp{#DEFAULT}
1461 (@code{sgml-edit-attrib-default}). This is a special value that will
1462 make the attribute be implied.
1463 @end table
1464
1465
1466 @c --------------------------------------------------------------------------
1467 @node Change and delete, Translating characters and entities, Attributes, Edit
1468 @comment node-name, next, previous, up
1469 @section Changing and deleting markup
1470
1471 @table @kbd
1472 @kindex C-c =
1473 @findex sgml-change-element-name
1474 @item C-c =
1475 Change the name of the current element (@code{sgml-change-element-name}).
1476 Tries to translate attribute specifications. An attribute will be
1477 translated to an attribute with the same name. If the new element has
1478 no attribute with the same name, the attribute will be ignored. If
1479 there is an attribute with the same name but different declared content,
1480 a warning is given.
1481
1482 ID attributes are handled specially, an attribute with declared value ID
1483 will always be translated to the attribute with declared value ID.
1484
1485 @kindex C-c C-k
1486 @findex sgml-kill-markup
1487 @item C-c C-k
1488 Kill next tag, markup declaration or process instruction
1489 (@code{sgml-kill-markup}).
1490
1491 @kindex C-M-k
1492 @findex sgml-kill-element
1493 @item C-M-k
1494 Kill the element following the cursor (@code{sgml-kill-element}).
1495
1496 @kindex C-c -
1497 @findex sgml-untag-element
1498 @item C-c -
1499 Remove tags from current element (@code{sgml-untag-element}).
1500
1501 @kindex C-c #
1502 @findex sgml-make-character-reference
1503 @item C-c #
1504 Convert character after point to a character reference
1505 (@code{sgml-make-character-reference}). If called with a numeric
1506 argument, convert a character reference back to a normal character.
1507
1508 @kindex C-c C-q
1509 @findex sgml-fill-element
1510 @item C-c C-q
1511 Fills an element as a paragraph (@code{sgml-fill-element}). This is a
1512 substitute for the normal @code{fill-paragraph}. The command uses
1513 heuristics to decide what should be a paragraph.
1514
1515 @enumerate
1516 @item
1517 If point is in an element content, recursively fill the sub-elements.
1518 @item
1519 Find the biggest element with mixed content containing point.
1520 @item
1521 If the above element is mixed but contains elements with pure element
1522 content then fill what is between the pure elements as paragraphs and
1523 fill the pure elements recursively.
1524 @end enumerate
1525
1526 @findex sgml-expand-all-shortrefs
1527 @item M-x sgml-expand-all-shortrefs
1528 Short references to text entities are expanded to the replacement text
1529 of the entity other short references are expanded into general entity
1530 references. If argument, @var{to-entity}, is non-@code{nil}, or if
1531 called interactive with numeric prefix argument, all short references
1532 are replaced by generally entity references.
1533
1534 @findex sgml-normalize
1535 @item M-x sgml-normalize
1536 Normalize the document in the buffer. This will
1537
1538 @enumerate
1539 @item
1540 expand short references,
1541 @item
1542 insert missing tags,
1543 @item
1544 replace minimized tags with full tags,
1545 @item
1546 fix attribute specification lists according to options set.
1547 @end enumerate
1548
1549 There is one argument, @var{to-entity}, with the same meaning as for
1550 @code{sgml-expand-all-shortrefs}.
1551
1552 There is one option for the normalize command. With its default value,
1553 normalize may actually change the data content of some elements. But
1554 only by removing some white-space from the end of elements with omitted
1555 end-tags.
1556 @end table
1557
1558 @defopt sgml-normalize-trims
1559 If non-nil, @code{sgml-normalize} will trim off white space from end of
1560 element when adding end-tag.
1561
1562 Default: @code{t}.
1563 @end defopt
1564
1565
1566 @c --------------------------------------------------------------------------
1567 @node Translating characters and entities, , Change and delete, Edit
1568 @comment node-name, next, previous, up
1569 @section Translating between characters and entity references
1570
1571 @c *** Need work..
1572
1573 Set the variable @code{sgml-display-char-list-filename} to a file that
1574 contains mappings between all characters present in the presentation
•1575 character set, and their "standard replacement text" names, e.g. "@U{00e5}"
1576 -> "[aring ]", e.t.c.
1577
1578 The default value for this variable is `iso88591.map'.
1579
1580 Then use the functions (also in the Modify menu)
1581
1582 @table @code
1583 @findex sgml-charent-to-display-char
1584 @item sgml-charent-to-display-char
1585 @findex sgml-display-char-to-charent
1586 @item sgml-display-char-to-charent
1587 @end table
1588
1589 to translate between entities and characters.
1590
1591 @c ---------------------------------------------------------------------------
1592 @node Display, Miscellaneous options, Edit, Top
1593 @comment node-name, next, previous, up
1594 @chapter Appearance of text in the buffer
1595
1596 @menu
1597 * Fold:: Folding editing
1598 * Hiding markup::
1599 * Highlight:: Highlighting markup
1600 @end menu
1601
1602 @c ---------------------------------------------------------------------------
1603 @node Fold, Hiding markup, Display, Display
1604 @comment node-name, next, previous, up
1605 @section Folding editing
1606
1607 With these commands you can make parts of the text temporarily invisible
1608 to make it easier to see the overall structure of your text.
1609
1610 When folding a region all the lines but the first will be invisible.
1611 The first line of the region will still be visible with an ellipsis at
1612 the end.
1613
1614 @xref{Outline Mode, , , emacs, The Emacs Editor}.
1615
1616 @table @kbd
1617 @kindex C-c C-f C-r
1618 @findex sgml-fold-region
1619 @item C-c C-f C-r
1620 The region between point and mark will be folded (@code{sgml-fold-region}).
1621
1622 @kindex C-c C-f C-e
1623 @findex sgml-fold-element
1624 @item C-c C-f C-e
1625 The region between the start and end of the current element will be
1626 folded (@code{sgml-fold-element}).
1627
1628 This command can also fold the SGML declaration or the DOCTYPE
1629 declaration.
1630
1631 @kindex C-c C-f C-s
1632 @findex sgml-fold-subelement
1633 @item C-c C-f C-s
1634 Fold all the sub elements of the current element
1635 (@code{sgml-fold-subelement}).
1636
1637 @kindex C-c C-s
1638 @kindex C-c C-u C-l
1639 @findex sgml-unfold-line
1640 @item C-c C-s
1641 @itemx C-c C-u C-l
1642 Unfold the current line, assuming it is the first line of a folded
1643 region (@code{sgml-unfold-line}).
1644
1645 @kindex C-c C-u C-e
1646 @findex sgml-unfold-element
1647 @item C-c C-u C-e
1648 Make all lines in current element visible (@code{sgml-unfold-element}).
1649
1650 @kindex C-c C-u C-a
1651 @findex sgml-unfold-all
1652 @item C-c C-u C-a
1653 Make all lines in current buffer visible (@code{sgml-unfold-all}).
1654
1655 @kindex C-c C-f C-x
1656 @findex sgml-expand-element
1657 @item C-c C-f C-x
1658 Unfold current element and then fold the subelements
1659 (@code{sgml-expand-element}). If the current element is folded this
1660 expands what is visible.
1661 @end table
1662
1663
1664 @c ---------------------------------------------------------------------------
1665 @node Hiding markup, Highlight, Fold, Display
1666 @comment node-name, next, previous, up
1667 @section Hiding markup
1668
1669 *** Describe hide-tags
1670
1671
1672 @c ---------------------------------------------------------------------------
1673 @node Highlight, , Hiding markup, Display
1674 @comment node-name, next, previous, up
1675 @section Highlighting markup
1676
1677
1678 PSGML can highlight the markup giving the markup a different @dfn{face}
1679 (@pxref{Faces, , Using Multiple Typefaces, emacs, The Emacs Editor}).
1680 The highlighting will only be done if the variable @code{sgml-set-face}
1681 is non-@code{nil}. The default settings make tags bold and comments
1682 italic, but this can be modified with the variable
1683 @code{sgml-markup-faces}. When highlighting is on PSGML will parse after
1684 every command until the whole buffer has been parsed or user event
1685 occurs.
1686
1687 @findex sgml-clear-faces
1688 To remove the highlighting type @kbd{M-x sgml-clear-faces}.
1689
1690 @defopt sgml-set-face
1691 If non-nil, psgml will set the face of parsed markup.
1692 @end defopt
1693
1694 @defopt sgml-markup-faces
1695 A list of markup to face mappings.
1696 Each element looks like @code{(@var{markup-type} . @var{face})}.
1697 Possible values for @var{markup-type} is:
1698
1699 @table @code
1700 @item comment
1701 comment declaration
1702 @item doctype
1703 doctype declaration
1704 @item end-tag
1705 end-tag
1706 @item ignored
1707 ignored marked section
1708 @item ms-start
1709 marked section end, if not ignored
1710 @item ms-end
1711 marked section start, if not ignored
1712 @item pi
1713 processing instruction
1714 @item sgml
1715 SGML declaration
1716 @item start-tag
1717 start-tag
1718 @item entity
1719 entity reference
1720 @item shortref
1721 short reference
1722 @end table
1723 @end defopt
1724
1725
1726
1727 @c ------------------------------------------------------------------
1728 @node Miscellaneous options, Bugs, Display, Top
1729 @comment node-name, next, previous, up
1730 @chapter Miscellaneous options
1731
1732 *** describe sgml-save-options
1733
1734 @defopt sgml-ignore-undefined-elements
1735 Start-tags for undefined elements will either be ignored, if
1736 @code{sgml-ignore-undefined-elements} is @code{t}, or assumed to be
1737 acceptable in the current element and defined with @code{O O ANY}
1738 @end defopt
1739
1740 @defopt sgml-range-indicator-max-length
1741 Maximum number of characters used from the first and last entry
1742 of a sub-menu to indicate the range of that menu.
1743
1744 @vindex sgml-max-menu-size
1745 This is used for long menus of elements, tags or entities that are split
1746 into @code{sgml-max-menu-size} big sub-menus.
1747 @end defopt
1748
1749
1750
1751
1752 @c ------------------------------------------------------------------
1753 @node Bugs, Index, Miscellaneous options, Top
1754 @comment node-name, next, previous, up
1755 @chapter Bugs
1756
1757
1758 If you encounter something that you think is a bug, please report
1759 it. Try to include a clear description of the undesired behaviour.
1760 A test case that exhibits the bug, would also be useful.
1761
1762 You can report a bug with the command @kbd{M-x sgml-submit-bug-report}.
1763
1764 When PSGML needs contextual information it parses the document up to
1765 the point. During the parsing, it builds a parse tree. The parse
1766 tree is used to initialize the next parse, to avoid having to parse
1767 things already parsed. Changes to the buffer is supposed to prune
1768 the tree of all outdated information. But if you get strange
1769 complaints from the parser, try and back up a bit and use @kbd{C-c
1770 C-o} (@code{sgml-next-trouble-spot}).
1771
1772
1773
1774 @c ------------------------------------------------------------------
1775 @node Index, , Bugs, Top
1776 @comment node-name, next, previous, up
1777 @chapter Index
1778
1779 @printindex cp
1780
1781 @contents
1782 @bye