annotate lisp/psgml/psgml.el @ 119:d101af7320b8

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