Debian Codegraph @

psgml.el

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 ;;; psgml.el --- SGML-editing mode with parsing support
2 ;; $Id: psgml.el,v 2.70 2005/03/02 19:44:04 lenst Exp $
3
4 ;; Copyright (C) 1993-2002 Lennart Staflin
5 ;; Copyright (C) 1992 Free Software Foundation, Inc.
6
7 ;; Author: Lennart Staflin <[email protected]>
8 ;; James Clark <[email protected]>
9 ;; Maintainer: Lennart Staflin <[email protected]>
10 ;; Keywords: languages
11
12 ;;
13 ;; This program is free software; you can redistribute it and/or
14 ;; modify it under the terms of the GNU General Public License
15 ;; as published by the Free Software Foundation; either version 2
16 ;; of the License, or (at your option) any later version.
17 ;;
18 ;; This program is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
22 ;;
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with this program; if not, write to the Free Software
25 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27
28 ;;; Commentary:
29
30 ;; Major mode for editing the SGML document-markup language.
31
32 ;; Send bugs to [email protected]
33
34 ;; WHAT IT CAN DO
35
36 ;; - Identify structural errors (but it is not a validator)
37 ;; - Menus for inserting tags with only the contextually valid tags
38 ;; - Edit attribute values in separate window with information about types
39 ;; and defaults
40 ;; - Hide attributes
41 ;; - Fold elements
42 ;; - Indent according to element nesting depth
43 ;; - Show context
44 ;; - Structure editing: move and kill by element
45 ;; - Find next data context
46
47 ;; LIMITATIONS
48
49 ;; - only accepts the reference concrete syntax, though it does allow
50 ;; unlimited lengths on names
51
52
53 ;;; Code:
54
55 (defconst psgml-version "1.4.0"
56 "Version of psgml package.")
57
58 (defconst psgml-maintainer-address "[email protected]")
59
60 (eval-when-compile (require 'cl))
61 (require 'easymenu)
62
63 (defvar sgml-debug nil)
64
65 (defmacro sgml-debug (&rest x)
66 (list 'if 'sgml-debug (cons 'message x)))
67
68
69 ;;;; Variables
70
71 (defvar sgml-mode-abbrev-table nil
72 "Abbrev table in use in SGML mode.")
73 (define-abbrev-table 'sgml-mode-abbrev-table ())
74
75 (eval-and-compile
76 (defconst sgml-running-lucid (string-match "Lucid" emacs-version))
77 (defconst sgml-have-re-char-clases (string-match "[[:alpha:]]" "x")
78 "Non-nil if this Emacs supports regexp character classes.
79 E.g. `[-.[:alnum:]]'."))
80
81 (defconst sgml-default-nonsticky (boundp 'text-property-default-nonsticky)
82 "Non-nil means use `text-property-default-nonsticky'. locally.
83 Otherwise put explicit properties.")
84
85
86 (defvar sgml-xml-p nil
87 "Is this an XML document?")
88 (make-variable-buffer-local 'sgml-xml-p)
89
90 ;;; User settable options:
91
92 (defvar sgml-insert-defaulted-attributes nil
93 "*Controls whether defaulted attributes (not #FIXED) are inserted explicitly
94 or not. nil means don't insert, t means insert.")
95
96 (defvar sgml-insert-missing-element-comment t
97 "*If true, and sgml-auto-insert-required-elements also true,
98 `sgml-insert-element' will insert a comment if there is an element required
99 but there is more than one to choose from." )
100
101 (defvar sgml-insert-end-tag-on-new-line nil
102 "*If true, `sgml-insert-element' will put the end-tag on a new line
103 after the start-tag. Useful on slow terminals if you find the end-tag after
104 the cursor irritating." )
105
106 (defvar sgml-doctype nil
107 "*If non-nil the name of a file that contains the doctype declaration to use.
108 declaration to use.
109 Setting this variable automatically makes it local to the current buffer.")
110 (put 'sgml-doctype 'sgml-type 'string)
111 (make-variable-buffer-local 'sgml-doctype)
112
113 (defvar sgml-system-identifiers-are-preferred nil
114 "*Controls lookup of external entities.
115 nil means look up external entities by searching the catalogs
116 in `sgml-local-catalogs' and `sgml-catalog-files' and only if the
117 entity is not found in the catalogs use a given system identifier.
118 Non-nil means use a system identifier for the entity if one is given.
119 If no system identifier is given the catalogs will searched.")
120
121 (defvar sgml-range-indicator-max-length 9
122 "*Control of menu indicators.
123 Maximum number of characters used from the first and last entry
124 of a submenu to indicate the range of that menu.")
125
126 (defvar sgml-default-doctype-name nil
127 "*If non-nil, document type name to use if no DTD is present.")
128 (put 'sgml-default-doctype-name 'sgml-type 'string-or-nil)
129
130 (defvar sgml-markup-faces
131 ;; Fixme: are the font-lock correspondences here the most appopriate
132 ;; ones? I don't recall whence this set came. -- fx
133 `((start-tag . ,(if (facep 'font-lock-function-name-face)
134 'font-lock-function-name-face
135 'bold))
136 (end-tag . ,(if (facep 'font-lock-function-name-face)
137 'font-lock-function-name-face
138 'bold))
139 (comment . ,(if (facep 'font-lock-comment-face)
140 'font-lock-comment-face
141 'bold))
142 (pi . ,(if (facep 'font-lock-type-face)
143 'font-lock-type-face
144 'bold))
145 (sgml . ,(if (facep 'font-lock-type-face)
146 'font-lock-type-face
147 'bold))
148 (doctype . ,(if (facep 'font-lock-keyword-face)
149 'font-lock-keyword-face
150 'bold))
151 (entity . ,(if (facep 'font-lock-string-face)
152 'font-lock-string-face
153 'bold))
154 (shortref . ,(if (facep 'font-lock-string-face)
155 'font-lock-string-face
156 'bold))
157 (ignored . ,(if (facep 'font-lock-constant-face)
158 'font-lock-constant-face
159 'default))
160 (ms-start . ,(if (facep 'font-lock-constant-face)
161 'font-lock-constant-face
162 'default))
163 (ms-end . ,(if (facep 'font-lock-constant-face)
164 'font-lock-constant-face
165 'default)))
166 "*Alist of markup to face mappings.
167 Element are of the form (MARKUP-TYPE . FACE).
168 Possible values for MARKUP-TYPE are:
169 comment - comment declaration
170 doctype - doctype declaration
171 end-tag
172 ignored - ignored marked section
173 ms-end - marked section start, if not ignored
174 ms-start- marked section end, if not ignored
175 pi - processing instruction
176 sgml - SGML declaration
177 start-tag
178 entity - general entity reference
179 shortref- short reference")
180
181 (defvar sgml-buggy-subst-char-in-region
182 (or (not (boundp 'emacs-minor-version))
183 (not (natnump emacs-minor-version))
184 (and (eq emacs-major-version 19)
185 (< emacs-minor-version 23)))
186 "*If non-nil, work around a bug in subst-char-in-region.
187 The bug sets the buffer modified. If this is set, folding commands
188 will be slower.")
189
190 (defvar sgml-set-face nil
191 "*If non-nil, psgml will set the face of parsed markup.")
192 (put 'sgml-set-face 'sgml-desc "Set face of parsed markup")
193
194 (defvar sgml-live-element-indicator nil
195 "*If non-nil, indicate current element in mode line.
196 This may be slow.")
197
198 (defvar sgml-auto-activate-dtd nil
199 "*If non-nil, loading a sgml-file will automatically try to activate its DTD.
200 Activation means either to parse the document type declaration or to
201 load a previously saved parsed DTD. The name of the activated DTD
202 will be shown in the mode line.")
203 (put 'sgml-auto-activate-dtd 'sgml-desc "Auto Activate DTD")
204
205 (defvar sgml-offer-save t
206 "*If non-nil, ask about saving modified buffers before \\[sgml-validate] is run.")
207
208 (defvar sgml-parent-document nil
209 "*How to handle the current file as part of a bigger document.
210
211 The variable describes how the current file's content fit into the element
212 hierarchy. The value should have the form
213
214 (PARENT-FILE CONTEXT-ELEMENT* TOP-ELEMENT (HAS-SEEN-ELEMENT*)?)
215
216 PARENT-FILE is a string, the name of the file containing the
217 document entity.
218 CONTEXT-ELEMENT is a string, that is the name of an element type.
219 It can occur 0 or more times and is used to set up
220 exceptions and short reference map. Good candidates
221 for these elements are the elements open when the
222 entity pointing to the current file is used.
223 TOP-ELEMENT is a string that is the name of the element type
224 of the top level element in the current file. The file
225 should contain one instance of this element, unless
226 the last \(Lisp) element of `sgml-parent-document' is a
227 list. If it is a list, the top level of the file
228 should follow the content model of top-element.
229 HAS-SEEN-ELEMENT is a string that is the name of an element type. This
230 element is satisfied in the content model of top-element.
231
232 Setting this variable automatically makes it local to the current buffer.")
233 (make-variable-buffer-local 'sgml-parent-document)
234 (put 'sgml-parent-document 'sgml-type 'list)
235
236 (defvar sgml-tag-region-if-active nil
237 "*If non-nil, the Tags menu will tag a region if the region is
238 considered active by emacs. If nil, region must be active and
239 transient-mark-mode must be on for the region to be tagged.")
240
241 (defvar sgml-normalize-trims t
242 "*If non-nil, sgml-normalize will trim off white space from end of element
243 when adding end tag.")
244
245 (defvar sgml-omittag t
246 "*Non-nil means use OMITTAG YES.
247
248 Setting this variable automatically makes it local to the current buffer.")
249
250 (make-variable-buffer-local 'sgml-omittag)
251 (put 'sgml-omittag 'sgml-desc "OMITTAG")
252
253 (defvar sgml-shorttag t
254 "*Non-nil means use SHORTTAG YES.
255
256 Setting this variable automatically makes it local to the current buffer.")
257
258 (make-variable-buffer-local 'sgml-shorttag)
259 (put 'sgml-shorttag 'sgml-desc "SHORTTAG")
260
261 (defvar sgml-namecase-general t
262 "*Non-nil means use NAMECASE GENERAL YES.
263
264 Setting this variable automatically makes it local to the current buffer.")
265
266 (make-variable-buffer-local 'sgml-namecase-general)
267 (put 'sgml-namecase-general 'sgml-desc "NAMECASE GENERAL")
268
269
270
271 ;;[lenst/1998-03-09 19:51:55]
272 (defconst sgml-namecase-entity nil)
273
274 (defvar sgml-general-insert-case 'lower
275 "*The case that will be used for general names in inserted markup.
276 This can be the symbol `lower' or `upper'. Only effective if
277 `sgml-namecase-general' is true.")
278 (put 'sgml-general-insert-case 'sgml-type '(lower upper))
279
280 (defvar sgml-entity-insert-case nil)
281
282
283 (defvar sgml-minimize-attributes nil
284 "*Determines minimization of attributes inserted by edit-attributes.
285 Actually two things are done
286 1. If non-nil, omit attribute name, if attribute value is from a token group.
287 2. If `max', omit attributes with default value.
288
289 Setting this variable automatically makes it local to the current buffer.")
290
291 (make-variable-buffer-local 'sgml-minimize-attributes)
292 (put 'sgml-minimize-attributes 'sgml-type
293 '(("No" . nil) ("Yes" . t) ("Max" . max)))
294
295 (defvar sgml-always-quote-attributes t
296 "*Non-nil means quote all attribute values inserted after editing attributes.
297 Setting this variable automatically makes it local to the current buffer.")
298
299 (make-variable-buffer-local 'sgml-always-quote-attributes)
300
301 (defvar sgml-auto-insert-required-elements t
302 "*If non-nil, automatically insert required elements in the content
303 of an inserted element.")
304
305 (defvar sgml-balanced-tag-edit t
306 "*If non-nil, context menu inserts start-end tag pairs.")
307
308 (defvar sgml-omittag-transparent (not sgml-balanced-tag-edit)
309 "*If non-nil, will show legal tags inside elements with omitable start tags
310 and legal tags beyond omitable end tags.")
311
312 (defvar sgml-leave-point-after-insert nil
313 "*If non-nil, the point will remain after inserted tag(s).
314 If nil, the point will be placed before the inserted tag(s).")
315
316 (defvar sgml-warn-about-undefined-elements t
317 "*If non-nil, print a warning when a tag for an undefined element is found.")
318
319 (defvar sgml-warn-about-undefined-entities t
320 "*If non-nil, print a warning when an undefined entity is found.")
321
322 (defvar sgml-ignore-undefined-elements nil
323 "*If non-nil, recover from an undefined element by ignoring the tag.
324 If nil, recover from an undefined element by assuming it can occur any
325 where and has content model ANY.")
326
327 (defvar sgml-recompile-out-of-date-cdtd 'ask
328 "*If non-nil, out of date compiled DTDs will be automatically recompiled.
329 If the value is `ask', PSGML will ask before recompiling. A `nil'
330 value will cause PSGML to silently load an out of date compiled DTD.
331 A DTD that refers to undefined external entities is always out of
332 date, thus in such case it can be useful to set this variable to
333 `nil'.")
334 (put 'sgml-recompile-out-of-date-cdtd 'sgml-type '(("No" . nil)
335 ("Yes" . t)
336 ("Ask" . ask)))
337
338 (defvar sgml-trace-entity-lookup nil
339 "*If non-nil, log messages about catalog files used to look for
340 external entities.")
341
342 (defvar sgml-indent-step 2
343 "*How much to increment indent for every element level.
344 If nil, no indentation.
345 Setting this variable automatically makes it local to the current buffer.")
346 (make-variable-buffer-local 'sgml-indent-step)
347 (put 'sgml-indent-step 'sgml-type '(("None" . nil) 0 1 2 3 4 5 6 7 8))
348
349 (defvar sgml-indent-data nil
350 "*If non-nil, indent in data/mixed context also.
351 Setting this variable automatically makes it local to the current buffer.")
352 (make-variable-buffer-local 'sgml-indent-data)
353
354 (defvar sgml-content-indent-function 'sgml-indent-according-to-level)
355 (defvar sgml-attribute-indent-function 'sgml-indent-according-to-stag)
356
357
358 (defun sgml-parse-colon-path (cd-path)
359 "Explode a colon-separated list of paths into a string list."
360 (if (null cd-path)
361 nil
362 (let ((cd-sep ":")
363 cd-list (cd-start 0) cd-colon)
364 (if (boundp 'path-separator)
365 (setq cd-sep path-separator))
366 (setq cd-path (concat cd-path cd-sep))
367 (while (setq cd-colon (string-match cd-sep cd-path cd-start))
368 (setq cd-list
369 (nconc cd-list
370 (list (if (= cd-start cd-colon)
371 nil
372 (substitute-in-file-name
373 (substring cd-path cd-start cd-colon))))))
374 (setq cd-start (+ cd-colon 1)))
375 cd-list)))
376
377 (defvar sgml-system-path (sgml-parse-colon-path
378 (or (getenv "SGML_SEARCH_PATH")
379 "."))
380 "*List of directories used to look for system identifiers.")
381 (put 'sgml-system-path 'sgml-type 'file-list)
382
383 (defvar sgml-public-map (or (sgml-parse-colon-path (getenv "SGML_PATH"))
384 '("%S" "/usr/local/lib/sgml/%o/%c/%d" ))
385 "*Mapping from public identifiers to file names.
386 This is a list of possible file names. To find the file for a public
387 identifier the elements of the list are used one at the time from the
388 beginning. If the element is a string a file name is constructed from
389 the string by substitution of the whole public identifier for %P,
390 owner for %O, public text class for %C, and public text description
391 for %D. The text class will be converted to lower case and the owner
392 and description will be transliterated according to the variable
393 `sgml-public-transliterations'. If the file exists it will be the file
394 used for the public identifier. An element can also be a dotted pair
395 \(regexp . filename), the filename is a string treated as above, but
396 only if the regular expression, regexp, matches the public
397 identifier.")
398 (put 'sgml-public-map 'sgml-type 'list)
399
400 (defvar sgml-local-catalogs nil
401 "*A list of SGML entity catalogs to be searched first when parsing the buffer.
402 This is used in addition to `sgml-catalog-files', and `sgml-public-map'.
403 This variable is automatically local to the buffer.")
404 (make-variable-buffer-local 'sgml-local-catalogs)
405 (put 'sgml-local-catalogs 'sgml-type 'file-list)
406
407 (defvar sgml-catalog-files (or (delete nil
408 (sgml-parse-colon-path
409 (getenv "SGML_CATALOG_FILES")))
410 '("catalog" "/usr/local/lib/sgml/catalog"))
411 "*List of catalog entry files.
412 The files are in the format defined in the SGML Open Draft Technical
413 Resolution on Entity Management.")
414 (put 'sgml-catalog-files 'sgml-type 'file-list)
415
416 (defvar sgml-ecat-files '("ECAT" "~/sgml/ECAT" "/usr/local/lib/sgml/ECAT")
417 "*List of catalog files for PSGML.")
418 (put 'sgml-ecat-files 'sgml-type 'file-list)
419
420 (defvar sgml-local-ecat-files nil
421 "*List of local catalog files for PSGML.
422 Automatically becomes buffer local if set.")
423
424 (make-variable-buffer-local 'sgml-local-ecat-files)
425 (put 'sgml-local-ecat-files 'sgml-type 'file-list)
426
427 (defvar sgml-public-transliterations '((? . ?_) (?/ . ?%))
428 "*Transliteration for characters that should be avoided in file names.
429 This is a list of dotted pairs (FROM . TO); where FROM is the the
430 character to be translated to TO. This is used when parts of a public
431 identifier are used to construct a file name.")
432
433 (defvar sgml-default-dtd-file nil
434 "*This is the default file name for saved DTD.
435 This is set by sgml-mode from the buffer file name.
436 Can be changed in the Local variables section of the file.")
437 (put 'sgml-default-dtd-file 'sgml-type 'string)
438 (put 'sgml-default-dtd-file 'sgml-desc "Default (saved) DTD File")
439
440 (defvar sgml-exposed-tags '()
441 "*The list of tag names that remain visible, despite \\[sgml-hide-tags].
442 Each name is a lowercase string, and start-tags and end-tags must be
443 listed individually.
444
445 `sgml-exposed-tags' is local to each buffer in which it has been set;
446 use `setq-default' to set it to a value that is shared among buffers.")
447 (make-variable-buffer-local 'sgml-exposed-tags)
448 (put 'sgml-exposed-tags 'sgml-type 'list)
449
450
451 (defvar sgml-custom-markup nil
452 "*Menu entries to be added to the Markup menu.
453 The value should be a list of lists of two strings. The first
454 string is the menu line and the second string is the text inserted
455 when the menu item is chosen. The second string can contain a \\r
456 where the cursor should be left. Also if a selection is made
457 according the same rules as for the Tags menu, the selection is
458 replaced with the second string and \\r is replaced with the
459 selection.
460
461 Example:
462
463 ((\"Version1\" \"<![%Version1[\\r]]>\")
464 (\"New page\" \"<?NewPage>\"))
465 ")
466
467 (defvar sgml-custom-dtd nil
468 "Menu entries to be added to the DTD menu.
469 The value should be a list of entries to be added to the DTD menu.
470 Every entry should be a list. The first element of the entry is a string
471 used as the menu entry. The second element is a string containing a
472 doctype declaration (this can be nil if no doctype). The rest of the
473 list should be a list of variables and values. For backward
474 compatibility a single string instead of a variable is assigned to
475 `sgml-default-dtd-file'. All variables are made buffer local and are also
476 added to the buffers local variables list.
477
478 Example:
479 ((\"HTML\" nil
480 sgml-default-dtd-file \"~/sgml/html.ced\"
481 sgml-omittag nil sgml-shorttag nil)
482 (\"HTML+\" \"<!doctype htmlplus system 'htmlplus.dtd'>\"
483 \"~/sgml/htmlplus.ced\"
484 sgml-omittag t sgml-shorttag nil)
485 (\"DOCBOOK\" \"<!doctype docbook system 'docbook.dtd'>\"
486 \"~/sgml/docbook.ced\"
487 sgml-omittag nil sgml-shorttag t)))
488 ")
489
490
491 ;;; Faces used in edit attribute buffer:
492 (put 'sgml-default 'face 'underline) ; Face for #DEFAULT
493 (put 'sgml-fixed 'face 'underline) ; Face of #FIXED "..."
494
495
496 ;;; nsgmls is a free SGML parser in the SP suite available from
497 ;;; ftp.jclark.com:pub/sp
498 ;;; Its error messages can be parsed by next-error.
499 ;;; The -s option suppresses output.
500
501 (defvar sgml-validate-command "nsgmls -s %s %s"
502 "*The shell command to validate an SGML document.
503
504 This is a `format' control string that by default should contain two
505 `%s' conversion specifications: the first will be replaced by the
506 value of `sgml-declaration' \(or the empty string, if nil\); the
507 second will be replaced by the current buffer's file name \(or the
508 empty string, if nil\).
509
510 If `sgml-validate-files' is non-nil, the format string should contain
511 one `%s' conversion specification for each element of its result.
512
513 If sgml-validate-command is a list, then every element should be a
514 string. The strings will be tried in order and %-sequences in the
515 string will be replaced according to the list below, if the string contains
516 %-sequences with no replacement value the next string will be tried.
517
518 %b means the visited file of the current buffer
519 %s means the SGML declaration specified in the sgml-declaration variable
520 %d means the file containing the DOCTYPE declaration, if not in the buffer
521 ")
522 (make-variable-buffer-local 'sgml-validate-command)
523
524 (defvar sgml-xml-validate-command "nsgmls -wxml -s %s %s"
525 "*The default for `sgml-validate-command' in XML mode.")
526
527 (defvar sgml-validate-files nil
528 "If non-nil, a function of no arguments that returns a list of file names.
529 These file names will serve as the arguments to the `sgml-validate-command'
530 format control string instead of the defaults.")
531
532 (defvar sgml-validate-error-regexps
533 '((".*:\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[EXW]: " 1 2 3)
534 ("\\(error\\|warning\\) at \\([^,]+\\), line \\([0-9]+\\)" 2 3)
535 ("\n[a-zA-Z]?:?[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\
536 \\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4))
537 "Alist of regexps to recognize error messages from `sgml-validate'.
538 See `compilation-error-regexp-alist'.")
539
540 (defvar sgml-declaration nil
541 "*If non-nil, the name of the SGML declaration file.")
542 (put 'sgml-declaration 'sgml-type 'file-or-nil)
543
544 (defvar sgml-xml-declaration nil
545 "*If non-nil, the name of the SGML declaration for XML files.")
546 (put 'sgml-xml-declaration 'sgml-type 'file-or-nil)
547
548 (defvar sgml-mode-hook nil
549 "A hook or list of hooks to be run when entering sgml-mode")
550
551 (defvar sgml-mode-map nil
552 "Keymap for SGML mode")
553
554 (defvar sgml-show-context-function
555 'sgml-show-context-standard
556 "*Function to called to show context of and element.
557 Should return a string suitable form printing in the echo area.")
558
559 (defconst sgml-file-options
560 '(
561 sgml-omittag
562 sgml-shorttag
563 sgml-namecase-general
564 sgml-general-insert-case
565 sgml-minimize-attributes
566 sgml-always-quote-attributes
567 sgml-indent-step
568 sgml-indent-data
569 sgml-doctype
570 sgml-parent-document
571 sgml-default-dtd-file
572 sgml-exposed-tags
573 sgml-local-catalogs
574 sgml-local-ecat-files
575 )
576 "Options for the current file, can be saved or set from menu."
577 )
578
579 (defconst sgml-user-options
580 '(
581 sgml-set-face
582 sgml-live-element-indicator
583 sgml-auto-activate-dtd
584 sgml-offer-save
585 sgml-tag-region-if-active
586 sgml-normalize-trims
587 sgml-auto-insert-required-elements
588 sgml-balanced-tag-edit
589 sgml-omittag-transparent
590 sgml-leave-point-after-insert
591 sgml-insert-missing-element-comment
592 sgml-insert-end-tag-on-new-line
593 sgml-warn-about-undefined-elements
594 sgml-warn-about-undefined-entities
595 sgml-ignore-undefined-elements
596 sgml-recompile-out-of-date-cdtd
597 sgml-default-doctype-name
598 sgml-declaration
599 sgml-validate-command
600 sgml-markup-faces
601 sgml-system-identifiers-are-preferred
602 sgml-trace-entity-lookup
603 sgml-public-map
604 sgml-catalog-files
605 sgml-ecat-files
606 sgml-general-insert-case
607 )
608 "User options that can be saved or set from menu."
609 )
610
611 ;;; Internal variables
612
613 (defvar sgml-validate-command-history nil
614 "The minibuffer history list for `sgml-validate''s COMMAND argument.")
615
616 (defvar sgml-active-dtd-indicator nil
617 "Displayed in the mode line")
618
619
620 ;;;; User options handling
621
622 (defun sgml-variable-description (var)
623 (or (get var 'sgml-desc)
624 (let ((desc (symbol-name var)))
625 (if (string= "sgml-" (substring desc 0 5))
626 (setq desc (substring desc 5)))
627 (loop for c across-ref desc
628 do (if (eq c ?-) (setf c ? )))
629 (capitalize desc))))
630
631 (defun sgml-variable-type (var)
632 (or (get var 'sgml-type)
633 (if (memq (symbol-value var) '(t nil))
634 'toggle)))
635
636 (defun sgml-set-local-variable (var val)
637 "Set the value of variable VAR to VAL in buffer and local variables list."
638 (set (make-local-variable var) val)
639 (save-excursion
640 (let ((prefix "")
641 (suffix "")
642 (case-fold-search t))
643 (goto-char (max (point-min) (- (point-max) 3000)))
644 (cond ((search-forward "Local Variables:" nil t)
645 (setq suffix (buffer-substring (point)
646 (save-excursion (end-of-line 1)
647 (point))))
648 (setq prefix
649 (buffer-substring (save-excursion (beginning-of-line 1)
650 (point))
651 (match-beginning 0))))
652 (t
653 (goto-char (point-max))
654 (unless (bolp)
655 (insert ?\n))
656 (insert
657 "<!-- Keep this comment at the end of the file\n"
658 "Local variables:\n"
659 (if sgml-xml-p
660 "mode: xml\n"
661 "mode: sgml\n")
662 "End:\n"
663 "-->\n")
664 (forward-line -3)))
665 (let* ((endpos (save-excursion
666 (search-forward (format "\n%send:" prefix))))
667 (varpos (search-forward (format "\n%s%s:" prefix var) endpos t)))
668 (cond (varpos
669 (delete-region (point)
670 (save-excursion (end-of-line 1)
671 (point)))
672 (insert (format "%S" val) suffix))
673 (t
674 (goto-char endpos)
675 (beginning-of-line 1)
676 (insert prefix (format "%s:%S" var val) suffix ?\n)))))))
677
678 (defun sgml-valid-option (var)
679 (let ((type (sgml-variable-type var))
680 (val (symbol-value var)))
681 (cond ((eq 'string type)
682 (stringp val))
683 ((eq 'list-or-string type)
684 (or (stringp val)
685 (consp val)))
686 (t
687 t))))
688
689 (defun sgml-save-options ()
690 "Save user options for SGML mode that have buffer local values."
691 (interactive)
692 (loop for var in sgml-file-options do
693 (when (sgml-valid-option var)
694 (sgml-set-local-variable var (symbol-value var)))))
695
696
697 ;;;; Run hook with args
698
699 (unless (fboundp 'run-hook-with-args)
700 (defun run-hook-with-args (hook &rest args)
701 "Run HOOK with the specified arguments ARGS.
702 HOOK should be a symbol, a hook variable. If HOOK has a non-nil
703 value, that value may be a function or a list of functions to be
704 called to run the hook. If the value is a function, it is called with
705 the given arguments and its return value is returned. If it is a list
706 of functions, those functions are called, in order,
707 with the given arguments ARGS.
708 It is best not to depend on the value return by `run-hook-with-args',
709 as that may change."
710 (and (boundp hook)
711 (symbol-value hook)
712 (let ((value (symbol-value hook)))
713 (if (and (listp value) (not (eq (car value) 'lambda)))
714 (mapcar '(lambda (foo) (apply foo args))
715 value)
716 (apply value args))))))
717
718
719
720
721 ;;;; SGML mode: template functions
722
723 (defun sgml-markup (entry text)
724 (cons entry
725 `(lambda ()
726 (interactive)
727 (sgml-insert-markup ,text))))
728
729 (defun sgml-insert-markup (text)
730 (let ((end (sgml-mouse-region))
731 before after
732 old-text)
733 (when end
734 (setq old-text (buffer-substring (point) end))
735 (delete-region (point) end))
736 (setq before (point))
737 (if (stringp text)
738 (insert text)
739 (eval text))
740 (setq after (point))
741 (goto-char before)
742 (when (search-forward "\r" after t)
743 (delete-char -1))
744 (when old-text (insert old-text))))
745
746 (defun sgml-mouse-region ()
747 (let (start end)
748 (cond
749 (sgml-running-lucid
750 (cond
751 ((null (mark-marker)) nil)
752 (t (setq start (region-beginning)
753 end (region-end)))))
754 ((and transient-mark-mode
755 mark-active)
756 (setq start (region-beginning)
757 end (region-end)))
758 ((and mouse-secondary-overlay
759 (eq (current-buffer)
760 (overlay-buffer mouse-secondary-overlay)))
761 (setq start (overlay-start mouse-secondary-overlay)
762 end (overlay-end mouse-secondary-overlay))
763 (delete-overlay mouse-secondary-overlay)))
764 (when start
765 (goto-char start))
766 end))
767
768
769 ;;;; SGML mode: indentation
770
771 (defun sgml-indent-or-tab ()
772 "Indent line in proper way for current major mode."
773 (interactive)
774 (if (null sgml-indent-step)
775 (insert-tab)
776 (funcall indent-line-function)))
777
778 ;;;; Bug reporting
779
780 (eval-and-compile
781 (autoload 'reporter-submit-bug-report "reporter"))
782
783 (defun sgml-submit-bug-report ()
784 "Submit via mail a bug report on PSGML."
785 (interactive)
786 (and (y-or-n-p "Do you really want to submit a report on PSGML? ")
787 (reporter-submit-bug-report
788 psgml-maintainer-address
789 (concat "psgml.el " psgml-version)
790 (list
791 'major-mode
792 'sgml-always-quote-attributes
793 'sgml-auto-activate-dtd
794 'sgml-auto-insert-required-elements
795 'sgml-balanced-tag-edit
796 'sgml-catalog-files
797 'sgml-declaration
798 'sgml-doctype
799 'sgml-ecat-files
800 'sgml-indent-data
801 'sgml-indent-step
802 'sgml-leave-point-after-insert
803 'sgml-live-element-indicator
804 'sgml-local-catalogs
805 'sgml-local-ecat-files
806 'sgml-markup-faces
807 'sgml-minimize-attributes
808 'sgml-normalize-trims
809 'sgml-omittag
810 'sgml-omittag-transparent
811 'sgml-parent-document
812 'sgml-public-map
813 'sgml-set-face
814 'sgml-shorttag
815 'sgml-namecase-general
816 'sgml-tag-region-if-active
817 'sgml-use-text-properties
818 ))))
819
820 ;;;; SGML mode: syntax table
821
822 (defvar sgml-mode-syntax-table
823 (let ((s (copy-syntax-table text-mode-syntax-table)))
824 (modify-syntax-entry ?< "." s)
825 (modify-syntax-entry ?> "." s)
826 s))
827
828
829 ;;;; SGML mode: keys and menus
830
831 (if sgml-mode-map
832 ()
833 (setq sgml-mode-map (make-sparse-keymap)))
834
835 (defvar sgml-prefix-f-map (make-sparse-keymap))
836 (defvar sgml-prefix-u-map (make-sparse-keymap))
837
838 (define-key sgml-mode-map "\C-c\C-f" sgml-prefix-f-map)
839 (define-key sgml-mode-map "\C-c\C-u" sgml-prefix-u-map)
840
841 ;;; Key commands
842
843 (define-key sgml-mode-map "\t" 'sgml-indent-or-tab)
844 ;(define-key sgml-mode-map "<" 'sgml-insert-tag)
845 (define-key sgml-mode-map ">" 'sgml-close-angle)
846 (define-key sgml-mode-map "/" 'sgml-slash)
847 (define-key sgml-mode-map "\C-c#" 'sgml-make-character-reference)
848 (define-key sgml-mode-map "\C-c-" 'sgml-untag-element)
849 (define-key sgml-mode-map "\C-c+" 'sgml-insert-attribute)
850 (define-key sgml-mode-map "\C-c/" 'sgml-insert-end-tag)
851 (define-key sgml-mode-map "\C-c<" 'sgml-insert-tag)
852 (define-key sgml-mode-map "\C-c=" 'sgml-change-element-name)
853 (define-key sgml-mode-map "\C-c\C-a" 'sgml-edit-attributes)
854 (define-key sgml-mode-map "\C-c\C-c" 'sgml-show-context)
855 (define-key sgml-mode-map "\C-c\C-d" 'sgml-next-data-field)
856 (define-key sgml-mode-map "\C-c\C-e" 'sgml-insert-element)
857 (define-key sgml-mode-map "\C-c\C-f\C-e" 'sgml-fold-element)
858 (define-key sgml-mode-map "\C-c\C-f\C-r" 'sgml-fold-region)
859 (define-key sgml-mode-map "\C-c\C-f\C-s" 'sgml-fold-subelement)
860 (define-key sgml-mode-map "\C-c\C-f\C-x" 'sgml-expand-element)
861 (define-key sgml-mode-map "\C-c\C-i" 'sgml-add-element-to-element)
862 (define-key sgml-mode-map "\C-c\C-k" 'sgml-kill-markup)
863 (define-key sgml-mode-map "\C-c\r" 'sgml-split-element)
864 (define-key sgml-mode-map "\C-c\C-n" 'sgml-up-element)
865 (define-key sgml-mode-map "\C-c\C-o" 'sgml-next-trouble-spot)
866 (define-key sgml-mode-map "\C-c\C-p" 'sgml-load-doctype)
867 (define-key sgml-mode-map "\C-c\C-q" 'sgml-fill-element)
868 (define-key sgml-mode-map "\C-c\C-r" 'sgml-tag-region)
869 (define-key sgml-mode-map "\C-c\C-s" 'sgml-show-structure)
870 ;(define-key sgml-mode-map "\C-c\C-t" 'sgml-list-valid-tags)
871 (define-key sgml-mode-map "\C-c\C-t" 'sgml-show-current-element-type)
872 (define-key sgml-mode-map "\C-c\C-u\C-a" 'sgml-unfold-all)
873 (define-key sgml-mode-map "\C-c\C-u\C-d" 'sgml-custom-dtd)
874 (define-key sgml-mode-map "\C-c\C-u\C-e" 'sgml-unfold-element)
875 (define-key sgml-mode-map "\C-c\C-u\C-l" 'sgml-unfold-line)
876 (define-key sgml-mode-map "\C-c\C-u\C-m" 'sgml-custom-markup)
877 (define-key sgml-mode-map "\C-c\C-v" 'sgml-validate)
878 (define-key sgml-mode-map "\C-c\C-w" 'sgml-what-element)
879 (define-key sgml-mode-map "\C-c\C-z" 'sgml-trim-and-leave-element)
880
881 (define-key sgml-mode-map "\e\C-a" 'sgml-beginning-of-element)
882 (define-key sgml-mode-map "\e\C-e" 'sgml-end-of-element)
883 (define-key sgml-mode-map "\e\C-f" 'sgml-forward-element)
884 (define-key sgml-mode-map "\e\C-b" 'sgml-backward-element)
885 (define-key sgml-mode-map "\e\C-d" 'sgml-down-element)
886 (define-key sgml-mode-map "\e\C-u" 'sgml-backward-up-element)
887 (define-key sgml-mode-map "\e\C-k" 'sgml-kill-element)
888 (define-key sgml-mode-map "\e\C-@" 'sgml-mark-element)
889 ;;(define-key sgml-mode-map [?\M-\C-\ ] 'sgml-mark-element)
890 (define-key sgml-mode-map [(meta control h)] 'sgml-mark-current-element)
891 (define-key sgml-mode-map "\e\C-t" 'sgml-transpose-element)
892 (define-key sgml-mode-map "\M-\t" 'sgml-complete)
893
894 ;;;; Menu bar
895
896 (easy-menu-define
897 sgml-main-menu sgml-mode-map "Main menu"
898 '("SGML"
899 ["Parse DTD" sgml-parse-prolog t]
900 ("DTD Info"
901 ["General DTD info" sgml-general-dtd-info t]
902 ["Describe element type" sgml-describe-element-type t]
903 ["Describe entity" sgml-describe-entity t]
904 ["List elements" sgml-list-elements t]
905 ["List attributes" sgml-list-attributes t]
906 ["List terminals" sgml-list-terminals t]
907 ["List content elements" sgml-list-content-elements t]
908 ["List occur in elements" sgml-list-occur-in-elements t])
909 ("Insert Markup"
910 ["Insert Element" sgml-element-menu t]
911 ["Insert Start-Tag" sgml-start-tag-menu t]
912 ["Insert End-Tag" sgml-end-tag-menu t]
913 ["End Current Element" sgml-insert-end-tag t]
914 ["Tag Region" sgml-tag-region-menu t]
915 ["Insert Attribute" sgml-attrib-menu t]
916 ["Insert Entity" sgml-entities-menu t]
917 ["Add Element to Element" sgml-add-element-menu t]
918 ("Insert DTD")
919 ("Custom markup" "---"))
920 "--"
921 ["Show Context" sgml-show-context t]
922 ["What Element" sgml-what-element t]
923 ["List Valid Tags" sgml-list-valid-tags t]
924 ["Validate" sgml-validate t]
925 "--"
926 ("Move"
927 ["Next trouble spot" sgml-next-trouble-spot t]
928 ["Next data field" sgml-next-data-field t]
929 ["Forward element" sgml-forward-element t]
930 ["Backward element" sgml-backward-element t]
931 ["Up element" sgml-up-element t]
932 ["Down element" sgml-down-element t]
933 ["Backward up element" sgml-backward-up-element t]
934 ["Beginning of element" sgml-beginning-of-element t]
935 ["End of element" sgml-end-of-element t])
936 ("View"
937 ["Fold Element" sgml-fold-element t]
938 ["Fold Subelement" sgml-fold-subelement t]
939 ["Unfold Line" sgml-unfold-line t]
940 ["Unfold Element" sgml-unfold-element t]
941 ["Expand" sgml-expand-element t]
942 ["Fold Region" sgml-fold-region t]
943 ["Unfold All" sgml-unfold-all t]
944 ["Hide Tags" sgml-hide-tags t]
945 ["Hide Attributes" sgml-hide-attributes t]
946 ["Show All Tags" sgml-show-tags t])
947 "--"
948 ["Normalize Document" sgml-normalize t]
949 ["Normalize Element" sgml-normalize-element t]
950 ["Expand All Short References" sgml-expand-all-shortrefs (not sgml-xml-p)]
951 ["Expand Entity Reference" sgml-expand-entity-reference t]
952 ["Make Character Reference" sgml-make-character-reference t]
953 ["Unmake Character Reference" (sgml-make-character-reference t) t]
954 ["Fill Element" sgml-fill-element t]
955 ["Change Element Name..." sgml-change-element-name t]
956 ["Edit Attributes..." sgml-edit-attributes t]
957 ["Kill Markup" sgml-kill-markup t]
958 ["Kill Element" sgml-kill-element t]
959 ["Untag Element" sgml-untag-element t]
960 ["Trim and leave element" sgml-trim-and-leave-element t]
961 ["Decode Character Entities" sgml-charent-to-display-char t]
962 ["Encode Characters" sgml-display-char-to-charent t]
963 "--"
964 ("File Options" "---")
965 ("User Options" "---")
966 ["Reset Buffer" normal-mode t]
967 ["Submit Bug Report" sgml-submit-bug-report t]
968 ))
969
970
971 (defun sgml-options-menu-items (vars)
972 (mapcar (lambda (var)
973 (let ((desc (format "%s [%s]"
974 (sgml-variable-description var)
975 (sgml-option-value-indicator var)))
976 (type (sgml-variable-type var)))
977 (cond ((consp type)
978 (cons desc
979 (mapcar (lambda (c)
980 (vector
981 (if (consp c) (car c) (format "%s" c))
982 `(setq ,var ',(if (consp c) (cdr c) c))
983 t))
984 type)))
985 (t
986 (vector desc `(sgml-do-set-option ',var) t)))))
987 vars))
988
989 (defun sgml-option-value-indicator (var)
990 (let ((type (sgml-variable-type var))
991 (val (symbol-value var)))
992 (cond
993 ((eq type 'toggle)
994 (if val "Yes" "No"))
995 ((eq type 'string)
996 (if (stringp val)
997 (substring val 0 (min (length val) 4))
998 "-"))
999 ((and (atom type) val)
1000 "...")
1001 ((consp type)
1002 (or (car (rassq val type))
1003 val))
1004 (t
1005 "-"))))
1006
1007 (defvar sgml-last-options-menu-values ())
1008
1009 (defun sgml-any-option-changed (oldvalues vars)
1010 (not (loop for val in oldvalues
1011 for var in vars
1012 always (eq val (symbol-value var)))))
1013
1014 (defun sgml-update-options-menu (menuname option-vars &optional save-func)
1015 (let ((last-values (assoc menuname sgml-last-options-menu-values)))
1016 (when (or (null last-values)
1017 (sgml-any-option-changed (cdr last-values)
1018 option-vars))
1019 (condition-case err
1020 (easy-menu-change '("SGML") menuname
1021 (nconc (sgml-options-menu-items option-vars)
1022 (if save-func
1023 (list "---"
1024 (vector (format "Save %s" menuname)
1025 save-func t)))))
1026 (error
1027 (message "Error in update menu: %s" err)))
1028 (unless last-values
1029 (setq last-values (cons menuname nil))
1030 (push last-values sgml-last-options-menu-values))
1031 (setf (cdr last-values) (mapcar (function symbol-value) option-vars)))))
1032
1033
1034 (defun sgml-update-all-options-menus ()
1035 (sgml-update-options-menu "File Options" sgml-file-options
1036 'sgml-save-options)
1037 (sgml-update-options-menu "User Options" sgml-user-options)
1038 nil)
1039
1040 (defun sgml-compute-insert-dtd-items ()
1041 (loop for e in sgml-custom-dtd collect
1042 (vector (first e)
1043 `(sgml-doctype-insert ,(cadr e) ',(cddr e))
1044 t)))
1045
1046 (defun sgml-compute-custom-markup-items ()
1047 (loop for e in sgml-custom-markup collect
1048 (vector (first e)
1049 `(sgml-insert-markup ,(cadr e))
1050 t)))
1051
1052 (defun sgml-build-custom-menus ()
1053 "Build custom parts of Markup and DTD menus."
1054 (let ((button3 (lookup-key (current-local-map) [button3])))
1055 (unless (or (null button3)
1056 (numberp button3))
1057 (local-set-key [button3] button3))
1058 (when sgml-custom-dtd
1059 (easy-menu-change '("SGML" "Insert Markup") "Insert DTD"
1060 (sgml-compute-insert-dtd-items)))
1061 (when sgml-custom-markup
1062 (easy-menu-change '("SGML" "Insert Markup") "Custom markup"
1063 (sgml-compute-custom-markup-items))))
1064 nil)
1065
1066
1067 ;;;; Post command hook
1068
1069 (defvar sgml-auto-activate-dtd-tried nil)
1070 (make-variable-buffer-local 'sgml-auto-activate-dtd-tried)
1071
1072 (defvar sgml-buffer-parse-state nil
1073 "If the buffers DTD has been activated this contains the parser state.
1074 The parser state has been created with `sgml-make-pstate' and contains
1075 the information about the DTD and the parse tree. This parse state is
1076 actually only the state that persists between commands.")
1077 (make-variable-buffer-local 'sgml-buffer-parse-state)
1078
1079 (eval-and-compile ; Interface to psgml-parse
1080 (loop for fun in '(sgml-need-dtd sgml-update-display
1081 sgml-fontify-buffer
1082 sgml-subst-expand
1083 sgml-declaration)
1084 do (autoload fun "psgml-parse")))
1085
1086
1087 (defun sgml-command-post ()
1088 (when (and (null sgml-buffer-parse-state)
1089 sgml-auto-activate-dtd
1090 (null sgml-auto-activate-dtd-tried)
1091 (not (zerop (buffer-size)))
1092 (looking-at ".*<"))
1093 (setq sgml-auto-activate-dtd-tried t)
1094 (ignore-errors
1095 (sgml-need-dtd)
1096 (sgml-fontify-buffer 0)))
1097 (when sgml-buffer-parse-state
1098 (sgml-update-display)))
1099
1100
1101 ;;;; SGML mode: major mode definition
1102
1103 ;;; This section is mostly from sgml-mode by James Clark.
1104
1105 ;;;###autoload
1106 (defun sgml-mode ()
1107 "Major mode for editing SGML.
1108 \\<sgml-mode-map>Makes > display the matching <. Makes / display matching /.
1109 Use \\[sgml-validate] to validate your document with an SGML parser.
1110
1111 You can find information with:
1112 \\[sgml-show-context] Show the nesting of elements at cursor position.
1113 \\[sgml-list-valid-tags] Show the tags valid at cursor position.
1114
1115 Insert tags with completion of contextually valid tags with \\[sgml-insert-tag].
1116 End the current element with \\[sgml-insert-end-tag]. Insert an element (i.e.
1117 both start and end tag) with \\[sgml-insert-element]. Or tag a region with
1118 \\[sgml-tag-region].
1119
1120 To tag a region with the mouse, use transient mark mode or secondary selection.
1121
1122 Structure editing:
1123 \\[sgml-backward-element] Moves backwards over the previous element.
1124 \\[sgml-forward-element] Moves forward over the next element.
1125 \\[sgml-down-element] Move forward and down one level in the element structure.
1126 \\[sgml-backward-up-element] Move backward out of this element level.
1127 \\[sgml-beginning-of-element] Move to after the start tag of the current element.
1128 \\[sgml-end-of-element] Move to before the end tag of the current element.
1129 \\[sgml-kill-element] Kill the element following the cursor.
1130
1131 Finding interesting positions
1132 \\[sgml-next-data-field] Move forward to next point where data is allowed.
1133 \\[sgml-next-trouble-spot] Move forward to next point where something is
1134 amiss with the structure.
1135
1136 Folding and unfolding
1137 \\[sgml-fold-element] Fold the lines comprising the current element, leaving
1138 the first line visible.
1139 \\[sgml-fold-subelement] Fold the elements in the content of the current element.
1140 Leaving the first line of every element visible.
1141 \\[sgml-unfold-line] Show hidden lines in current line.
1142
1143 User options:
1144
1145 sgml-omittag Set this to reflect OMITTAG in the SGML declaration.
1146 sgml-shorttag Set this to reflect SHORTTAG in the SGML declaration.
1147 sgml-namecase-general Set this to reflect NAMECASE GENERAL in the SGML declaration.
1148 sgml-auto-insert-required-elements If non-nil, automatically insert required
1149 elements in the content of an inserted element.
1150 sgml-omittag-transparent If non-nil, will show legal tags inside elements
1151 with omitable start tags and legal tags beyond omitable end tags.
1152 sgml-leave-point-after-insert If non-nil, the point will remain after
1153 inserted tag(s).
1154 sgml-warn-about-undefined-elements If non-nil, print a warning when a tag
1155 for a undefined element is found.
1156 sgml-max-menu-size Max number of entries in Tags and Entities menus before
1157 they are split into several panes.
1158 sgml-always-quote-attributes If non-nil, quote all attribute values
1159 inserted after finishing edit attributes.
1160 sgml-minimize-attributes Determines minimization of attributes inserted by
1161 edit-attributes.
1162 sgml-normalize-trims If non-nil, sgml-normalize will trim off white space
1163 from end of element when adding end tag.
1164 sgml-indent-step How much to increment indent for every element level.
1165 sgml-indent-data If non-nil, indent in data/mixed context also.
1166 sgml-set-face If non-nil, psgml will set the face of parsed markup.
1167 sgml-markup-faces The faces used when the above variable is non-nil.
1168 sgml-public-map Mapping from public identifiers to file names.
1169 sgml-offer-save If non-nil, ask about saving modified buffers before
1170 \\[sgml-validate] is run.
1171
1172 All bindings:
1173 \\{sgml-mode-map}"
1174 (interactive)
1175 (kill-all-local-variables)
1176 (setq sgml-xml-p nil)
1177 (setq local-abbrev-table sgml-mode-abbrev-table)
1178 (use-local-map sgml-mode-map)
1179 (setq mode-name "SGML")
1180 (setq major-mode 'sgml-mode)
1181
1182 ;; A start or end tag by itself on a line separates a paragraph.
1183 ;; This is desirable because SGML discards a newline that appears
1184 ;; immediately after a start tag or immediately before an end tag.
1185
1186 (set (make-local-variable 'paragraph-separate)
1187 (if sgml-have-re-char-clases
1188 "^[ \t\n]*$\\|\
1189 ^[ \t]*</?\\([_[:alpha:]]\\([-:._[:alnum:]= \t\n]\\|\
1190 \"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
1191 "^[ \t\n]*$\\|\
1192 ^[ \t]*</?\\([_A-Za-z]\\([-:._A-Za-z0-9= \t\n]\\|\
1193 \"[^\"]*\"\\|'[^']*'\\)*\\)?>$"))
1194 (set (make-local-variable 'paragraph-start)
1195 paragraph-separate)
1196
1197 (set-syntax-table sgml-mode-syntax-table)
1198 (make-local-variable 'comment-start)
1199 (setq comment-start "<!-- ")
1200 (make-local-variable 'comment-end)
1201 (setq comment-end " -->")
1202 (make-local-variable 'comment-indent-function)
1203 (setq comment-indent-function 'sgml-comment-indent)
1204 (make-local-variable 'comment-start-skip)
1205 ;; This will allow existing comments within declarations to be
1206 ;; recognized. [Does not work well with auto-fill, Lst/940205]
1207 ;;(setq comment-start-skip "--[ \t]*")
1208 (setq comment-start-skip "<!--[ \t]*")
1209 ;; Added for psgml:
1210 (make-local-variable 'indent-line-function)
1211 (setq indent-line-function 'sgml-indent-line)
1212 (make-local-variable 'mode-line-format)
1213 (if (featurep 'xemacs)
1214 ;; Modify mode-line-format with susbt (sugested by wing)
1215 ;; Apart from requiring CL at runtime, this doesn't work in Emacs
1216 ;; 21. It's the sort of thing which-func is supposed to do...
1217 (setq mode-line-format
1218 (subst '("" mode-name sgml-active-dtd-indicator) 'mode-name
1219 mode-line-format))
1220 (set (make-local-variable 'which-func-format) 'sgml-active-dtd-indicator))
1221 (make-local-variable 'sgml-default-dtd-file)
1222 (when (setq sgml-default-dtd-file (sgml-default-dtd-file))
1223 (unless (file-exists-p sgml-default-dtd-file)
1224 (setq sgml-default-dtd-file nil)))
1225 ;;; This doesn't DTRT with Emacs 21.1 newcomment -- intermediate lines
1226 ;;; are prefixed by `!--'. -- fx
1227 ;;; (set (make-local-variable 'comment-style) 'multi-line)
1228 (when sgml-default-nonsticky
1229 (make-local-variable 'text-property-default-nonsticky)
1230 ;; see `sgml-set-face-for':
1231 (add-to-list 'text-property-default-nonsticky '(face . t)))
1232 (add-hook 'post-command-hook 'sgml-command-post 'append 'local)
1233 (add-hook 'activate-menubar-hook 'sgml-update-all-options-menus
1234 nil 'local)
1235 (run-hooks 'text-mode-hook 'sgml-mode-hook)
1236 (easy-menu-add sgml-main-menu)
1237 (sgml-build-custom-menus))
1238
1239 ;; It would be nice to generalize the `auto-mode-interpreter-regexp'
1240 ;; machinery so that we could select xml-mode on the basis of the
1241 ;; leading xml PI. -- fx
1242
1243 ;;;###autoload
1244 (define-derived-mode xml-mode sgml-mode "XML"
1245 "Major mode for editing XML, specialized from SGML mode.
1246 Sets various variables appropriately for XML.
1247
1248 Can be used without a DTD. In that case, warnings about undefined
1249 elements and entities are suppressed and various commands' behaviour
1250 is modified to account for the lack of information. For instance, the
1251 element names offered for selection or completion are those in the
1252 parse of the document, but other names may be entered.
1253
1254 Note that without a DTD, indenting lines will only work if
1255 `sgml-indent-data' is non-nil."
1256 (setq sgml-xml-p t)
1257 ;; XML-friendly settings
1258 (setq sgml-omittag nil)
1259 (setq sgml-shorttag nil)
1260 (setq sgml-namecase-general nil)
1261 (setq sgml-minimize-attributes nil)
1262 (setq sgml-always-quote-attributes t)
1263 (setq sgml-validate-command sgml-xml-validate-command)
1264 (make-local-variable 'sgml-declaration)
1265 (setq sgml-declaration sgml-xml-declaration))
1266
1267
1268 (defun sgml-default-dtd-file ()
1269 (and (buffer-file-name)
1270 (let ((base (file-name-nondirectory (buffer-file-name))))
1271 (concat
1272 (cond ((string-match "\\.[^.]+$" base)
1273 (substring base 0 (match-beginning 0)))
1274 (t
1275 base))
1276 ".ced"))))
1277
1278 (defun sgml-comment-indent ()
1279 (if (and (looking-at "--")
1280 (not (and (eq (char-after (1- (point))) ?!)
1281 (eq (char-after (- (point) 2)) ?<))))
1282 (progn
1283 (skip-chars-backward " \t")
1284 (max comment-column (1+ (current-column))))
1285 0))
1286
1287 (defconst sgml-start-tag-regex
1288 (if sgml-have-re-char-clases
1289 "<[_[:alpha:]]\\([-:.[:alnum:]= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
1290 "<[_A-Za-z]\\([-:.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*")
1291 "Regular expression that matches a non-empty start tag.
1292 Any terminating > or / is not matched.")
1293
1294 (defvar sgml-mode-markup-syntax-table nil
1295 "Syntax table used for scanning SGML markup.")
1296
1297 (if sgml-mode-markup-syntax-table
1298 ()
1299 (setq sgml-mode-markup-syntax-table (make-syntax-table))
1300 (modify-syntax-entry ?< "(>" sgml-mode-markup-syntax-table)
1301 (modify-syntax-entry ?> ")<" sgml-mode-markup-syntax-table)
1302 (modify-syntax-entry ?- "_ 1234" sgml-mode-markup-syntax-table)
1303 (modify-syntax-entry ?\' "\"" sgml-mode-markup-syntax-table))
1304
1305 (defvar sgml-angle-distance 4000
1306 "*If non-nil, is the maximum distance to search for matching <.")
1307
1308 (defun sgml-close-angle (arg)
1309 "Insert > and display matching <."
1310 (interactive "p")
1311 (insert-char ?> arg)
1312 (if (> arg 0)
1313 (let ((oldpos (point))
1314 (blinkpos))
1315 (save-excursion
1316 (save-restriction
1317 (if sgml-angle-distance
1318 (narrow-to-region (max (point-min)
1319 (- (point) sgml-angle-distance))
1320 oldpos))
1321 ;; See if it's the end of a marked section.
1322 (and (> (- (point) (point-min)) 3)
1323 (eq (char-after (- (point) 2)) ?\])
1324 (eq (char-after (- (point) 3)) ?\])
1325 (re-search-backward (if sgml-have-re-char-clases
1326 "<!\\[\\(-?[[:alnum:]. \t\n&;]\\|\
1327 --\\([^-]\\|-[^-]\\)*--\\)*\\["
1328 "<!\\[\\(-?[A-Za-z0-9. \t\n&;]\\|\
1329 --\\([^-]\\|-[^-]\\)*--\\)*\\[")
1330 (point-min)
1331 t)
1332 (let ((msspos (point)))
1333 (if (and (search-forward "]]>" oldpos t)
1334 (eq (point) oldpos))
1335 (setq blinkpos msspos))))
1336 ;; This handles cases where the > ends one of the following:
1337 ;; markup declaration starting with <! (possibly including a
1338 ;; declaration subset); start tag; end tag; SGML declaration.
1339 (if blinkpos
1340 ()
1341 (goto-char oldpos)
1342 (condition-case ()
1343 (let ((oldtable (syntax-table))
1344 (parse-sexp-ignore-comments t))
1345 (unwind-protect
1346 (progn
1347 (set-syntax-table sgml-mode-markup-syntax-table)
1348 (setq blinkpos (scan-sexps oldpos -1)))
1349 (set-syntax-table oldtable)))
1350 (error nil))
1351 (and blinkpos
1352 (goto-char blinkpos)
1353 (or
1354 ;; Check that it's a valid delimiter in context.
1355 (not (looking-at
1356 (if sgml-have-re-char-clases
1357 "<\\(\\?\\|/?[[:alpha:]>]\\|!\\([[[:alpha:]]\\|--\\)\\)"
1358 "<\\(\\?\\|/?[A-Za-z>]\\|!\\([[A-Za-z]\\|--\\)\\)")))
1359 ;; Check that it's not a net-enabling start tag
1360 ;; nor an unclosed start-tag.
1361 (looking-at (concat sgml-start-tag-regex "[/<]"))
1362 ;; Nor an unclosed end-tag.
1363 (looking-at (if sgml-have-re-char-clases
1364 "</[[:alpha:]][-:.[:alnum:]]*[ \t]*<"
1365 "</[A-Za-z][-:.A-Za-z0-9]*[ \t]*<")))
1366 (setq blinkpos nil)))
1367 (if blinkpos
1368 ()
1369 ;; See if it's the end of a processing instruction.
1370 (goto-char oldpos)
1371 (if (search-backward "<?" (point-min) t)
1372 (let ((pipos (point)))
1373 (if (and (search-forward ">" oldpos t)
1374 (eq (point) oldpos))
1375 (setq blinkpos pipos))))))
1376 (if blinkpos
1377 (progn
1378 (goto-char blinkpos)
1379 (if (pos-visible-in-window-p)
1380 (sit-for 1)
1381 (message "Matches %s"
1382 (buffer-substring blinkpos
1383 (progn (end-of-line)
1384 (point)))))))))))
1385
1386 ;;; I doubt that null end tags are used much for large elements,
1387 ;;; so use a small distance here.
1388 (defvar sgml-slash-distance 1000
1389 "*If non-nil, is the maximum distance to search for matching /.")
1390
1391 (defun sgml-slash (arg)
1392 "Insert / and display any previous matching /.
1393 Two /s are treated as matching if the first / ends a net-enabling
1394 start tag, and the second / is the corresponding null end tag."
1395 (interactive "p")
1396 (insert-char ?/ arg)
1397 (if (> arg 0)
1398 (let ((oldpos (point))
1399 (blinkpos)
1400 (level 0))
1401 (save-excursion
1402 (save-restriction
1403 (if sgml-slash-distance
1404 (narrow-to-region (max (point-min)
1405 (- (point) sgml-slash-distance))
1406 oldpos))
1407 (if (and (re-search-backward sgml-start-tag-regex (point-min) t)
1408 (eq (match-end 0) (1- oldpos)))
1409 ()
1410 (goto-char (1- oldpos))
1411 (while (and (not blinkpos)
1412 (search-backward "/" (point-min) t))
1413 (let ((tagend (save-excursion
1414 (if (re-search-backward sgml-start-tag-regex
1415 (point-min) t)
1416 (match-end 0)
1417 nil))))
1418 (if (eq tagend (point))
1419 (if (eq level 0)
1420 (setq blinkpos (point))
1421 (setq level (1- level)))
1422 (setq level (1+ level)))))))
1423 (if blinkpos
1424 (progn
1425 (goto-char blinkpos)
1426 (if (pos-visible-in-window-p)
1427 (sit-for 1)
1428 (message "Matches %s"
1429 (buffer-substring (progn
1430 (beginning-of-line)
1431 (point))
1432 (1+ blinkpos))))))))))
1433
1434 (eval-and-compile
1435 (autoload 'compile-internal "compile" ""))
1436
1437 (defun sgml-default-validate-command ()
1438 (cond
1439 ((consp sgml-validate-command)
1440 (let ((validate-subst
1441 (list
1442 (cons ?b (and (buffer-file-name)
1443 (file-name-nondirectory (buffer-file-name))))
1444 (cons ?s (sgml-declaration))
1445 (cons ?v sgml-declaration)
1446 (cons ?d sgml-doctype))))
1447 (loop for template in sgml-validate-command
1448 thereis
1449 (sgml-subst-expand template validate-subst))))
1450 (t
1451 (apply 'format sgml-validate-command
1452 (if sgml-validate-files
1453 (funcall sgml-validate-files)
1454 (list (or sgml-declaration "")
1455 (let ((name (buffer-file-name)))
1456 (if name
1457 (file-name-nondirectory name)
1458 ""))))))))
1459
1460 (defun sgml-validate (command)
1461 "Validate an SGML document.
1462 Runs COMMAND, a shell command, in a separate process asynchronously
1463 with output going to the buffer *compilation*.
1464 You can then use the command \\[next-error] to find the next error message
1465 and move to the line in the SGML document that caused it."
1466 (interactive
1467 (list (read-from-minibuffer "Validate command: "
1468 (sgml-default-validate-command)
1469 nil nil 'sgml-validate-command-history)))
1470 (if sgml-offer-save
1471 (save-some-buffers nil nil))
1472 (compile-internal command "No more errors" "SGML validation"
1473 nil
1474 sgml-validate-error-regexps))
1475
1476 (defalias 'sgml-restore-buffer-modified-p
1477 (if (fboundp 'restore-buffer-modified-p)
1478 'restore-buffer-modified-p ; doesn't update mode line
1479 'set-buffer-modified-p))
1480
1481 ;;;; Autoloads and hooks
1482
1483 (autoload 'sgml-doctype-insert "psgml-edit"
1484 nil
1485 nil nil)
1486 (autoload 'sgml-indent-line "psgml-edit" nil)
1487 (autoload 'sgml-element-endable-p "psgml-edit" nil)
1488 (autoload 'sgml-do-set-option "psgml-edit" nil)
1489
1490 ;;; Generated by sgml-build-autoloads
1491
1492 (autoload 'sgml-load-dtd "psgml-parse" "Load a saved DTD from FILE." t)
1493 (autoload 'sgml-show-or-clear-log "psgml-parse" "Show the *SGML LOG* buffer if it is not showing, or clear and
1494 remove it if it is showing." t)
1495 (autoload 'sgml-load-doctype "psgml-parse" "Load the documents DTD.
1496 Either from parent document or by parsing the document prolog." t)
1497 (autoload 'sgml-parse-prolog "psgml-parse" "Parse the document prolog to learn the DTD." t)
1498 (autoload 'sgml-beginning-of-element "psgml-edit" "Move to after the start-tag of the current element.
1499 If the start-tag is implied, move to the start of the element." t)
1500 (autoload 'sgml-end-of-element "psgml-edit" "Move to before the end-tag of the current element." t)
1501 (autoload 'sgml-backward-up-element "psgml-edit" "Move backward out of this element level.
1502 That is move to before the start-tag or where a start-tag is implied." t)
1503 (autoload 'sgml-up-element "psgml-edit" "Move forward out of this element level.
1504 That is move to after the end-tag or where an end-tag is implied." t)
1505 (autoload 'sgml-forward-element "psgml-edit" "Move forward over next element." t)
1506 (autoload 'sgml-backward-element "psgml-edit" "Move backward over previous element at this level.
1507 With implied tags this is ambiguous." t)
1508 (autoload 'sgml-down-element "psgml-edit" "Move forward and down one level in the element structure." t)
1509 (autoload 'sgml-kill-element "psgml-edit" "Kill the element following the cursor." t)
1510 (autoload 'sgml-transpose-element "psgml-edit" "Interchange element before point with element after point, leave point after." t)
1511 (autoload 'sgml-mark-element "psgml-edit" "Set mark after next element." t)
1512 (autoload 'sgml-mark-current-element "psgml-edit" "Set mark at end of current element, and leave point before current element." t)
1513 (autoload 'sgml-change-element-name "psgml-edit" "Replace the name of the current element with a new name.
1514 Eventual attributes of the current element will be translated if
1515 possible." t)
1516 (autoload 'sgml-untag-element "psgml-edit" "Remove tags from current element." t)
1517 (autoload 'sgml-kill-markup "psgml-edit" "Kill next tag, markup declaration or process instruction." t)
1518 (autoload 'sgml-fold-region "psgml-edit" "Hide (or if prefixarg unhide) region.
1519 If called from a program first two arguments are start and end of
1520 region. And optional third argument true unhides." t)
1521 (autoload 'sgml-fold-element "psgml-edit" "Fold the lines comprising the current element, leaving the first line visible.
1522 This uses the selective display feature." t)
1523 (autoload 'sgml-fold-subelement "psgml-edit" "Fold all elements current elements content, leaving the first lines visible.
1524 This uses the selective display feature." t)
1525 (autoload 'sgml-unfold-line "psgml-edit" "Show hidden lines in current line." t)
1526 (autoload 'sgml-unfold-element "psgml-edit" "Show all hidden lines in current element." t)
1527 (autoload 'sgml-expand-element "psgml-edit" "As sgml-fold-subelement, but unfold first." t)
1528 (autoload 'sgml-unfold-all "psgml-edit" "Show all hidden lines in buffer." t)
1529 (autoload 'sgml-next-data-field "psgml-edit" "Move forward to next point where data is allowed." t)
1530 (autoload 'sgml-next-trouble-spot "psgml-edit" "Move forward to next point where something is amiss with the structure." t)
1531 (autoload 'sgml-list-valid-tags "psgml-edit" "Display a list of the contextually valid tags." t)
1532 (autoload 'sgml-show-context "psgml-edit" "Display where the cursor is in the element hierarchy." t)
1533 (autoload 'sgml-what-element "psgml-edit" "Display what element is under the cursor." t)
1534 (autoload 'sgml-insert-tag "psgml-edit" "Insert a tag, reading tag name in minibuffer with completion.
1535 If sgml-leave-point-after-insert is t, the point is left after the
1536 inserted tag(s), unless the element has some required content. If
1537 sgml-leave-point-after-insert is nil the point is left after the first
1538 tag inserted." t)
1539 (autoload 'sgml-insert-element "psgml-edit" "Reads element name from minibuffer and inserts start and end tags." t)
1540 (autoload 'sgml-tag-region "psgml-edit" "Reads element name from minibuffer and inserts start and end tags." t)
1541 (autoload 'sgml-insert-end-tag "psgml-edit" "Insert end-tag for the current open element." t)
1542 (autoload 'sgml-insert-attribute "psgml-edit" "Read attribute name and value from minibuffer and insert attribute spec." t)
1543 (autoload 'sgml-split-element "psgml-edit" "Split the current element at point.
1544 If repeated, the containing element will be split before the beginning
1545 of then current element." t)
1546 (autoload 'sgml-custom-dtd "psgml-edit" "Insert a DTD declaration from the sgml-custom-dtd alist." t)
1547 (autoload 'sgml-custom-markup "psgml-edit" "Insert markup from the sgml-custom-markup alist." t)
1548 (autoload 'sgml-tags-menu "psgml-edit" "Pop up a menu with valid tags and insert the chosen tag.
1549 If the variable sgml-balanced-tag-edit is t, also inserts the
1550 corresponding end tag. If sgml-leave-point-after-insert is t, the point
1551 is left after the inserted tag(s), unless the element has some required
1552 content. If sgml-leave-point-after-insert is nil the point is left
1553 after the first tag inserted." t)
1554 (autoload 'sgml-element-menu "psgml-edit" "Pop up a menu with valid elements and insert choice.
1555 If sgml-leave-point-after-insert is nil the point is left after the first
1556 tag inserted." t)
1557 (autoload 'sgml-add-element-menu "psgml-edit" nil t)
1558 (autoload 'sgml-start-tag-menu "psgml-edit" "Pop up a menu with valid start-tags and insert choice." t)
1559 (autoload 'sgml-end-tag-menu "psgml-edit" "Pop up a menu with valid end-tags and insert choice." t)
1560 (autoload 'sgml-tag-region-menu "psgml-edit" "Pop up a menu with valid elements and tag current region with the choice." t)
1561 (autoload 'sgml-entities-menu "psgml-edit" nil t)
1562 (autoload 'sgml-attrib-menu "psgml-edit" "Pop up a menu of the attributes of the current element
1563 \(or the element with start-tag before point)." t)
1564 (autoload 'sgml-right-menu "psgml-edit" "Pop up a menu with valid tags and insert the choosen tag.
1565 If the variable sgml-balanced-tag-edit is t, also inserts the
1566 corresponding end tag. If sgml-leave-point-after-insert is t, the point
1567 is left after the inserted tag(s), unless the element has som required
1568 content. If sgml-leave-point-after-insert is nil the point is left
1569 after the first tag inserted." t)
1570 (autoload 'sgml-fill-element "psgml-edit" "Fill biggest enclosing element with mixed content.
1571 If current element has pure element content, recursively fill the
1572 subelements." t)
1573 (autoload 'sgml-edit-attributes "psgml-edit" "Edit attributes of current element.
1574 Editing is done in a separate window." t)
1575 (autoload 'sgml-edit-attrib-finish "psgml-edit" "Finish editing and insert attribute values in original buffer." t)
1576 (autoload 'sgml-edit-attrib-default "psgml-edit" "Set current attribute value to default." t)
1577 (autoload 'sgml-edit-attrib-clear "psgml-edit" "Kill the value of current attribute." t)
1578 (autoload 'sgml-edit-attrib-field-start "psgml-edit" "Go to the start of the attribute value field." t)
1579 (autoload 'sgml-edit-attrib-field-end "psgml-edit" "Go to the end of the attribute value field." t)
1580 (autoload 'sgml-edit-attrib-next "psgml-edit" "Move to next attribute value." t)
1581 (autoload 'sgml-hide-tags "psgml-edit" "Hide all tags in buffer." t)
1582 (autoload 'sgml-show-tags "psgml-edit" "Show hidden tags in buffer." t)
1583 (autoload 'sgml-hide-attributes "psgml-edit" "Hide all attribute specifications in the buffer." t)
1584 (autoload 'sgml-show-attributes "psgml-edit" "Show all attribute specifications in the buffer." t)
1585 (autoload 'sgml-expand-all-shortrefs "psgml-edit" "Expand all short references in the buffer.
1586 Short references to text entities are expanded to the replacement text
1587 of the entity; other short references are expanded into general entity
1588 references. If argument TO-ENTITY is non-nil, or if called
1589 interactively with a numeric prefix argument, all short references are
1590 replaced by general entity references." t)
1591 (autoload 'sgml-normalize "psgml-edit" "Normalize buffer by filling in omitted tags and expanding empty tags.
1592 Argument TO-ENTITY controls how short references are expanded as with
1593 `sgml-expand-all-shortrefs'. An optional argument ELEMENT can be the
1594 element to normalize instead of the whole buffer, if used no short
1595 references will be expanded." t)
1596 (autoload 'sgml-normalize-element "psgml-edit" nil t)
1597 (autoload 'sgml-make-character-reference "psgml-edit" "Convert character after point into a character reference.
1598 If called with a numeric argument, convert a character reference back
1599 to a normal character. If called from a program, set optional
1600 argument INVERT to non-nil." t)
1601 (autoload 'sgml-expand-entity-reference "psgml-edit" "Insert the text of the entity referenced at point." t)
1602 (autoload 'sgml-trim-and-leave-element "psgml-edit" "Remove blanks at end of current element and move point to after element." t)
1603 (autoload 'sgml-edit-external-entity "psgml-edit" "Open a new window and display the external entity at the point." t)
1604 (autoload 'sgml-complete "psgml-edit" "Complete the word/tag/entity before point.
1605 If it is a tag (starts with < or </) complete with valid tags.
1606 If it is an entity (starts with &) complete with declared entities.
1607 If it is a markup declaration (starts with <!) complete with markup
1608 declaration names.
1609 If it is something else complete with ispell-complete-word." t)
1610 (autoload 'sgml-file-options-menu "psgml-edit" nil t)
1611 (autoload 'sgml-user-options-menu "psgml-edit" nil t)
1612 (autoload 'sgml-add-element-to-element "psgml-edit" "Add an element of type GI to the current element.
1613 The element will be added at the last legal position if FIRST is `nil',
1614 otherwise it will be added at the first legal position." t)
1615 (autoload 'sgml-show-current-element-type "psgml-edit" "Show information about the current element and its type." t)
1616 (autoload 'sgml-show-structure "psgml-edit" "Show the document structure in a separate buffer." t)
1617 (autoload 'sgml-save-dtd "psgml-dtd" "Save the parsed dtd on FILE." t)
1618 (autoload 'sgml-list-elements "psgml-info" "List the elements and their attributes in the current DTD." t)
1619 (autoload 'sgml-list-attributes "psgml-info" "List the attributes and in which elements they occur." t)
1620 (autoload 'sgml-list-terminals "psgml-info" "List the elements that can have data in their content." t)
1621 (autoload 'sgml-list-content-elements "psgml-info" "List all element types and the element types that can occur in its content." t)
1622 (autoload 'sgml-list-occur-in-elements "psgml-info" "List all element types and where it can occur." t)
1623 (autoload 'sgml-describe-entity "psgml-info" "Describe the properties of an entity as declared in the current DTD." t)
1624 (autoload 'sgml-describe-element-type "psgml-info" "Describe the properties of an element type as declared in the current DTD." t)
1625 (autoload 'sgml-describe-dtd "psgml-info" "Display information about the current DTD." t)
1626 (autoload 'sgml-charent-to-display-char "psgml-charent" "Replace character entities with their display character equivalents" t)
1627 (autoload 'sgml-display-char-to-charent "psgml-charent" "Replace displayable characters with their character entity equivalents" t)
1628
1629
1630 ;;;; Last provisions
1631
1632 (provide 'psgml)
1633 (provide 'sgml-mode)
1634
1635
1636 ;;; psgml.el ends here