comparison lisp/psgml/psgml.el @ 120:cca96a509cfe r20-1b12

Import from CVS: tag r20-1b12
author cvs
date Mon, 13 Aug 2007 09:25:29 +0200
parents 360340f9fd5f
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
119:d101af7320b8 120:cca96a509cfe
1 ;;; psgml.el --- SGML-editing mode with parsing support 1 ;;; psgml.el --- SGML-editing mode with parsing support
2 ;; $Id: psgml.el,v 1.6 1997/03/08 23:26:54 steve Exp $ 2 ;; $Id: psgml.el,v 1.7 1997/04/10 05:55:50 steve Exp $
3 3
4 ;; Copyright (C) 1993, 1994, 1995, 1996 Lennart Staflin 4 ;; Copyright (C) 1993, 1994, 1995, 1996 Lennart Staflin
5 ;; Copyright (C) 1992 Free Software Foundation, Inc. 5 ;; Copyright (C) 1992 Free Software Foundation, Inc.
6 6
7 ;; Author: Lennart Staflin <lenst@lysator.liu.se> 7 ;; Author: Lennart Staflin <lenst@lysator.liu.se>
75 (defvar sgml-running-xemacs 75 (defvar sgml-running-xemacs
76 (not (not (string-match "Lucid\\|XEmacs" emacs-version)))) 76 (not (not (string-match "Lucid\\|XEmacs" emacs-version))))
77 77
78 ;;; User settable options: 78 ;;; User settable options:
79 79
80 (defvar sgml-insert-missing-element-comment t 80 (defgroup sgml nil
81 "Standard Generalized Markup Language"
82 :group 'languages)
83
84 (defgroup psgml nil
85 "SGML-editing mode with parsing support"
86 :prefix "sgml-"
87 :group 'sgml)
88
89 (defgroup psgml-insert nil
90 "Inserting features of psgml"
91 :prefix "sgml-"
92 :group 'psgml)
93
94 (defgroup psgml-dtd nil
95 "DTD, CATALOG and DOCTYPE customizations in psgml"
96 :prefix "sgml-"
97 :group 'psgml)
98
99
100 (defcustom sgml-insert-missing-element-comment t
81 "*If true, and sgml-auto-insert-required-elements also true, 101 "*If true, and sgml-auto-insert-required-elements also true,
82 `sgml-insert-element' will insert a comment if there is an element required 102 `sgml-insert-element' will insert a comment if there is an element required
83 but there is more than one to choose from." ) 103 but there is more than one to choose from."
84 104 :type 'boolean
85 (defvar sgml-insert-end-tag-on-new-line nil 105 :group 'psgml-insert)
106
107 (defcustom sgml-insert-end-tag-on-new-line nil
86 "*If true, `sgml-insert-element' will put the end-tag on a new line 108 "*If true, `sgml-insert-element' will put the end-tag on a new line
87 after the start-tag. Useful on slow terminals if you find the end-tag after 109 after the start-tag. Useful on slow terminals if you find the end-tag after
88 the cursor irritating." ) 110 the cursor irritating."
111 :type 'boolean
112 :group 'psgml-insert)
89 113
90 (defvar sgml-doctype nil 114 (defvar sgml-doctype nil
91 "*If set, this should be the name of a file that contains the doctype 115 "*If set, this should be the name of a file that contains the doctype
92 declaration to use. 116 declaration to use.
93 Setting this variable automatically makes it local to the current buffer.") 117 Setting this variable automatically makes it local to the current buffer.")
94 (put 'sgml-doctype 'sgml-type 'string) 118 (put 'sgml-doctype 'sgml-type 'string)
95 (make-variable-buffer-local 'sgml-doctype) 119 (make-variable-buffer-local 'sgml-doctype)
96 120
97 (defvar sgml-system-identifiers-are-preferred nil 121 (defcustom sgml-system-identifiers-are-preferred nil
98 "*If nil, PSGML will look up external entities by searching the catalogs 122 "*If nil, PSGML will look up external entities by searching the catalogs
99 in `sgml-local-catalogs' and `sgml-catalog-files' and only if the 123 in `sgml-local-catalogs' and `sgml-catalog-files' and only if the
100 entity is not found in the catalogs will a given system identifer be 124 entity is not found in the catalogs will a given system identifer be
101 used. If the variable is non-nil and a system identifer is given, the 125 used. If the variable is non-nil and a system identifer is given, the
102 system identifier will be used for the entity. If no system identifier 126 system identifier will be used for the entity. If no system identifier
103 is given the catalogs will searched.") 127 is given the catalogs will searched."
104 128 :type 'boolean
105 (defvar sgml-range-indicator-max-length 9 129 :group 'psgml-dtd)
130
131 (defcustom sgml-range-indicator-max-length 9
106 "*Maximum number of characters used from the first and last entry 132 "*Maximum number of characters used from the first and last entry
107 of a submenu to indicate the range of that menu.") 133 of a submenu to indicate the range of that menu."
108 134 :type 'integer
109 (defvar sgml-default-doctype-name nil 135 :group 'psgml)
110 "*Document type name to use if no document type declaration is present.") 136
137 (defcustom sgml-default-doctype-name nil
138 "*Document type name to use if no document type declaration is present."
139 :type '(choice string (const nil))
140 :group 'psgml-dtd)
141
111 (put 'sgml-default-doctype-name 'sgml-type 'string-or-nil) 142 (put 'sgml-default-doctype-name 'sgml-type 'string-or-nil)
112 143
113 (defvar sgml-markup-faces '((start-tag . bold) 144 (defcustom sgml-markup-faces '((start-tag . bold)
114 (end-tag . bold) 145 (end-tag . bold)
115 (comment . italic) 146 (comment . italic)
116 (pi . bold) 147 (pi . bold)
117 (sgml . bold) 148 (sgml . bold)
118 (doctype . bold) 149 (doctype . bold)
129 ms-start- marked section end, if not ignored 160 ms-start- marked section end, if not ignored
130 pi - processing instruction 161 pi - processing instruction
131 sgml - SGML declaration 162 sgml - SGML declaration
132 start-tag 163 start-tag
133 entity - general entity reference 164 entity - general entity reference
134 shortref- short reference") 165 shortref- short reference"
166 :type '(repeat (cons symbol face))
167 :group 'psgml)
135 168
136 (defvar sgml-buggy-subst-char-in-region 169 (defvar sgml-buggy-subst-char-in-region
137 (or (not (boundp 'emacs-minor-version)) 170 (or (not (boundp 'emacs-minor-version))
138 (not (natnump emacs-minor-version)) 171 (not (natnump emacs-minor-version))
139 (< emacs-minor-version 23)) 172 (< emacs-minor-version 23))
140 "*If non-nil, work around a bug in subst-char-in-region. 173 "*If non-nil, work around a bug in subst-char-in-region.
141 The bug sets the buffer modified. If this is set, folding commands 174 The bug sets the buffer modified. If this is set, folding commands
142 will be slower.") 175 will be slower.")
143 176
144 (defvar sgml-set-face nil 177 (defcustom sgml-set-face nil
145 "*If non-nil, psgml will set the face of parsed markup.") 178 "*If non-nil, psgml will set the face of parsed markup."
179 :type 'boolean
180 :group 'psgml)
146 (put 'sgml-set-face 'sgml-desc "Set face of parsed markup") 181 (put 'sgml-set-face 'sgml-desc "Set face of parsed markup")
147 182
148 (defvar sgml-live-element-indicator nil 183 (defcustom sgml-live-element-indicator nil
149 "*If non-nil, indicate current element in mode line.") 184 "*If non-nil, indicate current element in mode line."
150 185 :type 'boolean
151 (defvar sgml-auto-activate-dtd nil 186 :group 'psgml)
187
188 (defcustom sgml-auto-activate-dtd nil
152 "*If non-nil, loading a sgml-file will automatically try to activate its DTD. 189 "*If non-nil, loading a sgml-file will automatically try to activate its DTD.
153 Activation means either to parse the document type declaration or to 190 Activation means either to parse the document type declaration or to
154 load a previously saved parsed DTD. The name of the activated DTD 191 load a previously saved parsed DTD. The name of the activated DTD
155 will be shown in the mode line.") 192 will be shown in the mode line."
193 :type 'boolean
194 :group 'psgml-dtd)
156 (put 'sgml-auto-activate-dtd 'sgml-desc "Auto Activate DTD") 195 (put 'sgml-auto-activate-dtd 'sgml-desc "Auto Activate DTD")
157 196
158 (defvar sgml-offer-save t 197 (defcustom sgml-offer-save t
159 "*If non-nil, ask about saving modified buffers before \\[sgml-validate] is run.") 198 "*If non-nil, ask about saving modified buffers before \\[sgml-validate] is run."
199 :type 'boolean
200 :group 'psgml)
160 201
161 (defvar sgml-parent-document nil 202 (defvar sgml-parent-document nil
162 "* Used when the current file is part of a bigger document. 203 "* Used when the current file is part of a bigger document.
163 204
164 The variable describes how the current file's content fit into the element 205 The variable describes how the current file's content fit into the element
184 225
185 Setting this variable automatically makes it local to the current buffer.") 226 Setting this variable automatically makes it local to the current buffer.")
186 (make-variable-buffer-local 'sgml-parent-document) 227 (make-variable-buffer-local 'sgml-parent-document)
187 (put 'sgml-parent-document 'sgml-type 'list) 228 (put 'sgml-parent-document 'sgml-type 'list)
188 229
189 (defvar sgml-tag-region-if-active t ;; wing change 230 (defcustom sgml-tag-region-if-active t ;; wing change
190 "*If non-nil, the Tags menu will tag a region if the region is 231 "*If non-nil, the Tags menu will tag a region if the region is
191 considered active by Emacs. If nil, region must be active and 232 considered active by Emacs. If nil, region must be active and
192 transient-mark-mode/zmacs-regions must be on for the region to be tagged.") 233 transient-mark-mode/zmacs-regions must be on for the region to be tagged."
234 :type 'boolean
235 :group 'psgml)
193 236
194 (defvar sgml-normalize-trims t 237 (defvar sgml-normalize-trims t
195 "*If non-nil, sgml-normalize will trim off white space from end of element 238 "*If non-nil, sgml-normalize will trim off white space from end of element
196 when adding end tag.") 239 when adding end tag.")
197 240
227 "*If non-nil, quote all attribute values inserted after finishing edit attributes. 270 "*If non-nil, quote all attribute values inserted after finishing edit attributes.
228 Setting this variable automatically makes it local to the current buffer.") 271 Setting this variable automatically makes it local to the current buffer.")
229 272
230 (make-variable-buffer-local 'sgml-always-quote-attributes) 273 (make-variable-buffer-local 'sgml-always-quote-attributes)
231 274
232 (defvar sgml-auto-insert-required-elements t 275 (defcustom sgml-auto-insert-required-elements t
233 "*If non-nil, automatically insert required elements in the content 276 "*If non-nil, automatically insert required elements in the content
234 of an inserted element.") 277 of an inserted element."
235 278 :type 'boolean
236 (defvar sgml-balanced-tag-edit t 279 :group 'psgml-insert)
237 "*If non-nil, always insert start-end tag pairs.") 280
238 281 (defcustom sgml-balanced-tag-edit t
239 (defvar sgml-omittag-transparent (not sgml-balanced-tag-edit) ;; wing change 282 "*If non-nil, always insert start-end tag pairs."
283 :type 'boolean
284 :group 'psgml-insert)
285
286 (defcustom sgml-omittag-transparent (not sgml-balanced-tag-edit) ;; wing change
240 "*If non-nil, will show legal tags inside elements with omittable start tags 287 "*If non-nil, will show legal tags inside elements with omittable start tags
241 and legal tags beyond omittable end tags.") 288 and legal tags beyond omittable end tags."
242 289 :type 'boolean
243 (defvar sgml-leave-point-after-insert nil 290 :group 'psgml)
291
292 (defcustom sgml-leave-point-after-insert nil
244 "*If non-nil, the point will remain after inserted tag(s). 293 "*If non-nil, the point will remain after inserted tag(s).
245 If nil, the point will be placed before the inserted tag(s).") 294 If nil, the point will be placed before the inserted tag(s)."
246 295 :type 'boolean
247 (defvar sgml-warn-about-undefined-elements t 296 :group 'psgml-insert)
248 "*If non-nil, print a warning when a tag for an undefined element is found.") 297
249 298 (defcustom sgml-warn-about-undefined-elements t
250 (defvar sgml-warn-about-undefined-entities t 299 "*If non-nil, print a warning when a tag for an undefined element is found."
251 "*If non-nil, print a warning when an undefined entity is found.") 300 :type 'boolean
252 301 :group 'psgml)
253 (defvar sgml-ignore-undefined-elements nil 302
303 (defcustom sgml-warn-about-undefined-entities t
304 "*If non-nil, print a warning when an undefined entity is found."
305 :type 'boolean
306 :group 'psgml)
307
308 (defcustom sgml-ignore-undefined-elements nil
254 "*If non-nil, recover from an undefined element by ignoring the tag. 309 "*If non-nil, recover from an undefined element by ignoring the tag.
255 If nil, recover from an undefined element by assuming it can occur any 310 If nil, recover from an undefined element by assuming it can occur any
256 where and has content model ANY.") 311 where and has content model ANY."
257 312 :type 'boolean
258 (defvar sgml-recompile-out-of-date-cdtd 'ask 313 :group 'psgml)
314
315 (defcustom sgml-recompile-out-of-date-cdtd 'ask
259 "*If non-nil, out of date compiled DTDs will be automatically recompiled. 316 "*If non-nil, out of date compiled DTDs will be automatically recompiled.
260 If the value is `ask', PSGML will ask before recompiling. A `nil' 317 If the value is `ask', PSGML will ask before recompiling. A `nil'
261 value will cause PSGML to silently load an out of date compiled DTD. 318 value will cause PSGML to silently load an out of date compiled DTD.
262 A DTD that referes to undefined external entities is always out of 319 A DTD that referes to undefined external entities is always out of
263 date, thus in such case it can be useful to set this variable to 320 date, thus in such case it can be useful to set this variable to
264 `nil'.") 321 `nil'."
322 :type 'symbol
323 :group 'psgml-dtd)
265 (put 'sgml-recompile-out-of-date-cdtd 'sgml-type '(("No" . nil) 324 (put 'sgml-recompile-out-of-date-cdtd 'sgml-type '(("No" . nil)
266 ("Yes" . t) 325 ("Yes" . t)
267 ("Ask" . ask))) 326 ("Ask" . ask)))
268 327
269 (defvar sgml-trace-entity-lookup nil 328 (defcustom sgml-trace-entity-lookup nil
270 "*If non-nil, log messages about catalog files used to look for 329 "*If non-nil, log messages about catalog files used to look for
271 external entities.") 330 external entities."
331 :type 'boolean
332 :group 'psgml-dtd)
272 333
273 (defvar sgml-indent-step 2 334 (defvar sgml-indent-step 2
274 "*How much to increment indent for every element level. 335 "*How much to increment indent for every element level.
275 If nil, no indentation. 336 If nil, no indentation.
276 Setting this variable automatically makes it local to the current buffer.") 337 Setting this variable automatically makes it local to the current buffer.")
281 "*If non-nil, indent in data/mixed context also. 342 "*If non-nil, indent in data/mixed context also.
282 Setting this variable automatically makes it local to the current buffer.") 343 Setting this variable automatically makes it local to the current buffer.")
283 (make-variable-buffer-local 'sgml-indent-data) 344 (make-variable-buffer-local 'sgml-indent-data)
284 345
285 ;;; Wing addition 346 ;;; Wing addition
286 (defvar sgml-inhibit-indent-tags nil 347 (defcustom sgml-inhibit-indent-tags nil
287 "*List of tags within which indentation is inhibited. 348 "*List of tags within which indentation is inhibited.
288 The tags should be given as strings.") 349 The tags should be given as strings."
289 350 :type 'boolean
290 (defvar sgml-data-directory (expand-file-name "sgml" data-directory) 351 :group 'psgml)
352
353 (defcustom sgml-data-directory (expand-file-name "sgml" data-directory)
291 "*Directory for pre-supplied data files (DTD's and such). 354 "*Directory for pre-supplied data files (DTD's and such).
292 Set this before loading psgml.") 355 Set this before loading psgml."
293 356 :type 'directory
294 (defvar sgml-system-path nil 357 :group 'psgml)
358
359 (defcustom sgml-system-path nil
295 ;; wing addition 360 ;; wing addition
296 "*List of directories used to look for system identifiers. 361 "*List of directories used to look for system identifiers.
297 The directory listed in `sgml-data-directory' is always searched in 362 The directory listed in `sgml-data-directory' is always searched in
298 addition to the directories listed here.") 363 addition to the directories listed here."
364 :type '(repeat directory)
365 :group 'psgml)
299 (put 'sgml-system-path 'sgml-type 'list) 366 (put 'sgml-system-path 'sgml-type 'list)
300 367
301 (defun sgml-parse-colon-path (cd-path) 368 (defun sgml-parse-colon-path (cd-path)
302 "Explode a colon-separated list of paths into a string list." 369 "Explode a colon-separated list of paths into a string list."
303 (let (cd-list (cd-start 0) cd-colon) 370 (let (cd-list (cd-start 0) cd-colon)
310 (substitute-in-file-name 377 (substitute-in-file-name
311 (substring cd-path cd-start cd-colon)))))) 378 (substring cd-path cd-start cd-colon))))))
312 (setq cd-start (+ cd-colon 1))) 379 (setq cd-start (+ cd-colon 1)))
313 cd-list)) 380 cd-list))
314 381
315 (defvar sgml-public-map (sgml-parse-colon-path 382 (defcustom sgml-public-map (sgml-parse-colon-path
316 (or (getenv "SGML_PATH") 383 (or (getenv "SGML_PATH")
317 ;; Wing change 384 ;; Wing change
318 (concat "%S:" (directory-file-name 385 (concat "%S:" (directory-file-name
319 sgml-data-directory) 386 sgml-data-directory)
320 "%o/%c/%d"))) 387 "%o/%c/%d")))
321 388
322 "*Mapping from public identifiers to file names. 389 "*Mapping from public identifiers to file names.
323 This is a list of possible file names. To find the file for a public 390 This is a list of possible file names. To find the file for a public
324 identifier the elements of the list are used one at the time from the 391 identifier the elements of the list are used one at the time from the
325 beginning. If the element is a string a file name is constructed from 392 beginning. If the element is a string a file name is constructed from
329 and description will be transliterated according to the variable 396 and description will be transliterated according to the variable
330 sgml-public-transliterations. If the file exists it will be the file 397 sgml-public-transliterations. If the file exists it will be the file
331 used for the public identifier. An element can also be a dotted pair 398 used for the public identifier. An element can also be a dotted pair
332 (regexp . filename), the filename is a string treated as above, but 399 (regexp . filename), the filename is a string treated as above, but
333 only if the regular expression, regexp, matches the public 400 only if the regular expression, regexp, matches the public
334 identifier.") 401 identifier."
402 :type '(repeat file)
403 :group 'psgml-dtd)
335 (put 'sgml-public-map 'sgml-type 'list) 404 (put 'sgml-public-map 'sgml-type 'list)
336 405
337 (defvar sgml-local-catalogs nil 406 (defcustom sgml-local-catalogs nil
338 "*A list of SGML entity catalogs to be searched first when parsing the buffer. 407 "*A list of SGML entity catalogs to be searched first when parsing the buffer.
339 This is used in addtion to `sgml-catalog-files', and `sgml-public-map'. 408 This is used in addtion to `sgml-catalog-files', and `sgml-public-map'.
340 This variable is automatically local to the buffer.") 409 This variable is automatically local to the buffer."
410 :type '(repeat file)
411 :group 'psgml-dtd)
341 (make-variable-buffer-local 'sgml-local-catalogs) 412 (make-variable-buffer-local 'sgml-local-catalogs)
342 (put 'sgml-local-catalogs 'sgml-type 'list) 413 (put 'sgml-local-catalogs 'sgml-type 'list)
343 414
344 (defvar sgml-catalog-files (sgml-parse-colon-path 415 (defcustom sgml-catalog-files (sgml-parse-colon-path
345 (or (getenv "SGML_CATALOG_FILES") 416 (or (getenv "SGML_CATALOG_FILES")
346 ;; Wing addition 417 ;; Wing addition
347 (concat "CATALOG:" 418 (concat "CATALOG:"
348 (expand-file-name 419 (expand-file-name
349 "CATALOG" 420 "CATALOG"
350 sgml-data-directory)))) 421 sgml-data-directory))))
351 "*List of catalog entry files. 422 "*List of catalog entry files.
352 The files are in the format defined in the SGML Open Draft Technical 423 The files are in the format defined in the SGML Open Draft Technical
353 Resolution on Entity Management.") 424 Resolution on Entity Management."
425 :type '(repeat file)
426 :group 'psgml-dtd)
354 (put 'sgml-catalog-files 'sgml-type 'list) 427 (put 'sgml-catalog-files 'sgml-type 'list)
355 428
356 ;;; Wing addition 429 ;;; Wing addition
357 (defvar sgml-ecat-files (list 430 (defcustom sgml-ecat-files (list
358 "ECAT" 431 "ECAT"
359 "~/sgml/ECAT" 432 "~/sgml/ECAT"
360 (expand-file-name "ECAT" sgml-data-directory)) 433 (expand-file-name "ECAT" sgml-data-directory))
361 "*List of catalog files for PSGML.") 434 "*List of catalog files for PSGML."
435 :type '(repeat file)
436 :group 'psgml-dtd)
362 (put 'sgml-ecat-files 'sgml-type 'list) 437 (put 'sgml-ecat-files 'sgml-type 'list)
363 438
364 (defvar sgml-local-ecat-files nil 439 (defcustom sgml-local-ecat-files nil
365 "*List of local catalog files for PSGML. 440 "*List of local catalog files for PSGML.
366 Automatically becomes buffer local if set.") 441 Automatically becomes buffer local if set."
367 442 :type '(repeat file)
443 :group 'psgml-dtd)
368 (make-variable-buffer-local 'sgml-local-ecat-files) 444 (make-variable-buffer-local 'sgml-local-ecat-files)
369 (put 'sgml-local-ecat-files 'sgml-type 'list) 445 (put 'sgml-local-ecat-files 'sgml-type 'list)
370 446
371 (defvar sgml-public-transliterations '((? . ?_) (?/ . ?%)) 447 (defvar sgml-public-transliterations '((? . ?_) (?/ . ?%))
372 "*Transliteration for characters that should be avoided in file names. 448 "*Transliteration for characters that should be avoided in file names.
406 482
407 ((\"Version1\" \"<![%Version1[\\r]]>\") 483 ((\"Version1\" \"<![%Version1[\\r]]>\")
408 (\"New page\" \"<?NewPage>\")) 484 (\"New page\" \"<?NewPage>\"))
409 ") 485 ")
410 486
411 (defvar sgml-custom-dtd nil 487 (defcustom sgml-custom-dtd nil
412 "Menu entries to be added to the DTD menu. 488 "Menu entries to be added to the DTD menu.
413 The value should be a list of entries to be added to the DTD menu. 489 The value should be a list of entries to be added to the DTD menu.
414 Every entry should be a list. The first element of the entry is a string 490 Every entry should be a list. The first element of the entry is a string
415 used as the menu entry. The second element is a string containing a 491 used as the menu entry. The second element is a string containing a
416 doctype declaration (this can be nil if no doctype). The rest of the 492 doctype declaration (this can be nil if no doctype). The rest of the
427 \"~/sgml/htmlplus.ced\" 503 \"~/sgml/htmlplus.ced\"
428 sgml-omittag t sgml-shorttag nil) 504 sgml-omittag t sgml-shorttag nil)
429 (\"DOCBOOK\" \"<!doctype docbook system 'docbook.dtd'>\" 505 (\"DOCBOOK\" \"<!doctype docbook system 'docbook.dtd'>\"
430 \"~/sgml/docbook.ced\" 506 \"~/sgml/docbook.ced\"
431 sgml-omittag nil sgml-shorttag t))) 507 sgml-omittag nil sgml-shorttag t)))
432 ") 508 "
509 :type '(repeat (list (string :tag "Menu Entry")
510 (choice (const :tag "No doctype")
511 (string :tag "Declaration"))
512 (repeat :inline t
513 (list :inline t
514 (symbol :tag "Variable")
515 (sexp :tag "Value")))))
516 :group 'psgml-dtd)
517
433 518
434 519
435 ;;; Faces used in edit attribute buffer: 520 ;;; Faces used in edit attribute buffer:
436 (put 'sgml-default 'face 'underline) ; Face for #DEFAULT 521 (put 'sgml-default 'face 'underline) ; Face for #DEFAULT
437 (put 'sgml-fixed 'face 'underline) ; Face of #FIXED "..." 522 (put 'sgml-fixed 'face 'underline) ; Face of #FIXED "..."
440 ;;; sgmls is a free SGML parser available from 525 ;;; sgmls is a free SGML parser available from
441 ;;; ftp.uu.net:pub/text-processing/sgml 526 ;;; ftp.uu.net:pub/text-processing/sgml
442 ;;; Its error messages can be parsed by next-error. 527 ;;; Its error messages can be parsed by next-error.
443 ;;; The -s option suppresses output. 528 ;;; The -s option suppresses output.
444 529
445 (defvar sgml-validate-command (concat "nsgmls -s -m " 530 (defcustom sgml-validate-command (concat "nsgmls -s -m "
446 sgml-data-directory 531 sgml-data-directory
447 "/CATALOG %s %s") 532 "/CATALOG %s %s")
448 "*The shell command to validate an SGML document. 533 "*The shell command to validate an SGML document.
449 534
450 This is a `format' control string that by default should contain two 535 This is a `format' control string that by default should contain two
451 `%s' conversion specifications: the first will be replaced by the 536 `%s' conversion specifications: the first will be replaced by the
452 value of `sgml-declaration' \(or the empty string, if nil\); the 537 value of `sgml-declaration' \(or the empty string, if nil\); the
462 %-sequences with no replacement value the next string will be tried. 547 %-sequences with no replacement value the next string will be tried.
463 548
464 %b means the visited file of the current buffer 549 %b means the visited file of the current buffer
465 %s means the SGML declaration specified in the sgml-declaration variable 550 %s means the SGML declaration specified in the sgml-declaration variable
466 %d means the file containing the DOCTYPE declaration, if not in the buffer 551 %d means the file containing the DOCTYPE declaration, if not in the buffer
467 ") 552 "
553 :type 'string
554 :group 'psgml)
468 555
469 (defvar sgml-validate-files nil 556 (defvar sgml-validate-files nil
470 "If non-nil, a function of no arguments that returns a list of file names. 557 "If non-nil, a function of no arguments that returns a list of file names.
471 These file names will serve as the arguments to the `sgml-validate-command' 558 These file names will serve as the arguments to the `sgml-validate-command'
472 format control string instead of the defaults.") 559 format control string instead of the defaults.")
477 ("\n[a-zA-Z]?:?[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\ 564 ("\n[a-zA-Z]?:?[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\
478 \\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4)) 565 \\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4))
479 "Alist of regexps to recognize error messages from `sgml-validate'. 566 "Alist of regexps to recognize error messages from `sgml-validate'.
480 See `compilation-error-regexp-alist'.") 567 See `compilation-error-regexp-alist'.")
481 568
482 (defvar sgml-declaration nil 569 (defcustom sgml-declaration nil
483 "*If non-nil, this is the name of the SGML declaration file.") 570 "*If non-nil, this is the name of the SGML declaration file."
571 :type 'hook
572 :group 'psgml-dtd)
484 (put 'sgml-declaration 'sgml-type 'string) 573 (put 'sgml-declaration 'sgml-type 'string)
485 574
486 (defvar sgml-mode-hook nil 575 (defcustom sgml-mode-hook nil
487 "A hook or list of hooks to be run when entering sgml-mode") 576 "A hook or list of hooks to be run when entering sgml-mode"
577 :type 'hook
578 :group 'psgml)
488 579
489 (defconst sgml-file-options 580 (defconst sgml-file-options
490 '( 581 '(
491 sgml-omittag 582 sgml-omittag
492 sgml-shorttag 583 sgml-shorttag