annotate lisp/textmodes/sgml-mode.el @ 43232:b88c2aa1a30a

*** empty log message ***
author Pavel Janík <Pavel@Janik.cz>
date Mon, 11 Feb 2002 06:09:53 +0000
parents eae4ef246746
children 57e4f81f3346 8fb7bc8f8acc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1 ;;; sgml-mode.el --- SGML- and HTML-editing modes
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
3 ;; Copyright (C) 1992,95,96,98,2001 Free Software Foundation, Inc.
844
bf829a2d63b4 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 828
diff changeset
4
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
5 ;; Author: James Clark <jjc@jclark.com>
23869
8d2bb5d1416a Update comment.
Karl Heuer <kwzh@gnu.org>
parents: 23726
diff changeset
6 ;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org>,
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
7 ;; F.Potorti@cnuce.cnr.it
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
8 ;; Keywords: wp, hypermedia, comm, languages
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
12244
ac7375e60931 Update GPL to version 2.
Karl Heuer <kwzh@gnu.org>
parents: 3366
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; any later version.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14168
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14168
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14168
diff changeset
25 ;; Boston, MA 02111-1307, USA.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27 ;;; Commentary:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
29 ;; Configurable major mode for editing document in the SGML standard general
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
30 ;; markup language. As an example contains a mode for editing the derived
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
31 ;; HTML hypertext markup language.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
33 ;;; Code:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34
25175
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
35 (eval-when-compile
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
36 (require 'skeleton)
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
37 (require 'outline))
23726
ca83df619ee6 Require skeleton when compiling.
Dave Love <fx@gnu.org>
parents: 23652
diff changeset
38
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
39 (defgroup sgml nil
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
40 "SGML editing mode"
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
41 :group 'languages)
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
42
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
43 (defcustom sgml-transformation 'identity
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
44 "*Default value for `skeleton-transformation' (which see) in SGML mode."
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
45 :type 'function
17530
9fb83ef40566 (sgml-transformation): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17500
diff changeset
46 :group 'sgml)
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
47
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
48 (put 'sgml-transformation 'variable-interactive
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
49 "aTransformation function: ")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
50
25175
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
51 (defcustom sgml-mode-hook nil
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
52 "Hook run by command `sgml-mode'.
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
53 `text-mode-hook' is run first."
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
54 :group 'sgml
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
55 :type 'hook)
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
56
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
57 ;; As long as Emacs' syntax can't be complemented with predicates to context
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
58 ;; sensitively confirm the syntax of characters, we have to live with this
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
59 ;; kludgy kind of tradeoff.
16404
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
60 (defvar sgml-specials '(?\")
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
61 "List of characters that have a special meaning for SGML mode.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
62 This list is used when first loading the sgml-mode library.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
63 The supported characters and potential disadvantages are:
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
64
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
65 ?\\\" Makes \" in text start a string.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
66 ?' Makes ' in text start a string.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
67 ?- Makes -- in text start a comment.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
68
22319
18b5b2445726 (sgml-font-lock-keywords-1): Add -. as
Dave Love <fx@gnu.org>
parents: 22222
diff changeset
69 When only one of ?\\\" or ?' are included, \"'\" or '\"', as can be found in
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
70 DTDs, start a string. To partially avoid this problem this also makes these
16404
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
71 self insert as named entities depending on `sgml-quick-keys'.
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
72
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
73 Including ?- has the problem of affecting dashes that have nothing to do
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
74 with comments, so we normally turn it off.")
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
75
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
76 (defvar sgml-quick-keys nil
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
77 "Use <, >, &, SPC and `sgml-specials' keys \"electrically\" when non-nil.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
78 This takes effect when first loading the sgml-mode library.")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
79
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
80
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
81 (defvar sgml-mode-map
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
82 (let ((map (make-keymap)) ;`sparse' doesn't allow binding to charsets.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
83 (menu-map (make-sparse-keymap "SGML")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
84 (define-key map "\C-c\C-i" 'sgml-tags-invisible)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
85 (define-key map "/" 'sgml-slash)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
86 (define-key map "\C-c\C-n" 'sgml-name-char)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
87 (define-key map "\C-c\C-t" 'sgml-tag)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
88 (define-key map "\C-c\C-a" 'sgml-attributes)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
89 (define-key map "\C-c\C-b" 'sgml-skip-tag-backward)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
90 (define-key map [?\C-c left] 'sgml-skip-tag-backward)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
91 (define-key map "\C-c\C-f" 'sgml-skip-tag-forward)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
92 (define-key map [?\C-c right] 'sgml-skip-tag-forward)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
93 (define-key map "\C-c\C-d" 'sgml-delete-tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
94 (define-key map "\C-c\^?" 'sgml-delete-tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
95 (define-key map "\C-c?" 'sgml-tag-help)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
96 (define-key map "\C-c8" 'sgml-name-8bit-mode)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
97 (define-key map "\C-c\C-v" 'sgml-validate)
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
98 (when sgml-quick-keys
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
99 (define-key map "&" 'sgml-name-char)
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
100 (define-key map "<" 'sgml-tag)
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
101 (define-key map " " 'sgml-auto-attributes)
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
102 (define-key map ">" 'sgml-maybe-end-tag)
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
103 (when (memq ?\" sgml-specials)
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
104 (define-key map "\"" 'sgml-name-self))
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
105 (when (memq ?' sgml-specials)
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
106 (define-key map "'" 'sgml-name-self)))
38108
f535923264bd (sgml-mode-map): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38068
diff changeset
107 (define-key map (vector (make-char 'latin-iso8859-1))
f535923264bd (sgml-mode-map): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38068
diff changeset
108 'sgml-maybe-name-self)
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
109 (let ((c 127)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
110 (map (nth 1 map)))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
111 (while (< (setq c (1+ c)) 256)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
112 (aset map c 'sgml-maybe-name-self)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
113 (define-key map [menu-bar sgml] (cons "SGML" menu-map))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
114 (define-key menu-map [sgml-validate] '("Validate" . sgml-validate))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
115 (define-key menu-map [sgml-name-8bit-mode]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
116 '("Toggle 8 Bit Insertion" . sgml-name-8bit-mode))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
117 (define-key menu-map [sgml-tags-invisible]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
118 '("Toggle Tag Visibility" . sgml-tags-invisible))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
119 (define-key menu-map [sgml-tag-help]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
120 '("Describe Tag" . sgml-tag-help))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
121 (define-key menu-map [sgml-delete-tag]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
122 '("Delete Tag" . sgml-delete-tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
123 (define-key menu-map [sgml-skip-tag-forward]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
124 '("Forward Tag" . sgml-skip-tag-forward))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
125 (define-key menu-map [sgml-skip-tag-backward]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
126 '("Backward Tag" . sgml-skip-tag-backward))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
127 (define-key menu-map [sgml-attributes]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
128 '("Insert Attributes" . sgml-attributes))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
129 (define-key menu-map [sgml-tag] '("Insert Tag" . sgml-tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
130 map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
131 "Keymap for SGML mode. See also `sgml-specials'.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
132
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
133
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
134 (defvar sgml-mode-syntax-table
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
135 (let ((table (copy-syntax-table text-mode-syntax-table)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
136 (modify-syntax-entry ?< "(>" table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
137 (modify-syntax-entry ?> ")<" table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
138 (if (memq ?- sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
139 (modify-syntax-entry ?- "_ 1234" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
140 (if (memq ?\" sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
141 (modify-syntax-entry ?\" "\"\"" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
142 (if (memq ?' sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
143 (modify-syntax-entry ?\' "\"'" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
144 table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
145 "Syntax table used in SGML mode. See also `sgml-specials'.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
146
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
147
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
148 (defcustom sgml-name-8bit-mode nil
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
149 "*When non-nil, insert non-ASCII characters as named entities."
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
150 :type 'boolean
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
151 :group 'sgml)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
152
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
153 (defvar sgml-char-names
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
154 [nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
155 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
156 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
157 nil nil nil nil nil nil nil nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
158 "nbsp" "excl" "quot" "num" "dollar" "percnt" "amp" "apos"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
159 "lpar" "rpar" "ast" "plus" "comma" "hyphen" "period" "sol"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
160 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
161 nil nil "colon" "semi" "lt" "eq" "gt" "quest"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
162 "commat" nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
163 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
164 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
165 nil nil nil "lsqb" nil "rsqb" "uarr" "lowbar"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
166 "lsquo" nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
167 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
168 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
169 nil nil nil "lcub" "verbar" "rcub" "tilde" nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
170 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
171 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
172 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
173 nil nil nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
174 "nbsp" "iexcl" "cent" "pound" "curren" "yen" "brvbar" "sect"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
175 "uml" "copy" "ordf" "laquo" "not" "shy" "reg" "macr"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
176 "ring" "plusmn" "sup2" "sup3" "acute" "micro" "para" "middot"
26250
194bcc8d17db * textmodes/sgml-mode.el (sgml-char-names): Change "half" to
Gerd Moellmann <gerd@gnu.org>
parents: 25175
diff changeset
177 "cedil" "sup1" "ordm" "raquo" "frac14" "frac12" "frac34" "iquest"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
178 "Agrave" "Aacute" "Acirc" "Atilde" "Auml" "Aring" "AElig" "Ccedil"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
179 "Egrave" "Eacute" "Ecirc" "Euml" "Igrave" "Iacute" "Icirc" "Iuml"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
180 "ETH" "Ntilde" "Ograve" "Oacute" "Ocirc" "Otilde" "Ouml" nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
181 "Oslash" "Ugrave" "Uacute" "Ucirc" "Uuml" "Yacute" "THORN" "szlig"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
182 "agrave" "aacute" "acirc" "atilde" "auml" "aring" "aelig" "ccedil"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
183 "egrave" "eacute" "ecirc" "euml" "igrave" "iacute" "icirc" "iuml"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
184 "eth" "ntilde" "ograve" "oacute" "ocirc" "otilde" "ouml" "divide"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
185 "oslash" "ugrave" "uacute" "ucirc" "uuml" "yacute" "thorn" "yuml"]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
186 "Vector of symbolic character names without `&' and `;'.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
187
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
188 (put 'sgml-table 'char-table-extra-slots 0)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
189
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
190 (defvar sgml-char-names-table
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
191 (let ((table (make-char-table 'sgml-table))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
192 (i 32)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
193 elt)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
194 (while (< i 256)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
195 (setq elt (aref sgml-char-names i))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
196 (if elt (aset table (make-char 'latin-iso8859-1 i) elt))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
197 (setq i (1+ i)))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
198 table)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
199 "A table for mapping non-ASCII characters into SGML entity names.
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
200 Currently, only Latin-1 characters are supported.")
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
201
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
202
25052
d2a4359531e0 (sgml-validate-command): Use nsgmls.
Dave Love <fx@gnu.org>
parents: 24463
diff changeset
203 ;; nsgmls is a free SGML parser in the SP suite available from
d2a4359531e0 (sgml-validate-command): Use nsgmls.
Dave Love <fx@gnu.org>
parents: 24463
diff changeset
204 ;; ftp.jclark.com and otherwise packaged for GNU systems.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
205 ;; Its error messages can be parsed by next-error.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
206 ;; The -s option suppresses output.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
207
25052
d2a4359531e0 (sgml-validate-command): Use nsgmls.
Dave Love <fx@gnu.org>
parents: 24463
diff changeset
208 (defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls'
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
209 "*The command to validate an SGML document.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
210 The file name of current buffer file name will be appended to this,
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
211 separated by a space."
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
212 :type 'string
25175
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
213 :version "21.1"
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
214 :group 'sgml)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
215
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
216 (defvar sgml-saved-validate-command nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
217 "The command last used to validate in this buffer.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
218
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
219
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
220 ;; I doubt that null end tags are used much for large elements,
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
221 ;; so use a small distance here.
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
222 (defcustom sgml-slash-distance 1000
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
223 "*If non-nil, is the maximum distance to search for matching `/'."
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
224 :type '(choice (const nil) integer)
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
225 :group 'sgml)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
226
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
227 (defconst sgml-start-tag-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
228 "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
229 "Regular expression that matches a non-empty start tag.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
230 Any terminating `>' or `/' is not matched.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
231
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
232
21780
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
233 ;; internal
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
234 (defconst sgml-font-lock-keywords-1
23726
ca83df619ee6 Require skeleton when compiling.
Dave Love <fx@gnu.org>
parents: 23652
diff changeset
235 '(("<\\([!?][a-z][-.a-z0-9]*\\)" 1 font-lock-keyword-face)
ca83df619ee6 Require skeleton when compiling.
Dave Love <fx@gnu.org>
parents: 23652
diff changeset
236 ("<\\(/?[a-z][-.a-z0-9]*\\)" 1 font-lock-function-name-face)
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
237 ("[&%][a-z][-.a-z0-9]*;?" . font-lock-variable-name-face)))
21780
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
238
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
239 (defconst sgml-font-lock-keywords-2
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
240 (append
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
241 sgml-font-lock-keywords-1
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
242 '((eval
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
243 . (cons (concat "<"
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
244 (regexp-opt (mapcar 'car sgml-tag-face-alist) t)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
245 "\\([ \t][^>]*\\)?>\\([^<]+\\)</\\1>")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
246 '(3 (cdr (assoc (downcase (match-string 1))
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
247 sgml-tag-face-alist))))))))
21780
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
248
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
249 ;; for font-lock, but must be defvar'ed after
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
250 ;; sgml-font-lock-keywords-1 and sgml-font-lock-keywords-2 above
5dc3fe7cd300 (sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents: 20922
diff changeset
251 (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
252 "*Rules for highlighting SGML code. See also `sgml-tag-face-alist'.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
253
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
254 (defvar sgml-font-lock-syntactic-keywords
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
255 ;; Use the `b' style of comments to avoid interference with the -- ... --
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
256 ;; comments recognized when `sgml-specials' includes ?-.
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
257 ;; FIXME: beware of <!--> blabla <!--> !!
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
258 '(("\\(<\\)!--" (1 "< b"))
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
259 ("--[ \t\n]*\\(>\\)" (1 "> b")))
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
260 "Syntactic keywords for `sgml-mode'.")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
261
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
262 ;; internal
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
263 (defvar sgml-face-tag-alist ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
264 "Alist of face and tag name for facemenu.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
265
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
266 (defvar sgml-tag-face-alist ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
267 "Tag names and face or list of faces to fontify with when invisible.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
268 When `font-lock-maximum-decoration' is 1 this is always used for fontifying.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
269 When more these are fontified together with `sgml-font-lock-keywords'.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
270
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
271
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
272 (defvar sgml-display-text ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
273 "Tag names as lowercase symbols, and display string when invisible.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
274
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
275 ;; internal
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
276 (defvar sgml-tags-invisible nil)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
277
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
278
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
279 (defcustom sgml-tag-alist
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
280 '(("![" ("ignore" t) ("include" t))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
281 ("!attlist")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
282 ("!doctype")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
283 ("!element")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
284 ("!entity"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
285 "*Alist of tag names for completing read and insertion rules.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
286 This alist is made up as
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
287
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
288 ((\"tag\" . TAGRULE)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
289 ...)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
290
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
291 TAGRULE is a list of optionally `t' (no endtag) or `\\n' (separate endtag by
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
292 newlines) or a skeleton with `nil', `t' or `\\n' in place of the interactor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
293 followed by an ATTRIBUTERULE (for an always present attribute) or an
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
294 attribute alist.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
295
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
296 The attribute alist is made up as
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
297
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
298 ((\"attribute\" . ATTRIBUTERULE)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
299 ...)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
300
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
301 ATTRIBUTERULE is a list of optionally `t' (no value when no input) followed by
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
302 an optional alist of possible values."
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
303 :type '(repeat (cons (string :tag "Tag Name")
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
304 (repeat :tag "Tag Rule" sexp)))
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
305 :group 'sgml)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
306
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
307 (defcustom sgml-tag-help
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
308 '(("!" . "Empty declaration for comment")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
309 ("![" . "Embed declarations with parser directive")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
310 ("!attlist" . "Tag attributes declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
311 ("!doctype" . "Document type (DTD) declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
312 ("!element" . "Tag declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
313 ("!entity" . "Entity (macro) declaration"))
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
314 "*Alist of tag name and short description."
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
315 :type '(repeat (cons (string :tag "Tag Name")
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
316 (string :tag "Description")))
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
317 :group 'sgml)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
318
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
319 (defcustom sgml-xml nil
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
320 "*When non-nil, tag insertion functions will be XML-compliant.
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
321 If this variable is customized, the custom value is used always.
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
322 Otherwise, it is set to be buffer-local when the file has
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
323 a DOCTYPE or an XML declaration."
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
324 :type 'boolean
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
325 :version "21.2"
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
326 :group 'sgml)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
327
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
328 (defvar sgml-empty-tags nil
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
329 "List of tags whose !ELEMENT definition says EMPTY.")
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
330
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
331 (defun sgml-xml-guess ()
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
332 "Guess whether the current buffer is XML."
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
333 (save-excursion
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
334 (goto-char (point-min))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
335 (cond ((or (string= "xml" (file-name-extension (or buffer-file-name "")))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
336 (looking-at "\\s-*<\\?xml"))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
337 (set (make-local-variable 'sgml-xml) t))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
338 ((re-search-forward
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
339 (eval-when-compile
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
340 (mapconcat 'identity
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
341 '("<!DOCTYPE" "\\(\\w+\\)" "\\(\\w+\\)"
40624
eae4ef246746 (sgml-xml-guess): Fix regexp to avoid ambiguous nested loops.
Richard M. Stallman <rms@gnu.org>
parents: 40393
diff changeset
342 "\"\\([^\"]+\\)\"" "\"\\([^\"]+\\)\"")
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
343 "\\s-+"))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
344 nil t)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
345 (let ((name (match-string 1))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
346 (pub (match-string 2))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
347 (id (match-string 3))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
348 (url (match-string 4)))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
349 (cond ((string= name "html")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
350 (set (make-local-variable 'sgml-xml)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
351 (not (null (string-match "XHTML" id)))))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
352 ((string-match "XML" id)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
353 (set (make-local-variable 'sgml-xml) t))))))))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
354
23726
ca83df619ee6 Require skeleton when compiling.
Dave Love <fx@gnu.org>
parents: 23652
diff changeset
355 (defvar v2) ; free for skeleton
ca83df619ee6 Require skeleton when compiling.
Dave Love <fx@gnu.org>
parents: 23652
diff changeset
356
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
357 (defun sgml-mode-common ()
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
358 "Common code for setting up `sgml-mode' and derived modes."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
359 (make-local-variable 'sgml-saved-validate-command)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
360 (make-local-variable 'facemenu-end-add-face)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
361 ;;(make-local-variable 'facemenu-remove-face-function)
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
362 (set (make-local-variable 'indent-line-function) 'indent-relative-maybe)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
363 ;; A start or end tag by itself on a line separates a paragraph.
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
364 ;; This is desirable because SGML discards a newline that appears
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
365 ;; immediately after a start tag or immediately before an end tag.
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
366 (set (make-local-variable 'paragraph-separate) "[ \t]*$\\|\
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
367 \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
368 (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
369 \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
370 (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
371 (set (make-local-variable 'comment-start) "<!-- ")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
372 (set (make-local-variable 'comment-end) " -->")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
373 (set (make-local-variable 'comment-indent-function) 'sgml-comment-indent)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
374 (set (make-local-variable 'skeleton-transformation) sgml-transformation)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
375 (set (make-local-variable 'skeleton-further-elements)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
376 '((completion-ignore-case t)))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
377 (set (make-local-variable 'skeleton-end-hook)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
378 (lambda ()
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
379 (or (eolp)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
380 (not (or (eq v2 '\n) (eq (car-safe v2) '\n)))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
381 (newline-and-indent))))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
382 (set (make-local-variable 'font-lock-defaults)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
383 '((sgml-font-lock-keywords
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
384 sgml-font-lock-keywords-1
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
385 sgml-font-lock-keywords-2)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
386 nil t nil nil
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
387 (font-lock-syntactic-keywords
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
388 . sgml-font-lock-syntactic-keywords)))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
389 (set (make-local-variable 'facemenu-add-face-function)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
390 'sgml-mode-facemenu-add-face-function)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
391 ;; `sgml-xml' not customized -- guess
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
392 (unless (get 'sgml-xml 'saved-value) (sgml-xml-guess))
36609
8e1755c3dd2b (sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 27683
diff changeset
393 ;; This will allow existing comments within declarations to be
8e1755c3dd2b (sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 27683
diff changeset
394 ;; recognized.
8e1755c3dd2b (sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 27683
diff changeset
395 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
396 (set (make-local-variable 'comment-end-skip) "[ \t]*--\\([ \t\n]*>\\)?"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
397
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
398
17433
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
399 (defun sgml-mode-facemenu-add-face-function (face end)
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
400 (if (setq face (cdr (assq face sgml-face-tag-alist)))
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
401 (progn
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
402 (setq face (funcall skeleton-transformation face))
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
403 (setq facemenu-end-add-face (concat "</" face ">"))
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
404 (concat "<" face ">"))
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38108
diff changeset
405 (error "Face not configured for %s mode" mode-name)))
17433
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
406
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
407
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
408 ;;;###autoload
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
409 (define-derived-mode sgml-mode text-mode "SGML"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
410 "Major mode for editing SGML documents.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
411 Makes > match <. Makes / blink matching /.
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
412 Keys <, &, SPC within <>, \" and ' can be electric depending on
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
413 `sgml-quick-keys'.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
414
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
415 An argument of N to a tag-inserting command means to wrap it around
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
416 the next N words. In Transient Mark mode, when the mark is active,
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
417 N defaults to -1, which means to wrap it around the current region.
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
418
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
419 If you like upcased tags, put (setq sgml-transformation 'upcase) in
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
420 your `.emacs' file.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
421
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
422 Use \\[sgml-validate] to validate your document with an SGML parser.
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
423
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
424 Do \\[describe-variable] sgml- SPC to see available variables.
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
425 Do \\[describe-key] on the following bindings to discover what they do.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
426 \\{sgml-mode-map}"
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
427 (sgml-mode-common)
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
428 (when sgml-xml (setq mode-name "XML"))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
429 ;; Set `imenu-generic-expression' here, rather than in `sgml-mode-common',
20394
dad8223e709d (sgml-mode): Set imenu-generic-expression.
Karl Heuer <kwzh@gnu.org>
parents: 19483
diff changeset
430 ;; because this definition probably is not useful in HTML mode.
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
431 (set (make-local-variable 'imenu-generic-expression)
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
432 "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\([A-Za-z][-A-Za-z.0-9]*\\)"))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
433
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
434
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
435 (defun sgml-comment-indent ()
36609
8e1755c3dd2b (sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 27683
diff changeset
436 (if (looking-at "--") comment-column 0))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
437
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
438
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
439
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
440 (defun sgml-slash (arg)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
441 "Insert `/' and display any previous matching `/'.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
442 Two `/'s are treated as matching if the first `/' ends a net-enabling
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
443 start tag, and the second `/' is the corresponding null end tag."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
444 (interactive "p")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
445 (insert-char ?/ arg)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
446 (if (> arg 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
447 (let ((oldpos (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
448 (blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
449 (level 0))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
450 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
451 (save-restriction
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
452 (if sgml-slash-distance
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
453 (narrow-to-region (max (point-min)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
454 (- (point) sgml-slash-distance))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
455 oldpos))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
456 (if (and (re-search-backward sgml-start-tag-regex (point-min) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
457 (eq (match-end 0) (1- oldpos)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
458 ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
459 (goto-char (1- oldpos))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
460 (while (and (not blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
461 (search-backward "/" (point-min) t))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
462 (let ((tagend (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
463 (if (re-search-backward sgml-start-tag-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
464 (point-min) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
465 (match-end 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
466 nil))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
467 (if (eq tagend (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
468 (if (eq level 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
469 (setq blinkpos (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
470 (setq level (1- level)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
471 (setq level (1+ level)))))))
40343
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
472 (when blinkpos
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
473 (goto-char blinkpos)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
474 (if (pos-visible-in-window-p)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
475 (sit-for 1)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
476 (message "Matches %s"
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
477 (buffer-substring (line-beginning-position)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
478 (1+ blinkpos)))))))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
479
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
480
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
481 (defun sgml-name-char (&optional char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
482 "Insert a symbolic character name according to `sgml-char-names'.
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
483 Non-ASCII chars may be inserted either with the meta key, as in M-SPC for
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
484 no-break space or M-- for a soft hyphen; or via an input method or
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
485 encoded keyboard operation."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
486 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
487 (insert ?&)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
488 (or char
17500
e8d7c7e2acab (sgml-name-char): Ask user with a prompt.
Richard M. Stallman <rms@gnu.org>
parents: 17491
diff changeset
489 (setq char (read-quoted-char "Enter char or octal number")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
490 (delete-backward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
491 (insert char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
492 (undo-boundary)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
493 (delete-backward-char 1)
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
494 (cond
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
495 ((< char 256)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
496 (insert ?&
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
497 (or (aref sgml-char-names char)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
498 (format "#%d" char))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
499 ?\;))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
500 ((aref sgml-char-names-table char)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
501 (insert ?& (aref sgml-char-names-table char) ?\;))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
502 ((memq (char-charset char) '(mule-unicode-0100-24ff
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
503 mule-unicode-2500-33ff
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
504 mule-unicode-e000-ffff))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
505 (insert (format "&#%d;" (encode-char char 'ucs))))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
506 (t
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
507 (insert char))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
508
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
509 (defun sgml-name-self ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
510 "Insert a symbolic character name according to `sgml-char-names'."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
511 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
512 (sgml-name-char last-command-char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
513
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
514 (defun sgml-maybe-name-self ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
515 "Insert a symbolic character name according to `sgml-char-names'."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
516 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
517 (if sgml-name-8bit-mode
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
518 (let ((mc last-command-char))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
519 (if (< mc 256)
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
520 (setq mc (unibyte-char-to-multibyte mc)))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
521 (or mc (setq mc last-command-char))
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
522 (sgml-name-char mc))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
523 (self-insert-command 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
524
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
525 (defun sgml-name-8bit-mode ()
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
526 "Toggle whether to insert named entities instead of non-ASCII characters."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
527 (interactive)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
528 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
40176
744190a4880c (sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents: 39616
diff changeset
529 (message "sgml name entity mode is now %s"
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
530 (if sgml-name-8bit-mode "ON" "OFF")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
531
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
532 ;; When an element of a skeleton is a string "str", it is passed
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
533 ;; through skeleton-transformation and inserted. If "str" is to be
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
534 ;; inserted literally, one should obtain it as the return value of a
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
535 ;; function, e.g. (identity "str").
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
536
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
537 (define-skeleton sgml-tag
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
538 "Prompt for a tag and insert it, optionally with attributes.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
539 Completion and configuration are done according to `sgml-tag-alist'.
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
540 If you like tags and attributes in uppercase do \\[set-variable]
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
541 skeleton-transformation RET upcase RET, or put this in your `.emacs':
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
542 (setq sgml-transformation 'upcase)"
37252
5db39c2eba1e Add unknown maintainer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36609
diff changeset
543 (funcall skeleton-transformation
5db39c2eba1e Add unknown maintainer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36609
diff changeset
544 (completing-read "Tag: " sgml-tag-alist))
36609
8e1755c3dd2b (sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 27683
diff changeset
545 ?< str |
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
546 (("") -1 '(undo-boundary) (identity "&lt;")) | ; see comment above
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
547 `(("") '(setq v2 (sgml-attributes ,str t)) ?>
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
548 (cond
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
549 ((string= "![" ,str)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
550 (backward-char)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
551 '(("") " [ " _ " ]]"))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
552 ((and (eq v2 t) sgml-xml (member ,str sgml-empty-tags))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
553 '(("") -1 "/>"))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
554 ((or (and (eq v2 t) (not sgml-xml)) (string-match "^[/!?]" ,str))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
555 nil)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
556 ((symbolp v2)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
557 ;; Make sure we don't fall into an infinite loop.
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
558 ;; For xhtml's `tr' tag, we should maybe use \n instead.
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
559 (if (eq v2 t) (setq v2 nil))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
560 ;; We use `identity' to prevent skeleton from passing
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
561 ;; `str' through skeleton-transformation a second time.
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
562 '(("") v2 _ v2 "</" (identity ',str) ?>))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
563 ((eq (car v2) t)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
564 (cons '("") (cdr v2)))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
565 (t
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
566 (append '(("") (car v2))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
567 (cdr v2)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
568 '(resume: (car v2) _ "</" (identity ',str) ?>))))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
569
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
570 (autoload 'skeleton-read "skeleton")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
571
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
572 (defun sgml-attributes (tag &optional quiet)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
573 "When at top level of a tag, interactively insert attributes.
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
574
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
575 Completion and configuration of TAG are done according to `sgml-tag-alist'.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
576 If QUIET, do not print a message when there are no attributes for TAG."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
577 (interactive (list (save-excursion (sgml-beginning-of-tag t))))
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
578 (or (stringp tag) (error "Wrong context for adding attribute"))
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
579 (if tag
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
580 (let ((completion-ignore-case t)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
581 (alist (cdr (assoc (downcase tag) sgml-tag-alist)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
582 car attribute i)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
583 (if (or (symbolp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
584 (symbolp (car (car alist))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
585 (setq car (car alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
586 alist (cdr alist)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
587 (or quiet
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
588 (message "No attributes configured."))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
589 (if (stringp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
590 (progn
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
591 (insert (if (eq (preceding-char) ? ) "" ? )
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
592 (funcall skeleton-transformation (car alist)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
593 (sgml-value alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
594 (setq i (length alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
595 (while (> i 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
596 (insert ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
597 (insert (funcall skeleton-transformation
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
598 (setq attribute
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
599 (skeleton-read '(completing-read
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
600 "Attribute: "
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
601 alist)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
602 (if (string= "" attribute)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
603 (setq i 0)
20922
3ae81bc17b19 (sgml-mode-common): Downcase key for
Dave Love <fx@gnu.org>
parents: 20394
diff changeset
604 (sgml-value (assoc (downcase attribute) alist))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
605 (setq i (1- i))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
606 (if (eq (preceding-char) ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
607 (delete-backward-char 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
608 car)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
609
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
610 (defun sgml-auto-attributes (arg)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
611 "Self insert the character typed; at top level of tag, prompt for attributes.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
612 With prefix argument, only self insert."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
613 (interactive "*P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
614 (let ((point (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
615 tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
616 (if (or arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
617 (not sgml-tag-alist) ; no message when nothing configured
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
618 (symbolp (setq tag (save-excursion (sgml-beginning-of-tag t))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
619 (eq (aref tag 0) ?/))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
620 (self-insert-command (prefix-numeric-value arg))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
621 (sgml-attributes tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
622 (setq last-command-char ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
623 (or (> (point) point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
624 (self-insert-command 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
625
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
626
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
627 (defun sgml-tag-help (&optional tag)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
628 "Display description of tag TAG. If TAG is omitted, use the tag at point."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
629 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
630 (or tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
631 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
632 (if (eq (following-char) ?<)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
633 (forward-char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
634 (setq tag (sgml-beginning-of-tag))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
635 (or (stringp tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
636 (error "No tag selected"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
637 (setq tag (downcase tag))
14328
5d0e329a44d8 (sgml-tag-help): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14270
diff changeset
638 (message "%s"
20922
3ae81bc17b19 (sgml-mode-common): Downcase key for
Dave Love <fx@gnu.org>
parents: 20394
diff changeset
639 (or (cdr (assoc (downcase tag) sgml-tag-help))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
640 (and (eq (aref tag 0) ?/)
20922
3ae81bc17b19 (sgml-mode-common): Downcase key for
Dave Love <fx@gnu.org>
parents: 20394
diff changeset
641 (cdr (assoc (downcase (substring tag 1)) sgml-tag-help)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
642 "No description available")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
643
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
644
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
645 (defun sgml-maybe-end-tag ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
646 "Name self unless in position to end a tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
647 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
648 (or (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
649 (save-excursion (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
650 (error
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
651 (sgml-name-self)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
652 t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
653 (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
654 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
655 (save-excursion (up-list 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
656 (sgml-name-self))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
657 (error (self-insert-command 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
658
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
659
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
660 (defun sgml-skip-tag-backward (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
661 "Skip to beginning of tag or matching opening tag if present.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
662 With prefix argument ARG, repeat this ARG times."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
663 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
664 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
665 (search-backward "<" nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
666 (if (looking-at "</\\([^ \n\t>]+\\)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
667 ;; end tag, skip any nested pairs
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
668 (let ((case-fold-search t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
669 (re (concat "</?" (regexp-quote (match-string 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
670 (while (and (re-search-backward re nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
671 (eq (char-after (1+ (point))) ?/))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
672 (forward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
673 (sgml-skip-tag-backward 1))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
674 (setq arg (1- arg))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
675
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
676 (defun sgml-skip-tag-forward (arg &optional return)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
677 "Skip to end of tag or matching closing tag if present.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
678 With prefix argument ARG, repeat this ARG times.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
679 Return t iff after a closing tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
680 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
681 (setq return t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
682 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
683 (skip-chars-forward "^<>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
684 (if (eq (following-char) ?>)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
685 (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
686 (if (looking-at "<\\([^/ \n\t>]+\\)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
687 ;; start tag, skip any nested same pairs _and_ closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
688 (let ((case-fold-search t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
689 (re (concat "</?" (regexp-quote (match-string 1))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
690 point close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
691 (forward-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
692 (setq point (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
693 (while (and (re-search-forward re nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
694 (not (setq close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
695 (eq (char-after (1+ (match-beginning 0))) ?/)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
696 (not (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
697 (sgml-skip-tag-forward 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
698 (setq close nil))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
699 (if close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
700 (up-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
701 (goto-char point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
702 (setq return)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
703 (forward-list 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
704 (setq arg (1- arg)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
705 return)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
706
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
707 (defun sgml-delete-tag (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
708 "Delete tag on or after cursor, and matching closing or opening tag.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
709 With prefix argument ARG, repeat this ARG times."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
710 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
711 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
712 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
713 (let* (close open)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
714 (if (looking-at "[ \t\n]*<")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
715 ;; just before tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
716 (if (eq (char-after (match-end 0)) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
717 ;; closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
718 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
719 (setq close (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
720 (goto-char (match-end 0))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
721 ;; on tag?
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
722 (or (save-excursion (setq close (sgml-beginning-of-tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
723 close (and (stringp close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
724 (eq (aref close 0) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
725 (point))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
726 ;; not on closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
727 (let ((point (point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
728 (sgml-skip-tag-backward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
729 (if (or (not (eq (following-char) ?<))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
730 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
731 (forward-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
732 (<= (point) point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
733 (error "Not on or before tag")))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
734 (if close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
735 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
736 (sgml-skip-tag-backward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
737 (setq open (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
738 (goto-char close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
739 (kill-sexp 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
740 (setq open (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
741 (sgml-skip-tag-forward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
742 (backward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
743 (forward-char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
744 (if (eq (aref (sgml-beginning-of-tag) 0) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
745 (kill-sexp 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
746 (goto-char open)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
747 (kill-sexp 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
748 (setq arg (1- arg))))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
749
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
750 ;; Put read-only last to enable setting this even when read-only enabled.
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
751 (or (get 'sgml-tag 'invisible)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
752 (setplist 'sgml-tag
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
753 (append '(invisible t
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
754 intangible t
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
755 point-entered sgml-point-entered
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
756 rear-nonsticky t
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
757 read-only t)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
758 (symbol-plist 'sgml-tag))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
759
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
760 (defun sgml-tags-invisible (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
761 "Toggle visibility of existing tags."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
762 (interactive "P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
763 (let ((modified (buffer-modified-p))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
764 (inhibit-read-only t)
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
765 (inhibit-modification-hooks t)
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
766 ;; Avoid spurious the `file-locked' checks.
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
767 (buffer-file-name nil)
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
768 ;; This is needed in case font lock gets called,
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
769 ;; since it moves point and might call sgml-point-entered.
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
770 ;; How could it get called? -stef
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
771 (inhibit-point-motion-hooks t)
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
772 string)
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
773 (unwind-protect
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
774 (save-excursion
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
775 (goto-char (point-min))
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
776 (if (set (make-local-variable 'sgml-tags-invisible)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
777 (if arg
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
778 (>= (prefix-numeric-value arg) 0)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
779 (not sgml-tags-invisible)))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
780 (while (re-search-forward "<\\([!/?A-Za-z][-A-Za-z0-9]*\\)"
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
781 nil t)
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
782 (setq string
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
783 (cdr (assq (intern-soft (downcase (match-string 1)))
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
784 sgml-display-text)))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
785 (goto-char (match-beginning 0))
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
786 (and (stringp string)
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
787 (not (overlays-at (point)))
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
788 (let ((ol (make-overlay (point) (match-beginning 1))))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
789 (overlay-put ol 'before-string string)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
790 (overlay-put ol 'sgml-tag t)))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
791 (put-text-property (point)
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
792 (progn (forward-list) (point))
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
793 'category 'sgml-tag))
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
794 (let ((pos (point-min)))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
795 (while (< (setq pos (next-overlay-change pos)) (point-max))
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
796 (dolist (ol (overlays-at pos))
40393
591afd36f0b3 (sgml-tags-invisible): Typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40392
diff changeset
797 (if (overlay-get ol 'sgml-tag)
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
798 (delete-overlay ol)))))
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
799 (remove-text-properties (point-min) (point-max) '(category nil))))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
800 (restore-buffer-modified-p modified))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
801 (run-hooks 'sgml-tags-invisible-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
802 (message "")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
803
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
804 (defun sgml-point-entered (x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
805 ;; Show preceding or following hidden tag, depending of cursor direction.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
806 (let ((inhibit-point-motion-hooks t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
807 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
808 (message "Invisible tag: %s"
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
809 ;; Strip properties, otherwise, the text is invisible.
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
810 (buffer-substring-no-properties
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
811 (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
812 (if (or (and (> x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
813 (not (eq (following-char) ?<)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
814 (and (< x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
815 (eq (preceding-char) ?>)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
816 (backward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
817 (forward-list)))))))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
818
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
819 (autoload 'compile-internal "compile")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
820
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
821 (defun sgml-validate (command)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
822 "Validate an SGML document.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
823 Runs COMMAND, a shell command, in a separate process asynchronously
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
824 with output going to the buffer `*compilation*'.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
825 You can then use the command \\[next-error] to find the next error message
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
826 and move to the line in the SGML document that caused it."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
827 (interactive
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
828 (list (read-string "Validate command: "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
829 (or sgml-saved-validate-command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
830 (concat sgml-validate-command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
831 " "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
832 (let ((name (buffer-file-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
833 (and name
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
834 (file-name-nondirectory name))))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
835 (setq sgml-saved-validate-command command)
23970
d1d08f461c9c (sgml-validate): Ask whether to save only
Richard M. Stallman <rms@gnu.org>
parents: 23869
diff changeset
836 (save-some-buffers (not compilation-ask-about-save) nil)
3121
8cf203c42bee (sgml-validate): compile1 renamed to compile-internal.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
837 (compile-internal command "No more errors"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
838
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
839
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
840 (defun sgml-beginning-of-tag (&optional top-level)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
841 "Skip to beginning of tag and return its name.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
842 If this can't be done, return t."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
843 (or (if top-level
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
844 (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
845 (up-list -1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
846 (error t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
847 (>= (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
848 (if (search-backward "<" nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
849 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
850 (forward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
851 (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
852 0)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
853 (if (looking-at "<[!?/]?[[A-Za-z][A-Za-z0-9]*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
854 (buffer-substring-no-properties
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
855 (1+ (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
856 (match-end 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
857 t)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
858
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
859 (defun sgml-value (alist)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
860 "Interactively insert value taken from attributerule ALIST.
40343
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
861 See `sgml-tag-alist' for info about attribute rules."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
862 (setq alist (cdr alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
863 (if (stringp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
864 (insert "=\"" (car alist) ?\")
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
865 (if (and (eq (car alist) t) (not sgml-xml))
40343
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
866 (when (cdr alist)
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
867 (insert "=\"")
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
868 (setq alist (skeleton-read '(completing-read "Value: " (cdr alist))))
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
869 (if (string< "" alist)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
870 (insert alist ?\")
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
871 (delete-backward-char 2)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
872 (insert "=\"")
40343
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
873 (when alist
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
874 (insert (skeleton-read '(completing-read "Value: " alist))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
875 (insert ?\"))))
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
876
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
877 (defun sgml-quote (start end &optional unquotep)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
878 "Quote SGML text in region.
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
879 With prefix argument, unquote the region."
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
880 (interactive "r\np")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
881 (if (< start end)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
882 (goto-char start)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
883 (goto-char end)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
884 (setq end start))
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
885 (if unquotep
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
886 (while (re-search-forward "&\\(amp\\|\\(l\\|\\(g\\)\\)t\\);" end t)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
887 (replace-match (if (match-end 3) ">" (if (match-end 2) "<" "&"))))
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
888 (while (re-search-forward "[&<>]" end t)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
889 (replace-match (cdr (assq (char-before) '((?& . "&amp;")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
890 (?< . "&lt;")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
891 (?> . "&gt;"))))))))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
892
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
893
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
894 ;;; HTML mode
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
895
25175
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
896 (defcustom html-mode-hook nil
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
897 "Hook run by command `html-mode'.
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
898 `text-mode-hook' and `sgml-mode-hook' are run first."
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
899 :group 'sgml
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
900 :type 'hook
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
901 :options '(html-autoview-mode))
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
902
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
903 (defvar html-quick-keys sgml-quick-keys
14377
2e6bd1a2712a Whitespace fix.
Richard M. Stallman <rms@gnu.org>
parents: 14328
diff changeset
904 "Use C-c X combinations for quick insertion of frequent tags when non-nil.
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
905 This defaults to `sgml-quick-keys'.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
906 This takes effect when first loading the library.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
907
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
908 (defvar html-mode-map
37252
5db39c2eba1e Add unknown maintainer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36609
diff changeset
909 (let ((map (make-sparse-keymap))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
910 (menu-map (make-sparse-keymap "HTML")))
37252
5db39c2eba1e Add unknown maintainer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36609
diff changeset
911 (set-keymap-parent map sgml-mode-map)
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
912 (define-key map "\C-c6" 'html-headline-6)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
913 (define-key map "\C-c5" 'html-headline-5)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
914 (define-key map "\C-c4" 'html-headline-4)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
915 (define-key map "\C-c3" 'html-headline-3)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
916 (define-key map "\C-c2" 'html-headline-2)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
917 (define-key map "\C-c1" 'html-headline-1)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
918 (define-key map "\C-c\r" 'html-paragraph)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
919 (define-key map "\C-c\n" 'html-line)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
920 (define-key map "\C-c\C-c-" 'html-horizontal-rule)
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
921 (define-key map "\C-c\C-co" 'html-ordered-list)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
922 (define-key map "\C-c\C-cu" 'html-unordered-list)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
923 (define-key map "\C-c\C-cr" 'html-radio-buttons)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
924 (define-key map "\C-c\C-cc" 'html-checkboxes)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
925 (define-key map "\C-c\C-cl" 'html-list-item)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
926 (define-key map "\C-c\C-ch" 'html-href-anchor)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
927 (define-key map "\C-c\C-cn" 'html-name-anchor)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
928 (define-key map "\C-c\C-ci" 'html-image)
40343
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
929 (when html-quick-keys
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
930 (define-key map "\C-c-" 'html-horizontal-rule)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
931 (define-key map "\C-co" 'html-ordered-list)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
932 (define-key map "\C-cu" 'html-unordered-list)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
933 (define-key map "\C-cr" 'html-radio-buttons)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
934 (define-key map "\C-cc" 'html-checkboxes)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
935 (define-key map "\C-cl" 'html-list-item)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
936 (define-key map "\C-ch" 'html-href-anchor)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
937 (define-key map "\C-cn" 'html-name-anchor)
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
938 (define-key map "\C-ci" 'html-image))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
939 (define-key map "\C-c\C-s" 'html-autoview-mode)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
940 (define-key map "\C-c\C-v" 'browse-url-of-buffer)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
941 (define-key map [menu-bar html] (cons "HTML" menu-map))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
942 (define-key menu-map [html-autoview-mode]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
943 '("Toggle Autoviewing" . html-autoview-mode))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
944 (define-key menu-map [browse-url-of-buffer]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
945 '("View Buffer Contents" . browse-url-of-buffer))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
946 (define-key menu-map [nil] '("--"))
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
947 ;;(define-key menu-map "6" '("Heading 6" . html-headline-6))
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
948 ;;(define-key menu-map "5" '("Heading 5" . html-headline-5))
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
949 ;;(define-key menu-map "4" '("Heading 4" . html-headline-4))
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
950 (define-key menu-map "3" '("Heading 3" . html-headline-3))
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
951 (define-key menu-map "2" '("Heading 2" . html-headline-2))
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
952 (define-key menu-map "1" '("Heading 1" . html-headline-1))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
953 (define-key menu-map "l" '("Radio Buttons" . html-radio-buttons))
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
954 (define-key menu-map "c" '("Checkboxes" . html-checkboxes))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
955 (define-key menu-map "l" '("List Item" . html-list-item))
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
956 (define-key menu-map "u" '("Unordered List" . html-unordered-list))
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
957 (define-key menu-map "o" '("Ordered List" . html-ordered-list))
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
958 (define-key menu-map "-" '("Horizontal Rule" . html-horizontal-rule))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
959 (define-key menu-map "\n" '("Line Break" . html-line))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
960 (define-key menu-map "\r" '("Paragraph" . html-paragraph))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
961 (define-key menu-map "i" '("Image" . html-image))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
962 (define-key menu-map "h" '("Href Anchor" . html-href-anchor))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
963 (define-key menu-map "n" '("Name Anchor" . html-name-anchor))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
964 map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
965 "Keymap for commands for use in HTML mode.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
966
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
967
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
968 (defvar html-face-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
969 '((bold . "b")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
970 (italic . "i")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
971 (underline . "u")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
972 (modeline . "rev"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
973 "Value of `sgml-face-tag-alist' for HTML mode.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
974
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
975 (defvar html-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
976 '(("b" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
977 ("big" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
978 ("blink" . highlight)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
979 ("cite" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
980 ("em" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
981 ("h1" bold underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
982 ("h2" bold-italic underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
983 ("h3" italic underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
984 ("h4" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
985 ("h5" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
986 ("h6" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
987 ("i" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
988 ("rev" . modeline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
989 ("s" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
990 ("small" . default)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
991 ("strong" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
992 ("title" bold underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
993 ("tt" . default)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
994 ("u" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
995 ("var" . italic))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
996 "Value of `sgml-tag-face-alist' for HTML mode.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
997
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
998
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
999 (defvar html-display-text
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1000 '((img . "[/]")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1001 (hr . "----------")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1002 (li . "o "))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1003 "Value of `sgml-display-text' for HTML mode.")
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1004
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1005
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1006 ;; should code exactly HTML 3 here when that is finished
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1007 (defvar html-tag-alist
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1008 (let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7")))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1009 (1-9 `(,@1-7 ("8") ("9")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1010 (align '(("align" ("left") ("center") ("right"))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1011 (valign '(("top") ("middle") ("bottom") ("baseline")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1012 (rel '(("next") ("previous") ("parent") ("subdocument") ("made")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1013 (href '("href" ("ftp:") ("file:") ("finger:") ("gopher:") ("http:")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1014 ("mailto:") ("news:") ("rlogin:") ("telnet:") ("tn3270:")
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1015 ("wais:") ("/cgi-bin/")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1016 (name '("name"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1017 (link `(,href
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1018 ("rel" ,@rel)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1019 ("rev" ,@rel)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1020 ("title")))
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1021 (list '((nil \n ("List item: " "<li>" str
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1022 (if sgml-xml "</li>") \n))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1023 (cell `(t
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1024 ,@align
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1025 ("valign" ,@valign)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1026 ("colspan" ,@1-9)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1027 ("rowspan" ,@1-9)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1028 ("nowrap" t))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1029 ;; put ,-expressions first, else byte-compile chokes (as of V19.29)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1030 ;; and like this it's more efficient anyway
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1031 `(("a" ,name ,@link)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1032 ("base" t ,@href)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1033 ("dir" ,@list)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1034 ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7)
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1035 ("form" (\n _ \n "<input type=\"submit\" value=\"\""
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1036 (if sgml-xml "/>" ">"))
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1037 ("action" ,@(cdr href)) ("method" ("get") ("post")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1038 ("h1" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1039 ("h2" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1040 ("h3" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1041 ("h4" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1042 ("h5" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1043 ("h6" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1044 ("hr" t ("size" ,@1-9) ("width") ("noshade" t) ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1045 ("img" t ("align" ,@valign ("texttop") ("absmiddle") ("absbottom"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1046 ("src") ("alt") ("width" "1") ("height" "1")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1047 ("border" "1") ("vspace" "1") ("hspace" "1") ("ismap" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1048 ("input" t ("size" ,@1-9) ("maxlength" ,@1-9) ("checked" t) ,name
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1049 ("type" ("text") ("password") ("checkbox") ("radio")
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1050 ("submit") ("reset"))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1051 ("value"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1052 ("link" t ,@link)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1053 ("menu" ,@list)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1054 ("ol" ,@list ("type" ("A") ("a") ("I") ("i") ("1")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1055 ("p" t ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1056 ("select" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1057 ("Text: "
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1058 "<option>" str (if sgml-xml "</option>") \n))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1059 ,name ("size" ,@1-9) ("multiple" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1060 ("table" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1061 ((completing-read "Cell kind: " '(("td") ("th"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1062 nil t "t")
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1063 "<tr><" str ?> _
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1064 (if sgml-xml (concat "<" str "></tr>")) \n))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1065 ("border" t ,@1-9) ("width" "10") ("cellpadding"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1066 ("td" ,@cell)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1067 ("textarea" ,name ("rows" ,@1-9) ("cols" ,@1-9))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1068 ("th" ,@cell)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1069 ("ul" ,@list ("type" ("disc") ("circle") ("square")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1070
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1071 ,@sgml-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1072
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1073 ("abbrev")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1074 ("acronym")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1075 ("address")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1076 ("array" (nil \n
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1077 ("Item: " "<item>" str (if sgml-xml "</item>") \n))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1078 "align")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1079 ("au")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1080 ("b")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1081 ("big")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1082 ("blink")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1083 ("blockquote" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1084 ("body" \n ("background" ".gif") ("bgcolor" "#") ("text" "#")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1085 ("link" "#") ("alink" "#") ("vlink" "#"))
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1086 ("box" (nil _ "<over>" _ (if sgml-xml "</over>")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1087 ("br" t ("clear" ("left") ("right")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1088 ("caption" ("valign" ("top") ("bottom")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1089 ("center" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1090 ("cite")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1091 ("code" \n)
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1092 ("dd" ,(not sgml-xml))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1093 ("del")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1094 ("dfn")
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1095 ("div")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1096 ("dl" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1097 ( "Term: "
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1098 "<dt>" str (if sgml-xml "</dt>")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1099 "<dd>" _ (if sgml-xml "</dd>") \n)))
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1100 ("dt" (t _ (if sgml-xml "</dt>")
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1101 "<dd>" (if sgml-xml "</dd>") \n))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1102 ("em")
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1103 ;("fn" "id" "fn") ; ???
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1104 ("head" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1105 ("html" (\n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1106 "<head>\n"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1107 "<title>" (setq str (read-input "Title: ")) "</title>\n"
24413
e2c5b1571392 (html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents: 23970
diff changeset
1108 "</head>\n"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1109 "<body>\n<h1>" str "</h1>\n" _
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1110 "\n<address>\n<a href=\"mailto:"
14518
5b2bc060c90d (html-tag-alist): within the <ADDRESS> tag
Richard M. Stallman <rms@gnu.org>
parents: 14377
diff changeset
1111 user-mail-address
24413
e2c5b1571392 (html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents: 23970
diff changeset
1112 "\">" (user-full-name) "</a>\n</address>\n"
e2c5b1571392 (html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents: 23970
diff changeset
1113 "</body>"
e2c5b1571392 (html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents: 23970
diff changeset
1114 ))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1115 ("i")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1116 ("ins")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1117 ("isindex" t ("action") ("prompt"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1118 ("kbd")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1119 ("lang")
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1120 ("li" ,(not sgml-xml))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1121 ("math" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1122 ("nobr")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1123 ("option" t ("value") ("label") ("selected" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1124 ("over" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1125 ("person")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1126 ("pre" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1127 ("q")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1128 ("rev")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1129 ("s")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1130 ("samp")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1131 ("small")
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1132 ("span" nil
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1133 ("class"
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1134 ("builtin")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1135 ("comment")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1136 ("constant")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1137 ("function-name")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1138 ("keyword")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1139 ("string")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1140 ("type")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1141 ("variable-name")
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1142 ("warning")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1143 ("strong")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1144 ("sub")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1145 ("sup")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1146 ("title")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1147 ("tr" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1148 ("tt")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1149 ("u")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1150 ("var")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1151 ("wbr" t)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1152 "*Value of `sgml-tag-alist' for HTML mode.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1153
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1154 (defvar html-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1155 `(,@sgml-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1156 ("a" . "Anchor of point or link elsewhere")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1157 ("abbrev" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1158 ("acronym" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1159 ("address" . "Formatted mail address")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1160 ("array" . "Math array")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1161 ("au" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1162 ("b" . "Bold face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1163 ("base" . "Base address for URLs")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1164 ("big" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1165 ("blink" . "Blinking text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1166 ("blockquote" . "Indented quotation")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1167 ("body" . "Document body")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1168 ("box" . "Math fraction")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1169 ("br" . "Line break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1170 ("caption" . "Table caption")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1171 ("center" . "Centered text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1172 ("changed" . "Change bars")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1173 ("cite" . "Citation of a document")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1174 ("code" . "Formatted source code")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1175 ("dd" . "Definition of term")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1176 ("del" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1177 ("dfn" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1178 ("dir" . "Directory list (obsolete)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1179 ("dl" . "Definition list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1180 ("dt" . "Term to be definined")
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1181 ("em" . "Emphasised")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1182 ("embed" . "Embedded data in foreign format")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1183 ("fig" . "Figure")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1184 ("figa" . "Figure anchor")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1185 ("figd" . "Figure description")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1186 ("figt" . "Figure text")
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1187 ;("fn" . "?") ; ???
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1188 ("font" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1189 ("form" . "Form with input fields")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1190 ("group" . "Document grouping")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1191 ("h1" . "Most important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1192 ("h2" . "Important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1193 ("h3" . "Section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1194 ("h4" . "Minor section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1195 ("h5" . "Unimportant section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1196 ("h6" . "Least important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1197 ("head" . "Document header")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1198 ("hr" . "Horizontal rule")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1199 ("html" . "HTML Document")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1200 ("i" . "Italic face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1201 ("img" . "Graphic image")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1202 ("input" . "Form input field")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1203 ("ins" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1204 ("isindex" . "Input field for index search")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1205 ("kbd" . "Keybard example face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1206 ("lang" . "Natural language")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1207 ("li" . "List item")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1208 ("link" . "Link relationship")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1209 ("math" . "Math formula")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1210 ("menu" . "Menu list (obsolete)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1211 ("mh" . "Form mail header")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1212 ("nextid" . "Allocate new id")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1213 ("nobr" . "Text without line break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1214 ("ol" . "Ordered list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1215 ("option" . "Selection list item")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1216 ("over" . "Math fraction rule")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1217 ("p" . "Paragraph start")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1218 ("panel" . "Floating panel")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1219 ("person" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1220 ("pre" . "Preformatted fixed width text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1221 ("q" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1222 ("rev" . "Reverse video")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1223 ("s" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1224 ("samp" . "Sample text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1225 ("select" . "Selection list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1226 ("small" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1227 ("sp" . "Nobreak space")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1228 ("strong" . "Standout text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1229 ("sub" . "Subscript")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1230 ("sup" . "Superscript")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1231 ("table" . "Table with rows and columns")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1232 ("tb" . "Table vertical break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1233 ("td" . "Table data cell")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1234 ("textarea" . "Form multiline edit area")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1235 ("th" . "Table header cell")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1236 ("title" . "Document title")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1237 ("tr" . "Table row separator")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1238 ("tt" . "Typewriter face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1239 ("u" . "Underlined text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1240 ("ul" . "Unordered list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1241 ("var" . "Math variable face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1242 ("wbr" . "Enable <br> within <nobr>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1243 "*Value of `sgml-tag-help' for HTML mode.")
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1244
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1245 ;;;###autoload
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1246 (define-derived-mode html-mode sgml-mode "HTML"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1247 "Major mode based on SGML mode for editing HTML documents.
23652
42bf6553a2e9 (html-mode): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 22772
diff changeset
1248 This allows inserting skeleton constructs used in hypertext documents with
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1249 completion. See below for an introduction to HTML. Use
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1250 \\[browse-url-of-buffer] to see how this comes out. See also `sgml-mode' on
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1251 which this is based.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1252
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1253 Do \\[describe-variable] html- SPC and \\[describe-variable] sgml- SPC to see available variables.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1254
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1255 To write fairly well formatted pages you only need to know few things. Most
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1256 browsers have a function to read the source code of the page being seen, so
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1257 you can imitate various tricks. Here's a very short HTML primer which you
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1258 can also view with a browser to see what happens:
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1259
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1260 <title>A Title Describing Contents</title> should be on every page. Pages can
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1261 have <h1>Very Major Headlines</h1> through <h6>Very Minor Headlines</h6>
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1262 <hr> Parts can be separated with horizontal rules.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1263
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1264 <p>Paragraphs only need an opening tag. Line breaks and multiple spaces are
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1265 ignored unless the text is <pre>preformatted.</pre> Text can be marked as
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1266 <b>bold</b>, <i>italic</i> or <u>underlined</u> using the normal M-g or
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1267 Edit/Text Properties/Face commands.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1268
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1269 Pages can have <a name=\"SOMENAME\">named points</a> and can link other points
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1270 to them with <a href=\"#SOMENAME\">see also somename</a>. In the same way <a
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1271 href=\"URL\">see also URL</a> where URL is a filename relative to current
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1272 directory, or absolute as in `http://www.cs.indiana.edu/elisp/w3/docs.html'.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1273
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1274 Images in many formats can be inlined with <img src=\"URL\">.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1275
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1276 If you mainly create your own documents, `sgml-specials' might be
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1277 interesting. But note that some HTML 2 browsers can't handle `&apos;'.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1278 To work around that, do:
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1279 (eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1280
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1281 \\{html-mode-map}"
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1282 (set (make-local-variable 'sgml-display-text) html-display-text)
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1283 (set (make-local-variable 'sgml-tag-face-alist) html-tag-face-alist)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1284 (make-local-variable 'sgml-tag-alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1285 (make-local-variable 'sgml-face-tag-alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1286 (make-local-variable 'sgml-tag-help)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1287 (make-local-variable 'outline-regexp)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1288 (make-local-variable 'outline-heading-end-regexp)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1289 (make-local-variable 'outline-level)
16914
4b79df16b939 (html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents: 16404
diff changeset
1290 (make-local-variable 'sentence-end)
4b79df16b939 (html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents: 16404
diff changeset
1291 (setq sentence-end
24463
9ef31386cb47 (html-mode): Use sentence-end-double-space when setting sentence-end.
Dave Love <fx@gnu.org>
parents: 24413
diff changeset
1292 (if sentence-end-double-space
9ef31386cb47 (html-mode): Use sentence-end-double-space when setting sentence-end.
Dave Love <fx@gnu.org>
parents: 24413
diff changeset
1293 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*"
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1294 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\|[ \t]\\)[ \t\n]*"))
22772
3dc5c3a4f1f8 (sgml-mode): Call kill-local-variables
Richard M. Stallman <rms@gnu.org>
parents: 22629
diff changeset
1295 (setq sgml-tag-alist html-tag-alist
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1296 sgml-face-tag-alist html-face-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1297 sgml-tag-help html-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1298 outline-regexp "^.*<[Hh][1-6]\\>"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1299 outline-heading-end-regexp "</[Hh][1-6]>"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1300 outline-level (lambda ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1301 (char-after (1- (match-end 0)))))
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1302 (setq imenu-create-index-function 'html-imenu-index)
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1303 (when sgml-xml (setq mode-name "XHTML"))
40392
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1304 (set (make-local-variable 'sgml-empty-tags)
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1305 '("br" "hr" "img" "input" "area" "link" "param" "col"
e4b72489cdc4 (sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40377
diff changeset
1306 "base" "meta" "basefont" "frame" "isindex" "wbr"))
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1307 ;; It's for the user to decide if it defeats it or not -stef
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1308 ;; (make-local-variable 'imenu-sort-function)
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1309 ;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose
40320
66ba1d523634 (sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 40176
diff changeset
1310 )
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1311
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1312 (defvar html-imenu-regexp
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1313 "\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1314 "*A regular expression matching a head line to be added to the menu.
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1315 The first `match-string' should be a number from 1-9.
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1316 The second `match-string' matches extra tags and is ignored.
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1317 The third `match-string' will be the used in the menu.")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1318
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1319 (defun html-imenu-index ()
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1320 "Return an table of contents for an HTML buffer for use with Imenu."
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1321 (let (toc-index)
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1322 (save-excursion
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1323 (goto-char (point-min))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1324 (while (re-search-forward html-imenu-regexp nil t)
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1325 (setq toc-index
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1326 (cons (cons (concat (make-string
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1327 (* 2 (1- (string-to-number (match-string 1))))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1328 ?\ )
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1329 (match-string 3))
40343
25129ef47b45 some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents: 40320
diff changeset
1330 (line-beginning-position))
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1331 toc-index))))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1332 (nreverse toc-index)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1333
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1334 (defun html-autoview-mode (&optional arg)
25175
d780a1dc11f2 Require outline when compiling.
Dave Love <fx@gnu.org>
parents: 25052
diff changeset
1335 "Toggle automatic viewing via `browse-url-of-buffer' upon saving buffer.
22629
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1336 With positive prefix ARG always turns viewing on, with negative ARG always off.
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1337 Can be used as a value for `html-mode-hook'."
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1338 (interactive "P")
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1339 (if (setq arg (if arg
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1340 (< (prefix-numeric-value arg) 0)
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1341 (and (boundp 'after-save-hook)
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1342 (memq 'browse-url-of-buffer after-save-hook))))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1343 (setq after-save-hook (delq 'browse-url-of-buffer after-save-hook))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1344 (add-hook 'after-save-hook 'browse-url-of-buffer nil t))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1345 (message "Autoviewing turned %s."
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1346 (if arg "off" "on")))
5d51b13e0d1f (html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents: 22319
diff changeset
1347
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1348 (define-skeleton html-href-anchor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1349 "HTML anchor tag with href attribute."
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1350 "URL: "
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1351 '(setq input "http:")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1352 "<a href=\"" str "\">" _ "</a>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1353
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1354 (define-skeleton html-name-anchor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1355 "HTML anchor tag with name attribute."
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1356 "Name: "
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1357 "<a name=\"" str "\">" _ "</a>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1358
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1359 (define-skeleton html-headline-1
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1360 "HTML level 1 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1361 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1362 "<h1>" _ "</h1>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1363
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1364 (define-skeleton html-headline-2
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1365 "HTML level 2 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1366 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1367 "<h2>" _ "</h2>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1368
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1369 (define-skeleton html-headline-3
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1370 "HTML level 3 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1371 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1372 "<h3>" _ "</h3>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1373
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1374 (define-skeleton html-headline-4
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1375 "HTML level 4 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1376 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1377 "<h4>" _ "</h4>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1378
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1379 (define-skeleton html-headline-5
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1380 "HTML level 5 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1381 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1382 "<h5>" _ "</h5>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1383
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1384 (define-skeleton html-headline-6
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1385 "HTML level 6 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1386 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1387 "<h6>" _ "</h6>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1388
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1389 (define-skeleton html-horizontal-rule
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1390 "HTML horizontal rule tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1391 nil
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1392 (if sgml-xml "<hr/>" "<hr>") \n)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1393
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1394 (define-skeleton html-image
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1395 "HTML image tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1396 nil
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1397 "<img src=\"" _ "\""
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1398 (if sgml-xml "/>" ">"))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1399
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1400 (define-skeleton html-line
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1401 "HTML line break tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1402 nil
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1403 (if sgml-xml "<br/>" "<br>") \n)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1404
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1405 (define-skeleton html-ordered-list
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1406 "HTML ordered list tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1407 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1408 "<ol>" \n
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1409 "<li>" _ (if sgml-xml "</li>") \n
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1410 "</ol>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1411
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1412 (define-skeleton html-unordered-list
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1413 "HTML unordered list tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1414 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1415 "<ul>" \n
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1416 "<li>" _ (if sgml-xml "</li>") \n
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1417 "</ul>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1418
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1419 (define-skeleton html-list-item
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1420 "HTML list item tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1421 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1422 (if (bolp) nil '\n)
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1423 "<li>" _ (if sgml-xml "</li>"))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1424
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1425 (define-skeleton html-paragraph
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1426 "HTML paragraph tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1427 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1428 (if (bolp) nil ?\n)
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1429 \n "<p>" _ (if sgml-xml "</p>"))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1430
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1431 (define-skeleton html-checkboxes
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1432 "Group of connected checkbox inputs."
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1433 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1434 '(setq v1 nil
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1435 v2 nil)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1436 ("Value: "
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1437 "<input type=\"" (identity "checkbox") ; see comment above about identity
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1438 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: ")))
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1439 "\" value=\"" str ?\"
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1440 (when (y-or-n-p "Set \"checked\" attribute? ")
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1441 (funcall skeleton-transformation " checked"))
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1442 (if sgml-xml "/>" ">")
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1443 (skeleton-read "Text: " (capitalize str))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1444 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1445 (funcall skeleton-transformation
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1446 (if sgml-xml "<br/>" "<br>"))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1447 "")))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1448 \n))
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1449
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1450 (define-skeleton html-radio-buttons
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1451 "Group of connected radio button inputs."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1452 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1453 '(setq v1 nil
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1454 v2 (cons nil nil))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1455 ("Value: "
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1456 "<input type=\"" (identity "radio") ; see comment above about identity
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1457 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: ")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1458 "\" value=\"" str ?\"
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1459 (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1460 (funcall skeleton-transformation " checked"))
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1461 (if sgml-xml "/>" ">")
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1462 (skeleton-read "Text: " (capitalize str))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1463 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
39616
13a1b8cf5135 added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents: 38431
diff changeset
1464 (funcall skeleton-transformation
40377
ea7ef845ccf3 renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents: 40350
diff changeset
1465 (if sgml-xml "<br/>" "<br>"))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1466 "")))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1467 \n))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1468
38068
e3bd229672c1 Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37252
diff changeset
1469 (provide 'sgml-mode)
38431
853c3674f20a Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38108
diff changeset
1470
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1471 ;;; sgml-mode.el ends here