annotate lisp/psgml/psgml.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; psgml.el --- SGML-editing mode with parsing support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; $Id: psgml.el,v 1.1.1.1 1996/12/18 03:35:23 steve Exp $
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1993, 1994, 1995 Lennart Staflin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1992 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Author: Lennart Staflin <lenst@lysator.liu.se>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; James Clark <jjc@clark.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; This program is free software; you can redistribute it and/or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; modify it under the terms of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; as published by the Free Software Foundation; either version 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; of the License, or (at your option) any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; Major mode for editing the SGML document-markup language.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; Send bugs to lenst@lysator.liu.se
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; WHAT IT CAN DO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; - Identify structural errors (but it is not a validator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; - Menus for inserting tags with only the contextually valid tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; - Edit attribute values in separate window with information about types
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; and defaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; - Hide attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; - Fold elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; - Indent according to element nesting depth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; - Show context
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; - Structure editing: move and kill by element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; - Find next data context
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; LIMITATIONS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; - only accepts the referece concrete syntax, though it does allow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; unlimited lengths on names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defconst psgml-version "1.0a9"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "Version of psgml package.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (defconst psgml-maintainer-address "lenst@lysator.liu.se")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (require 'cl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defvar sgml-debug nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defmacro sgml-debug (&rest x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (list 'if 'sgml-debug (cons 'sgml-log-message x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;;;; Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defvar sgml-mode-abbrev-table nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "Abbrev table in use in sgml-mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (define-abbrev-table 'sgml-mode-abbrev-table ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defvar sgml-mode-syntax-table nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Syntax table used in sgml mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (if sgml-mode-syntax-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq sgml-mode-syntax-table (make-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (modify-syntax-entry ?< "(>" sgml-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (modify-syntax-entry ?> ")<" sgml-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (modify-syntax-entry ?\" ". " sgml-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (modify-syntax-entry ?\\ ". " sgml-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (modify-syntax-entry ?' "w " sgml-mode-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defvar sgml-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (not (not (string-match "Lucid\\|XEmacs" emacs-version))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;;; User settable options:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (defvar sgml-insert-missing-element-comment t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 "*If true, and sgml-auto-insert-required-elements also true,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 `sgml-insert-element' will insert a comment if there is an element required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 but there is more than one to choose from." )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defvar sgml-insert-end-tag-on-new-line nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 "*If true, `sgml-insert-element' will put the end-tag on a new line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 after the start-tag. Useful on slow terminals if you find the end-tag after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 the cursor irritating." )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (defvar sgml-doctype nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 "*If set, this should be the name of a file that contains the doctype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 declaration to use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (put 'sgml-doctype 'sgml-type 'string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (make-variable-buffer-local 'sgml-doctype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (defvar sgml-system-identifiers-are-preferred nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 "*If nil, PSGML will look up external entities by searching the catalogs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 in `sgml-local-catalogs' and `sgml-catalog-files' and only if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 entity is not found in the catalogs will a given system identifer be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 used. If the variable is non-nil and a system identifer is given, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 system identifier will be used for the entity. If no system identifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 is given the catalogs will searched.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defvar sgml-range-indicator-max-length 9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 "*Maximum number of characters used from the first and last entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 of a submenu to indicate the range of that menu.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defvar sgml-default-doctype-name nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "*Document type name to use if no document type declaration is present.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (put 'sgml-default-doctype-name 'sgml-type 'string-or-nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (defvar sgml-markup-faces '((start-tag . bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (end-tag . bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (comment . italic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (pi . bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (sgml . bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (doctype . bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (entity . bold-italic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (shortref . bold))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 "*List of markup to face mappings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 Element are of the form (MARKUP-TYPE . FACE).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 Possible values for MARKUP-TYPE is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 comment - comment declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 doctype - doctype declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 end-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ignored - ignored marked section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ms-end - marked section start, if not ignored
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ms-start- marked section end, if not ignored
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 pi - processing instruction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 sgml - SGML declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 start-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 entity - general entity reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 shortref- short reference")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (defvar sgml-buggy-subst-char-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (or (not (boundp 'emacs-minor-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (not (natnump emacs-minor-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (< emacs-minor-version 23))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 "*If non-nil, work around a bug in subst-char-in-region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 The bug sets the buffer modified. If this is set, folding commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 will be slower.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defvar sgml-set-face nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "*If non-nil, psgml will set the face of parsed markup.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (put 'sgml-set-face 'sgml-desc "Set face of parsed markup")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (defvar sgml-live-element-indicator nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 "*If non-nil, indicate current element in mode line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defvar sgml-auto-activate-dtd nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "*If non-nil, loading a sgml-file will automatically try to activate its DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 Activation means either to parse the document type declaration or to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 load a previously saved parsed DTD. The name of the activated DTD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 will be shown in the mode line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (put 'sgml-auto-activate-dtd 'sgml-desc "Auto Activate DTD")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (defvar sgml-offer-save t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "*If non-nil, ask about saving modified buffers before \\[sgml-validate] is run.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (defvar sgml-parent-document nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 "* Used when the current file is part of a bigger document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 The variable describes how the current file's content fit into the element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 hierarchy. The variable should have the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (PARENT-FILE CONTEXT-ELEMENT* TOP-ELEMENT (HAS-SEEN-ELEMENT*)?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 PARENT-FILE is a string, the name of the file contatining the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 document entity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 CONTEXT-ELEMENT is a string, that is the name of an element type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 It can occur 0 or more times and is used to set up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 exceptions and short reference map. Good candidates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 for these elements are the elements open when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 entity pointing to the current file is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 TOP-ELEMENT is a string that is the name of the element type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 of the top level element in the current file. The file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 should contain one instance of this element, unless
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 the last \(lisp) element of sgml-parent-document is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 list. If it is a list, the top level of the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 should follow the content model of top-element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 HAS-SEEN-ELEMENT is a string that is the name of an element type. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 element is satisfied in the content model of top-element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (make-variable-buffer-local 'sgml-parent-document)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (put 'sgml-parent-document 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defvar sgml-tag-region-if-active t ;; wing change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "*If non-nil, the Tags menu will tag a region if the region is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 considered active by Emacs. If nil, region must be active and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 transient-mark-mode/zmacs-regions must be on for the region to be tagged.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (defvar sgml-normalize-trims t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 "*If non-nil, sgml-normalize will trim off white space from end of element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 when adding end tag.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (defvar sgml-omittag t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 "*Set to non-nil, if you use OMITTAG YES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (make-variable-buffer-local 'sgml-omittag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (put 'sgml-omittag 'sgml-desc "OMITTAG")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (defvar sgml-shorttag t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 "*Set to non-nil, if you use SHORTTAG YES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (make-variable-buffer-local 'sgml-shorttag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (put 'sgml-shorttag 'sgml-desc "SHORTTAG")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (defvar sgml-minimize-attributes nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 "*Determines minimization of attributes inserted by edit-attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 Actually two things are done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 1. If non-nil, omit attribute name, if attribute value is from a token group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 2. If 'max, omit attributes with default value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (make-variable-buffer-local 'sgml-minimize-attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (put 'sgml-minimize-attributes 'sgml-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 '(("No" . nil) ("Yes" . t) ("Max" . max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (defvar sgml-always-quote-attributes t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "*If non-nil, quote all attribute values inserted after finishing edit attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (make-variable-buffer-local 'sgml-always-quote-attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (defvar sgml-auto-insert-required-elements t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 "*If non-nil, automatically insert required elements in the content
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 of an inserted element.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (defvar sgml-balanced-tag-edit t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "*If non-nil, always insert start-end tag pairs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (defvar sgml-omittag-transparent (not sgml-balanced-tag-edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 "*If non-nil, will show legal tags inside elements with omittable start tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 and legal tags beyond omittable end tags.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (defvar sgml-leave-point-after-insert nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 "*If non-nil, the point will remain after inserted tag(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 If nil, the point will be placed before the inserted tag(s).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (defvar sgml-warn-about-undefined-elements t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "*If non-nil, print a warning when a tag for an undefined element is found.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (defvar sgml-warn-about-undefined-entities t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 "*If non-nil, print a warning when an undefined entity is found.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (defvar sgml-ignore-undefined-elements nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 "*If non-nil, recover from an undefined element by ignoring the tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 If nil, recover from an undefined element by assuming it can occur any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 where and has content model ANY.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (defvar sgml-recompile-out-of-date-cdtd 'ask
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 "*If non-nil, out of date compiled DTDs will be automatically recompiled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 If the value is `ask', PSGML will ask before recompiling. A `nil'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 value will cause PSGML to silently load an out of date compiled DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 A DTD that referes to undefined external entities is always out of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 date, thus in such case it can be useful to set this variable to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 `nil'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (put 'sgml-recompile-out-of-date-cdtd 'sgml-type '(("No" . nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ("Yes" . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ("Ask" . ask)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (defvar sgml-indent-step 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 "*How much to increment indent for every element level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 If nil, no indentation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (make-variable-buffer-local 'sgml-indent-step)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (put 'sgml-indent-step 'sgml-type '(("None" . nil) 0 1 2 3 4 5 6 7 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (defvar sgml-indent-data nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 "*If non-nil, indent in data/mixed context also.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 Setting this variable automatically makes it local to the current buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (make-variable-buffer-local 'sgml-indent-data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (defvar sgml-inhibit-indent-tags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 "*List of tags within which indentation is inhibited.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 The tags should be given as strings.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (defvar sgml-data-directory (expand-file-name "sgml" data-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 "*Directory for pre-supplied data files (DTD's and such).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 Set this before loading psgml.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (defvar sgml-system-path nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 "*List of directories used to look for system identifiers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 The directory listed in `sgml-data-directory' is always searched in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 addition to the directories listed here.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (put 'sgml-system-path 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (defun sgml-parse-colon-path (cd-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 "Explode a colon-separated list of paths into a string list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (let (cd-prefix cd-list (cd-start 0) cd-colon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (setq cd-path (concat cd-path ":"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (while (setq cd-colon (string-match ":" cd-path cd-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (setq cd-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (nconc cd-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (list (if (= cd-start cd-colon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (substitute-in-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (substring cd-path cd-start cd-colon))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (setq cd-start (+ cd-colon 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 cd-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (defvar sgml-public-map (sgml-parse-colon-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (or (getenv "SGML_PATH")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (concat "%S:" (directory-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 sgml-data-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 "%o/%c/%d")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 "*Mapping from public identifiers to file names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 This is a list of possible file names. To find the file for a public
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 identifier the elements of the list are used one at the time from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 beginning. If the element is a string a file name is constructed from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 the string by substitution of the whole public identifier for %P,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 owner for %O, public text class for %C, and public text description
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 for %D. The text class will be converted to lower case and the owner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 and description will be transliterated according to the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 sgml-public-transliterations. If the file exists it will be the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 used for the public identifier. An element can also be a dotted pair
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (regexp . filename), the filename is a string treated as above, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 only if the regular expression, regexp, matches the public
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 identifier.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (put 'sgml-public-map 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (defvar sgml-local-catalogs nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 "*A list of SGML entity catalogs to be searched first when parsing the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 This is used in addtion to `sgml-catalog-files', and `sgml-public-map'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 This variable is automatically local to the buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (make-variable-buffer-local 'sgml-local-catalogs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (put 'sgml-local-catalogs 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (defvar sgml-catalog-files (sgml-parse-colon-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (or (getenv "SGML_CATALOG_FILES")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (concat "CATALOG:"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 "CATALOG"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 sgml-data-directory))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 "*List of catalog entry files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 The files are in the format defined in the SGML Open Draft Technical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 Resolution on Entity Management.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (put 'sgml-catalog-files 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (defvar sgml-ecat-files (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 "ECAT"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 "~/sgml/ECAT"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (expand-file-name "ECAT" sgml-data-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 "*List of catalog files for PSGML.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (put 'sgml-ecat-files 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (defvar sgml-local-ecat-files nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 "*List of local catalog files for PSGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 Automatically becomes buffer local if set.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (make-variable-buffer-local 'sgml-local-ecat-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (put 'sgml-local-ecat-files 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (defvar sgml-public-transliterations '((? . ?_) (?/ . ?%))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 "*Transliteration for characters that should be avoided in file names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 This is a list of dotted pairs (FROM . TO); where FROM is the the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 character to be translated to TO. This is used when parts of a public
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 identifier are used to construct a file name.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (defvar sgml-default-dtd-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 "*This is the default file name for saved DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 This is set by sgml-mode from the buffer file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 Can be changed in the Local variables section of the file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (put 'sgml-default-dtd-file 'sgml-type 'string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (put 'sgml-default-dtd-file 'sgml-desc "Default (saved) DTD File")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (defvar sgml-exposed-tags '()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 "*The list of tag names that remain visible, despite \\[sgml-hide-tags].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 Each name is a lowercase string, and start-tags and end-tags must be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 listed individually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 `sgml-exposed-tags' is local to each buffer in which it has been set;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 use `setq-default' to set it to a value that is shared among buffers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (make-variable-buffer-local 'sgml-exposed-tags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (put 'sgml-exposed-tags 'sgml-type 'list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (defvar sgml-custom-markup nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 "*Menu entries to be added to the Markup menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 The value should be a list of lists of two strings. The first is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 string is the menu line and the second string is the text inserted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 when the menu item is chosen. The second string can contain a \\r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 where the cursor should be left. Also if a selection is made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 according the same rules as for the Tags menu, the selection is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 replaced with the second string and \\r is replaced with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 Example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ((\"Version1\" \"<![%Version1[\\r]]>\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (\"New page\" \"<?NewPage>\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (defvar sgml-custom-dtd nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 "Menu entries to be added to the DTD menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 The value should be a list of entrys to be added to the DTD menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 Every entry should be a list. The first element of the entry is a string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 used as the menu entry. The second element is a string containing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 doctype declaration (this can be nil if no doctype). The rest of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 list should be a list of variables and values. For backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 compatibility a singel string instead of a variable is assigned to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 sgml-default-dtd-file. All variables are made buffer local and are also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 added to the buffers local variables list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 Example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ((\"HTML\" nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 sgml-default-dtd-file \"~/sgml/html.ced\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 sgml-omittag nil sgml-shorttag nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (\"HTML+\" \"<!doctype htmlplus system 'htmlplus.dtd'>\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 \"~/sgml/htmlplus.ced\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 sgml-omittag t sgml-shorttag nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (\"DOCBOOK\" \"<!doctype docbook system 'docbook.dtd'>\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 \"~/sgml/docbook.ced\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 sgml-omittag nil sgml-shorttag t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 ;;; Faces used in edit attribute buffer:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (put 'sgml-default 'face 'underline) ; Face for #DEFAULT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (put 'sgml-fixed 'face 'underline) ; Face of #FIXED "..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ;;; sgmls is a free SGML parser available from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ;;; ftp.uu.net:pub/text-processing/sgml
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ;;; Its error messages can be parsed by next-error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 ;;; The -s option suppresses output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (defvar sgml-validate-command "sgmls -s %s %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 "*The shell command to validate an SGML document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 This is a `format' control string that by default should contain two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 `%s' conversion specifications: the first will be replaced by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 value of `sgml-declaration' \(or the empty string, if nil\); the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 second will be replaced by the current buffer's file name \(or the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 empty string, if nil\).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 If `sgml-validate-files' is non-nil, the format string should contain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 one `%s' conversion specification for each element of its result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 If sgml-validate-command is a list, then every element should be a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 string. The strings will be tried in order and %-sequences in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 string will be replaced according to the list below, if the string contains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 %-sequences with no replacement value the next string will be tried.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 %b means the visited file of the current buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 %s means the SGML declaration specified in the sgml-declaration variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 %d means the file containing the DOCTYPE declaration, if not in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (defvar sgml-validate-files nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 "If non-nil, a function of no arguments that returns a list of file names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 These file names will serve as the arguments to the `sgml-validate-command'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 format control string instead of the defaults.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (defvar sgml-validate-error-regexps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 '(("\\(error\\|warning\\) at \\([^,]+\\), line \\([0-9]+\\)" 2 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ("^\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):E: " 1 2 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 "Alist of regexps to recognize error messages from `sgml-validate'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 See `compilation-error-regexp-alist'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (defvar sgml-declaration nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 "*If non-nil, this is the name of the SGML declaration file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (put 'sgml-declaration 'sgml-type 'string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (defvar sgml-mode-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 "A hook or list of hooks to be run when entering sgml-mode")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (defconst sgml-file-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 sgml-omittag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 sgml-shorttag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 sgml-minimize-attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 sgml-always-quote-attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 sgml-indent-step
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 sgml-indent-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 sgml-doctype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 sgml-parent-document
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 sgml-default-dtd-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 sgml-exposed-tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 sgml-local-catalogs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 sgml-local-ecat-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 "Options for the current file, can be saved or set from menu."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (defconst sgml-user-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 sgml-set-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 sgml-live-element-indicator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 sgml-auto-activate-dtd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 sgml-offer-save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 sgml-tag-region-if-active
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 sgml-normalize-trims
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 sgml-auto-insert-required-elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 sgml-balanced-tag-edit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 sgml-omittag-transparent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 sgml-leave-point-after-insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 sgml-warn-about-undefined-elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 sgml-warn-about-undefined-entities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 sgml-ignore-undefined-elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 sgml-recompile-out-of-date-cdtd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 sgml-default-doctype-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 sgml-declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 sgml-validate-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 sgml-markup-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 sgml-system-identifiers-are-preferred
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 sgml-system-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 sgml-public-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 sgml-catalog-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 sgml-ecat-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 "User options that can be saved or set from menu."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;;; Internal variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (defvar sgml-validate-command-history nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 "The minibuffer history list for `sgml-validate''s COMMAND argument.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (defvar sgml-mode-map nil "Keymap for SGML mode")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (defvar sgml-active-dtd-indicator nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 "Displayed in the mode line")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;;;; User options handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (defun sgml-variable-description (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (or (get var 'sgml-desc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (let ((desc (symbol-name var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (if (string= "sgml-" (substring desc 0 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (setq desc (substring desc 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (loop for c across-ref desc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 do (if (eq c ?-) (setf c ? )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (capitalize desc))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (defun sgml-variable-type (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (or (get var 'sgml-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (if (memq (symbol-value var) '(t nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 'toggle)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (defun sgml-set-local-variable (var val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 "Set the value of variable VAR to VAL in buffer and local variables list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (set (make-local-variable var) val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (let ((prefix "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (suffix "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (goto-char (max (point-min) (- (point-max) 3000)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (cond ((search-forward "Local Variables:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (setq suffix (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (save-excursion (end-of-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (setq prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (buffer-substring (save-excursion (beginning-of-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (unless (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 "<!-- Keep this comment at the end of the file\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 "Local variables:\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 "mode: sgml\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 "End:\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "-->\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (forward-line -3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (let* ((endpos (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (search-forward (format "\n%send:" prefix))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (varpos (search-forward (format "\n%s%s:" prefix var) endpos t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (cond (varpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (save-excursion (end-of-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (insert (format "%S" val) suffix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (goto-char endpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (beginning-of-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (insert prefix (format "%s:%S" var val) suffix ?\n)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (defun sgml-valid-option (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (let ((type (sgml-variable-type var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (val (symbol-value var)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (cond ((eq 'string type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (stringp val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ((eq 'list-or-string type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (or (stringp val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (consp val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (defun sgml-save-options ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 "Save user options for sgml-mode that have buffer local values."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (let ((l sgml-file-options))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (loop for var in sgml-file-options do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (when (sgml-valid-option var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (sgml-set-local-variable var (symbol-value var))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;;;; Run hook with args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (unless (fboundp 'run-hook-with-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (defun run-hook-with-args (hook &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 "Run HOOK with the specified arguments ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 HOOK should be a symbol, a hook variable. If HOOK has a non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 value, that value may be a function or a list of functions to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 called to run the hook. If the value is a function, it is called with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 the given arguments and its return value is returned. If it is a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 of functions, those functions are called, in order,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 with the given arguments ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 It is best not to depend on the value return by `run-hook-with-args',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 as that may change."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (and (boundp hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (symbol-value hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (let ((value (symbol-value hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (if (and (listp value) (not (eq (car value) 'lambda)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (mapcar '(lambda (foo) (apply foo args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (apply value args))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ;;;; SGML mode: template functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (defun sgml-markup (entry text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (cons entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (` (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (sgml-insert-markup (, text))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (defun sgml-insert-markup (text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (let ((end (sgml-mouse-region))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 before after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 old-text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (when end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (setq old-text (buffer-substring (point) end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (delete-region (point) end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (setq before (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (if (stringp text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (insert text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (eval text))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (setq after (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (goto-char before)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (when (search-forward "\r" after t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (delete-char -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (when old-text (insert old-text))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (defun sgml-mouse-region ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (let (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (sgml-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ((null (mark-marker)) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (t (setq start (region-beginning)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 end (region-end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ((and transient-mark-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 mark-active)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (setq start (region-beginning)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 end (region-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ((and mouse-secondary-overlay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (eq (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (overlay-buffer mouse-secondary-overlay)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (setq start (overlay-start mouse-secondary-overlay)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 end (overlay-end mouse-secondary-overlay))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (delete-overlay mouse-secondary-overlay)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (when start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (goto-char start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ;;;; SGML mode: indentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (defun sgml-indent-or-tab ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 "Indent line in proper way for current major mode."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (if (null sgml-indent-step)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (insert-tab)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (funcall indent-line-function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;;;; Bug reporting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (autoload 'reporter-submit-bug-report "reporter"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (defun sgml-submit-bug-report ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 "Submit via mail a bug report on PSGML."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (and (y-or-n-p "Do you really want to submit a report on PSGML? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (reporter-submit-bug-report
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 psgml-maintainer-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (concat "psgml.el " psgml-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 'sgml-always-quote-attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 'sgml-auto-activate-dtd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 'sgml-auto-insert-required-elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 'sgml-balanced-tag-edit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 'sgml-catalog-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 'sgml-declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 'sgml-doctype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 'sgml-ecat-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 'sgml-indent-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 'sgml-indent-step
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 'sgml-leave-point-after-insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 'sgml-live-element-indicator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 'sgml-local-catalogs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 'sgml-local-ecat-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 'sgml-markup-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 'sgml-minimize-attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 'sgml-normalize-trims
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 'sgml-omittag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 'sgml-omittag-transparent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 'sgml-parent-document
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 'sgml-public-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 'sgml-set-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 'sgml-shorttag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 'sgml-tag-region-if-active
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ;;;; SGML mode: keys and menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (if sgml-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (setq sgml-mode-map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ;;; Key commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (define-key sgml-mode-map "\t" 'sgml-indent-or-tab)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 ;(define-key sgml-mode-map "<" 'sgml-insert-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (define-key sgml-mode-map ">" 'sgml-close-angle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (define-key sgml-mode-map "/" 'sgml-slash)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (define-key sgml-mode-map "\C-c#" 'sgml-make-character-reference)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (define-key sgml-mode-map "\C-c-" 'sgml-untag-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (define-key sgml-mode-map "\C-c+" 'sgml-insert-attribute)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (define-key sgml-mode-map "\C-c/" 'sgml-insert-end-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (define-key sgml-mode-map "\C-c<" 'sgml-insert-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (define-key sgml-mode-map "\C-c=" 'sgml-change-element-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (define-key sgml-mode-map "\C-c\C-a" 'sgml-edit-attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (define-key sgml-mode-map "\C-c\C-c" 'sgml-show-context)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (define-key sgml-mode-map "\C-c\C-d" 'sgml-next-data-field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (define-key sgml-mode-map "\C-c\C-e" 'sgml-insert-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (define-key sgml-mode-map "\C-c\C-k" 'sgml-kill-markup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (define-key sgml-mode-map "\C-c\C-l" 'sgml-show-or-clear-log)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (define-key sgml-mode-map "\C-c\C-n" 'sgml-up-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (define-key sgml-mode-map "\C-c\C-o" 'sgml-next-trouble-spot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (define-key sgml-mode-map "\C-c\C-p" 'sgml-parse-prolog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (define-key sgml-mode-map "\C-c\C-q" 'sgml-fill-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (define-key sgml-mode-map "\C-c\C-r" 'sgml-tag-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (define-key sgml-mode-map "\C-c\C-s" 'sgml-unfold-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (define-key sgml-mode-map "\C-c\C-t" 'sgml-list-valid-tags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (define-key sgml-mode-map "\C-c\C-v" 'sgml-validate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (define-key sgml-mode-map "\C-c\C-w" 'sgml-what-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (define-key sgml-mode-map "\C-c\C-z" 'sgml-trim-and-leave-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (define-key sgml-mode-map "\C-c\C-f\C-e" 'sgml-fold-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (define-key sgml-mode-map "\C-c\C-f\C-r" 'sgml-fold-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (define-key sgml-mode-map "\C-c\C-f\C-s" 'sgml-fold-subelement)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (define-key sgml-mode-map "\C-c\C-f\C-x" 'sgml-expand-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (define-key sgml-mode-map "\C-c\r" 'sgml-split-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (define-key sgml-mode-map "\C-c\C-u\C-e" 'sgml-unfold-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (define-key sgml-mode-map "\C-c\C-u\C-a" 'sgml-unfold-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (define-key sgml-mode-map "\C-c\C-u\C-l" 'sgml-unfold-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (define-key sgml-mode-map "\C-c\C-u\C-d" 'sgml-custom-dtd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (define-key sgml-mode-map "\C-c\C-u\C-m" 'sgml-custom-markup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (define-key sgml-mode-map "\e\C-a" 'sgml-beginning-of-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (define-key sgml-mode-map "\e\C-e" 'sgml-end-of-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (define-key sgml-mode-map "\e\C-f" 'sgml-forward-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (define-key sgml-mode-map "\e\C-b" 'sgml-backward-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (define-key sgml-mode-map "\e\C-d" 'sgml-down-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (define-key sgml-mode-map "\e\C-u" 'sgml-backward-up-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (define-key sgml-mode-map "\e\C-k" 'sgml-kill-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (define-key sgml-mode-map "\e\C-@" 'sgml-mark-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 ;;(define-key sgml-mode-map [?\M-\C-\ ] 'sgml-mark-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (define-key sgml-mode-map "\e\C-h" 'sgml-mark-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (define-key sgml-mode-map "\e\C-t" 'sgml-transpose-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (define-key sgml-mode-map "\M-\t" 'sgml-complete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 ;;; Menu bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (autoload 'sgml-build-custom-menus "psgml-other")) ; Avoid compiler warnings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 ;; load menu file at the end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 ;;;; Post command hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (defvar sgml-auto-activate-dtd-tried nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (make-variable-buffer-local 'sgml-auto-activate-dtd-tried)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (defvar sgml-buffer-parse-state nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 "If the buffers DTD has been activated this contains the parser state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 The parser state has been created with `sgml-make-pstate' and contains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 the information about the DTD and the parse tree. This parse state is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 actually only the state that persists between commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (make-variable-buffer-local 'sgml-buffer-parse-state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (eval-and-compile ; Interface to psgml-parse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (loop for fun in '(sgml-need-dtd sgml-update-display sgml-subst-expand
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 sgml-declaration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 do (autoload fun "psgml-parse")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (defun sgml-command-post ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (when (eq major-mode 'sgml-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (when (and (null sgml-buffer-parse-state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 sgml-auto-activate-dtd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (null sgml-auto-activate-dtd-tried)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (not (zerop (buffer-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 (looking-at ".*<"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (setq sgml-auto-activate-dtd-tried t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (sgml-need-dtd))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (when sgml-buffer-parse-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (sgml-update-display))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 ;;;; SGML mode: major mode definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 ;;; This section is mostly from sgml-mode by James Clark.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (defun sgml-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 "Major mode for editing SGML.\\<sgml-mode-map>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 Makes > display the matching <. Makes / display matching /.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 Use \\[sgml-validate] to validate your document with an SGML parser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 You can find information with:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 \\[sgml-show-context] Show the nesting of elements at cursor position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 \\[sgml-list-valid-tags] Show the tags valid at cursor position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 Insert tags with completion of contextually valid tags with \\[sgml-insert-tag].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 End the current element with \\[sgml-insert-end-tag]. Insert an element (i.e.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 both start and end tag) with \\[sgml-insert-element]. Or tag a region with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 \\[sgml-tag-region].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 To tag a region with the mouse, use transient mark mode or secondary selection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 Structure editing:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 \\[sgml-backward-element] Moves backwards over the previous element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 \\[sgml-forward-element] Moves forward over the nex element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 \\[sgml-down-element] Move forward and down one level in the element structure.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 \\[sgml-backward-up-element] Move backward out of this element level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 \\[sgml-beginning-of-element] Move to after the start tag of the current element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 \\[sgml-end-of-element] Move to before the end tag of the current element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 \\[sgml-kill-element] Kill the element following the cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 Finding interesting positions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 \\[sgml-next-data-field] Move forward to next point where data is allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 \\[sgml-next-trouble-spot] Move forward to next point where something is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 amiss with the structure.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 Folding and unfolding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 \\[sgml-fold-element] Fold the lines comprising the current element, leaving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 the first line visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 \\[sgml-fold-subelement] Fold the elements in the content of the current element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 Leaving the first line of every element visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 \\[sgml-unfold-line] Show hidden lines in current line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 User options:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 sgml-omittag Set this to reflect OMITTAG in the SGML declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 sgml-shortag Set this to reflect SHORTTAG in the SGML declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 sgml-auto-insert-required-elements If non-nil, automatically insert required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 elements in the content of an inserted element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 sgml-balanced-tag-edit If non-nil, always insert start-end tag pairs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 sgml-omittag-transparent If non-nil, will show legal tags inside elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 with omitable start tags and legal tags beyond omitable end tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 sgml-leave-point-after-insert If non-nil, the point will remain after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 inserted tag(s).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 sgml-warn-about-undefined-elements If non-nil, print a warning when a tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 for a undefined element is found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 sgml-max-menu-size Max number of entries in Tags and Entities menus before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 they are split into several panes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 sgml-always-quote-attributes If non-nil, quote all attribute values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 inserted after finishing edit attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 sgml-minimize-attributes Determines minimization of attributes inserted by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 edit-attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 sgml-normalize-trims If non-nil, sgml-normalize will trim off white space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 from end of element when adding end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 sgml-indent-step How much to increament indent for every element level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 sgml-indent-data If non-nil, indent in data/mixed context also.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 sgml-set-face If non-nil, psgml will set the face of parsed markup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 sgml-markup-faces The faces used when the above variable is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 sgml-system-path List of directorys used to look for system identifiers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 sgml-public-map Mapping from public identifiers to file names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 sgml-offer-save If non-nil, ask about saving modified buffers before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 \\[sgml-validate] is run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 All bindings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 \\{sgml-mode-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (setq local-abbrev-table sgml-mode-abbrev-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (use-local-map sgml-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (setq mode-name "SGML")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (setq major-mode 'sgml-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 ;; A start or end tag by itself on a line separates a paragraph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ;; This is desirable because SGML discards a newline that appears
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 ;; immediately after a start tag or immediately before an end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (set (make-local-variable 'paragraph-separate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 "^[ \t\n]*$\\|\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ^[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 \"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (set (make-local-variable 'paragraph-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 paragraph-separate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (set-syntax-table text-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (make-local-variable 'comment-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (setq comment-start "<!-- ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (make-local-variable 'comment-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (setq comment-end " -->")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (make-local-variable 'comment-indent-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (setq comment-indent-function 'sgml-comment-indent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (make-local-variable 'comment-start-skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 ;; This will allow existing comments within declarations to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 ;; recognized. [Does not work well with auto-fill, Lst/940205]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;;(setq comment-start-skip "--[ \t]*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (setq comment-start-skip "<!--[ \t]*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 ;; Added for psgml:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (make-local-variable 'indent-line-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (setq indent-line-function 'sgml-indent-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (make-local-variable 'mode-line-format)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ;; wing change: use `subst' rather than duplicating the whole
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ;; mode-line-format. XEmacs 19.14 changes the default mode-line-format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (setq mode-line-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (subst '("" mode-name sgml-active-dtd-indicator) 'mode-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 mode-line-format))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (make-local-variable 'sgml-default-dtd-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (when (setq sgml-default-dtd-file (sgml-default-dtd-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (unless (file-exists-p sgml-default-dtd-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (setq sgml-default-dtd-file nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (add-hook 'post-command-hook 'sgml-command-post 'append)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (run-hooks 'text-mode-hook 'sgml-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (sgml-build-custom-menus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (defun sgml-default-dtd-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (and (buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (let ((base (file-name-nondirectory (buffer-file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (cond ((string-match "\\.[^.]+$" base)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (substring base 0 (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 base))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 ".ced"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (defun sgml-comment-indent ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (if (and (looking-at "--")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (not (and (eq (char-after (1- (point))) ?!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (eq (char-after (- (point) 2)) ?<))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (max comment-column (1+ (current-column))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (defconst sgml-start-tag-regex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 "Regular expression that matches a non-empty start tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 Any terminating > or / is not matched.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (defvar sgml-mode-markup-syntax-table nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 "Syntax table used for scanning SGML markup.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (if sgml-mode-markup-syntax-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (setq sgml-mode-markup-syntax-table (make-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (modify-syntax-entry ?< "(>" sgml-mode-markup-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (modify-syntax-entry ?> ")<" sgml-mode-markup-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (modify-syntax-entry ?- "_ 1234" sgml-mode-markup-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (modify-syntax-entry ?\' "\"" sgml-mode-markup-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (defconst sgml-angle-distance 4000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 "*If non-nil, is the maximum distance to search for matching <.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (defun sgml-close-angle (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 "Insert > and display matching <."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (insert-char ?> arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (if (> arg 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (let ((oldpos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (blinkpos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (if sgml-angle-distance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (narrow-to-region (max (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (- (point) sgml-angle-distance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 oldpos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 ;; See if it's the end of a marked section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (and (> (- (point) (point-min)) 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (eq (char-after (- (point) 2)) ?\])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (eq (char-after (- (point) 3)) ?\])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (re-search-backward "<!\\[\\(-?[A-Za-z0-9. \t\n&;]\\|\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 --\\([^-]\\|-[^-]\\)*--\\)*\\["
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (let ((msspos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (if (and (search-forward "]]>" oldpos t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (eq (point) oldpos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (setq blinkpos msspos))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 ;; This handles cases where the > ends one of the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 ;; markup declaration starting with <! (possibly including a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 ;; declaration subset); start tag; end tag; SGML declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (if blinkpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (goto-char oldpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (let ((oldtable (syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (parse-sexp-ignore-comments t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (set-syntax-table sgml-mode-markup-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (setq blinkpos (scan-sexps oldpos -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (set-syntax-table oldtable)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (and blinkpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (goto-char blinkpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 ;; Check that it's a valid delimiter in context.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (not (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 "<\\(\\?\\|/?[A-Za-z>]\\|!\\([[A-Za-z]\\|--\\)\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 ;; Check that it's not a net-enabling start tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 ;; nor an unclosed start-tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (looking-at (concat sgml-start-tag-regex "[/<]"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 ;; Nor an unclosed end-tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (looking-at "</[A-Za-z][-.A-Za-z0-9]*[ \t]*<"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (setq blinkpos nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (if blinkpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 ;; See if it's the end of a processing instruction.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (goto-char oldpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (if (search-backward "<?" (point-min) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (let ((pipos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (if (and (search-forward ">" oldpos t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (eq (point) oldpos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (setq blinkpos pipos))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (if blinkpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (goto-char blinkpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (if (pos-visible-in-window-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (message "Matches %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (buffer-substring blinkpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (progn (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (point)))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 ;;; I doubt that null end tags are used much for large elements,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 ;;; so use a small distance here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (defconst sgml-slash-distance 1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 "*If non-nil, is the maximum distance to search for matching /.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (defun sgml-slash (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 "Insert / and display any previous matching /.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 Two /s are treated as matching if the first / ends a net-enabling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 start tag, and the second / is the corresponding null end tag."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (insert-char ?/ arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (if (> arg 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (let ((oldpos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (blinkpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (level 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (if sgml-slash-distance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (narrow-to-region (max (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (- (point) sgml-slash-distance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 oldpos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (if (and (re-search-backward sgml-start-tag-regex (point-min) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (eq (match-end 0) (1- oldpos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (goto-char (1- oldpos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (while (and (not blinkpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (search-backward "/" (point-min) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (let ((tagend (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (if (re-search-backward sgml-start-tag-regex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (point-min) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (match-end 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (if (eq tagend (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (if (eq level 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (setq blinkpos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (setq level (1- level)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (setq level (1+ level)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (if blinkpos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (goto-char blinkpos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (if (pos-visible-in-window-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (message "Matches %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (buffer-substring (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (1+ blinkpos))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (eval-and-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (autoload 'compile-internal "compile" ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (defun sgml-default-validate-command ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 ((consp sgml-validate-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (let ((validate-subst
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 (cons ?b (and (buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (file-name-nondirectory (buffer-file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (cons ?s (sgml-declaration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (cons ?v sgml-declaration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (cons ?d sgml-doctype))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (loop for template in sgml-validate-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 thereis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (sgml-subst-expand template validate-subst))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (apply 'format sgml-validate-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (if sgml-validate-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (funcall sgml-validate-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (list (or sgml-declaration "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (let ((name (buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (if name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (file-name-nondirectory name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 ""))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (defun sgml-validate (command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 "Validate an SGML document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 Runs COMMAND, a shell command, in a separate process asynchronously
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 with output going to the buffer *compilation*.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 You can then use the command \\[next-error] to find the next error message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 and move to the line in the SGML document that caused it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (list (read-from-minibuffer "Validate command: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (sgml-default-validate-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 nil nil 'sgml-validate-command-history)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (if sgml-offer-save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (save-some-buffers nil nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (compile-internal command "No more errors" "SGML validation"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 sgml-validate-error-regexps))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 ;;;; Autoloads and hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (autoload 'sgml-doctype-insert "psgml-edit"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (autoload 'sgml-indent-line "psgml-edit" nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 ;;; Generated by sgml-build-autoloads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (autoload 'sgml-load-dtd "psgml-parse" "Load a saved DTD from FILE." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (autoload 'sgml-show-or-clear-log "psgml-parse" "Show the *SGML LOG* buffer if it is not showing, or clear and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 remove it if it is showing." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 (autoload 'sgml-parse-prolog "psgml-parse" "Parse the document prolog to learn the DTD." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (autoload 'sgml-beginning-of-element "psgml-edit" "Move to after the start-tag of the current element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 If the start-tag is implied, move to the start of the element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (autoload 'sgml-end-of-element "psgml-edit" "Move to before the end-tag of the current element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 (autoload 'sgml-backward-up-element "psgml-edit" "Move backward out of this element level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 That is move to before the start-tag or where a start-tag is implied." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (autoload 'sgml-up-element "psgml-edit" "Move forward out of this element level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 That is move to after the end-tag or where an end-tag is implied." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (autoload 'sgml-forward-element "psgml-edit" "Move forward over next element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (autoload 'sgml-backward-element "psgml-edit" "Move backward over previous element at this level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 With implied tags this is ambigous." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (autoload 'sgml-down-element "psgml-edit" "Move forward and down one level in the element structure." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (autoload 'sgml-kill-element "psgml-edit" "Kill the element following the cursor." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (autoload 'sgml-transpose-element "psgml-edit" "Interchange element before point with element after point, leave point after." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (autoload 'sgml-mark-element "psgml-edit" "Set mark after next element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (autoload 'sgml-mark-current-element "psgml-edit" "Set mark at end of current element, and leave point before current element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (autoload 'sgml-change-element-name "psgml-edit" "Replace the name of the current element with a new name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 Eventual attributes of the current element will be translated if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 possible." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (autoload 'sgml-untag-element "psgml-edit" "Remove tags from current element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (autoload 'sgml-kill-markup "psgml-edit" "Kill next tag, markup declaration or process instruction." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (autoload 'sgml-fold-region "psgml-edit" "Hide (or if prefixarg unhide) region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 If called from a program first two arguments are start and end of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 region. And optional third argument true unhides." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (autoload 'sgml-fold-element "psgml-edit" "Fold the lines comprising the current element, leaving the first line visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 This uses the selective display feature." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 (autoload 'sgml-fold-subelement "psgml-edit" "Fold all elements current elements content, leaving the first lines visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 This uses the selective display feature." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (autoload 'sgml-unfold-line "psgml-edit" "Show hidden lines in current line." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (autoload 'sgml-unfold-element "psgml-edit" "Show all hidden lines in current element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (autoload 'sgml-expand-element "psgml-edit" "As sgml-fold-subelement, but unfold first." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (autoload 'sgml-unfold-all "psgml-edit" "Show all hidden lines in buffer." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (autoload 'sgml-next-data-field "psgml-edit" "Move forward to next point where data is allowed." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (autoload 'sgml-next-trouble-spot "psgml-edit" "Move forward to next point where something is amiss with the structure." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (autoload 'sgml-list-valid-tags "psgml-edit" "Display a list of the contextually valid tags." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (autoload 'sgml-show-context "psgml-edit" "Display where the cursor is in the element hierarchy." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 (autoload 'sgml-what-element "psgml-edit" "Display what element is under the cursor." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 (autoload 'sgml-insert-tag "psgml-edit" "Insert a tag, reading tag name in minibuffer with completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 If the variable sgml-balanced-tag-edit is t, also inserts the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 corresponding end tag. If sgml-leave-point-after-insert is t, the point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 is left after the inserted tag(s), unless the element has som required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 content. If sgml-leave-point-after-insert is nil the point is left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 after the first tag inserted." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (autoload 'sgml-insert-element "psgml-edit" "Reads element name from minibuffer and inserts start and end tags." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (autoload 'sgml-tag-region "psgml-edit" "Reads element name from minibuffer and inserts start and end tags." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (autoload 'sgml-insert-end-tag "psgml-edit" "Insert end-tag for the current open element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (autoload 'sgml-insert-attribute "psgml-edit" "Read attribute name and value from minibuffer and insert attribute spec." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (autoload 'sgml-split-element "psgml-edit" "Split the current element at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 If repeated, the containing element will be split before the beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 of then current element." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (autoload 'sgml-custom-dtd "psgml-edit" "Insert a DTD declaration from the sgml-custom-dtd alist." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (autoload 'sgml-custom-markup "psgml-edit" "Insert markup from the sgml-custom-markup alist." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (autoload 'sgml-tags-menu "psgml-edit" "Pop up a menu with valid tags and insert the choosen tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 If the variable sgml-balanced-tag-edit is t, also inserts the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 corresponding end tag. If sgml-leave-point-after-insert is t, the point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 is left after the inserted tag(s), unless the element has som required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 content. If sgml-leave-point-after-insert is nil the point is left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 after the first tag inserted." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (autoload 'sgml-element-menu "psgml-edit" "Pop up a menu with valid elements and insert choice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 If sgml-leave-point-after-insert is nil the point is left after the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 tag inserted." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (autoload 'sgml-start-tag-menu "psgml-edit" "Pop up a menu with valid start-tags and insert choice." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 (autoload 'sgml-end-tag-menu "psgml-edit" "Pop up a menu with valid end-tags and insert choice." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (autoload 'sgml-tag-region-menu "psgml-edit" "Pop up a menu with valid elements and tag current region with the choice." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (autoload 'sgml-entities-menu "psgml-edit" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 (autoload 'sgml-attrib-menu "psgml-edit" "Pop up a menu of the attributes of the current element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 \(or the element whith start-tag before point)." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (autoload 'sgml-fill-element "psgml-edit" "Fill bigest enclosing element with mixed content.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 If current element has pure element content, recursively fill the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 subelements." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (autoload 'sgml-edit-attributes "psgml-edit" "Edit attributes of current element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 Editing is done in a separate window." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 (autoload 'sgml-edit-attrib-finish "psgml-edit" "Finish editing and insert attribute values in original buffer." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (autoload 'sgml-edit-attrib-default "psgml-edit" "Set current attribute value to default." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (autoload 'sgml-edit-attrib-clear "psgml-edit" "Kill the value of current attribute." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (autoload 'sgml-edit-attrib-field-start "psgml-edit" "Go to the start of the attribute value field." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (autoload 'sgml-edit-attrib-field-end "psgml-edit" "Go to the end of the attribute value field." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (autoload 'sgml-edit-attrib-next "psgml-edit" "Move to next attribute value." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (autoload 'sgml-hide-tags "psgml-edit" "Hide all tags in buffer." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (autoload 'sgml-show-tags "psgml-edit" "Show hidden tags in buffer." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (autoload 'sgml-hide-attributes "psgml-edit" "Hide all attribute specifications in the buffer." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (autoload 'sgml-show-attributes "psgml-edit" "Show all attribute specifications in the buffer." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (autoload 'sgml-expand-all-shortrefs "psgml-edit" "Expand all short references in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 Short references to text entities are expanded to the replacement text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 of the entity other short references are expanded into general entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 references. If argument, TO-ENTITY, is non-nil, or if called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 interactive with numeric prefix argument, all short references are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 replaced by generaly entity references." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (autoload 'sgml-normalize "psgml-edit" "Normalize buffer by filling in omitted tags and expanding empty tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 Argument TO-ENTITY controls how short references are expanded as with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 `sgml-expand-all-shortrefs'. An optional argument ELEMENT can be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 element to normalize insted of the whole buffer, if used no short
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 references will be expanded." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 (autoload 'sgml-normalize-element "psgml-edit" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (autoload 'sgml-make-character-reference "psgml-edit" "Convert character after point into a character reference.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 If called with a numeric argument, convert a character reference back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 to a normal character. If called from a program, set optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 argument INVERT to non-nil." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (autoload 'sgml-expand-entity-reference "psgml-edit" "Insert the text of the entity referenced at point." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 (autoload 'sgml-complete "psgml-edit" "Complete the word/tag/entity before point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 If it is a tag (starts with < or </) complete with valid tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 If it is an entity (starts with &) complete with declared entities.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 If it is a markup declaration (starts with <!) complete with markup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 declaration names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 If it is something else complete with ispell-complete-word." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (autoload 'sgml-file-options-menu "psgml-edit" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (autoload 'sgml-user-options-menu "psgml-edit" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (autoload 'sgml-save-dtd "psgml-dtd" "Save the parsed dtd on FILE." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (autoload 'sgml-list-elements "psgml-info" "List the elements and their attributes in the current DTD." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (autoload 'sgml-list-attributes "psgml-info" "List the attributes and in which elements they occur." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (autoload 'sgml-list-terminals "psgml-info" "List the elements that can have data in their content." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (autoload 'sgml-list-content-elements "psgml-info" "List all element types and the element types that can occur in its content." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (autoload 'sgml-list-occur-in-elements "psgml-info" "List all element types and where it can occur." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (autoload 'sgml-describe-entity "psgml-info" "Describe the properties of an entity as declared in the current DTD." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (autoload 'sgml-describe-element-type "psgml-info" "Describe the properties of an element type as declared in the current DTD." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (autoload 'sgml-general-dtd-info "psgml-info" "Display information about the current DTD." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (autoload 'sgml-charent-to-display-char "psgml-charent" "Replace character entities with their display character equivalents" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (autoload 'sgml-display-char-to-charent "psgml-charent" "Replace displayable characters with their character entity equivalents" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 ;;;; Last provisions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (provide 'psgml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (provide 'sgml-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (sgml-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (require 'psgml-xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (add-hook 'sgml-mode-hook 'sgml-install-xemacs-menus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (require 'psgml-other)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 ;;; psgml.el ends HERE