annotate lisp/textmodes/sgml-mode.el @ 19483:51345fa7e08b

(sgml-mode-common): Set paragraph-start like paragraph-separate. Do match a line which is just a <...> construct after whitespac.e Set adaptive-fill-regexp to match whitespace only.
author Richard M. Stallman <rms@gnu.org>
date Sat, 23 Aug 1997 06:12:46 +0000
parents 2738b57e4704
children dad8223e709d
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
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
3 ;; Copyright (C) 1992, 1995, 1996 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>
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
6 ;; Adapted-By: ESR; Daniel.Pfeiffer@Informatik.START.dbp.de
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
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
35 (defgroup sgml nil
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
36 "SGML editing mode"
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
37 :group 'languages)
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
38
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
39 (defcustom sgml-transformation 'identity
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
40 "*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
41 :type 'function
17530
9fb83ef40566 (sgml-transformation): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17500
diff changeset
42 :group 'sgml)
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
43
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
44 (put 'sgml-transformation 'variable-interactive
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
45 "aTransformation function: ")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
46
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
47 ;; 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
48 ;; 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
49 ;; kludgy kind of tradeoff.
16404
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
50 (defvar sgml-specials '(?\")
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
51 "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
52 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
53 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
54
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
55 ?\\\" Makes \" in text start a string.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
56 ?' Makes ' in text start a string.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
57 ?- Makes -- in text start a comment.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
58
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
59 When only one of ?\\\" or ?' are included, \"'\" or '\"' as it can be found in
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
60 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
61 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
62
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
63 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
64 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
65
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
66 (defvar sgml-quick-keys nil
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
67 "Use <, >, &, SPC and `sgml-specials' keys \"electrically\" when non-nil.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
68 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
69
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
70
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
71 (defvar sgml-mode-map
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
72 (let ((map (list 'keymap (make-vector 256 nil)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
73 (menu-map (make-sparse-keymap "SGML")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
74 (define-key map "\t" 'indent-relative-maybe)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
75 (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
76 (define-key map "/" 'sgml-slash)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
77 (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
78 (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
79 (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
80 (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
81 (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
82 (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
83 (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
84 (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
85 (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
86 (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
87 (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
88 (define-key map "\C-c\C-v" 'sgml-validate)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
89 (if sgml-quick-keys
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
90 (progn
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
91 (define-key map "&" 'sgml-name-char)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
92 (define-key map "<" 'sgml-tag)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
93 (define-key map " " 'sgml-auto-attributes)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
94 (define-key map ">" 'sgml-maybe-end-tag)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
95 (if (memq ?\" sgml-specials)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
96 (define-key map "\"" 'sgml-name-self))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
97 (if (memq ?' sgml-specials)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
98 (define-key map "'" 'sgml-name-self))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
99 (let ((c 127)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
100 (map (nth 1 map)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
101 (while (< (setq c (1+ c)) 256)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
102 (aset map c 'sgml-maybe-name-self)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
103 (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
104 (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
105 (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
106 '("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
107 (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
108 '("Toggle Tag Visibility" . sgml-tags-invisible))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
109 (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
110 '("Describe Tag" . sgml-tag-help))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
111 (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
112 '("Delete Tag" . sgml-delete-tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
113 (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
114 '("Forward Tag" . sgml-skip-tag-forward))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
115 (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
116 '("Backward Tag" . sgml-skip-tag-backward))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
117 (define-key menu-map [sgml-attributes]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
118 '("Insert Attributes" . sgml-attributes))
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] '("Insert Tag" . sgml-tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
120 map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
121 "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
122
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
123
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
124 (defvar sgml-mode-syntax-table
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
125 (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
126 (modify-syntax-entry ?< "(>" table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
127 (modify-syntax-entry ?> ")<" table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
128 (if (memq ?- sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
129 (modify-syntax-entry ?- "_ 1234" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
130 (if (memq ?\" sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
131 (modify-syntax-entry ?\" "\"\"" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
132 (if (memq ?' sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
133 (modify-syntax-entry ?\' "\"'" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
134 table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
135 "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
136
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
137
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
138 (defcustom sgml-name-8bit-mode nil
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
139 "*When non-nil, insert 8 bit characters with their names."
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
140 :type 'boolean
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
141 :group 'sgml)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
142
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
143 (defvar sgml-char-names
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
144 [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
145 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
146 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
147 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
148 "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
149 "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
150 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
151 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
152 "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
153 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
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 "lsqb" nil "rsqb" "uarr" "lowbar"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
156 "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
157 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
158 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
159 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
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 nil nil nil nil nil nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
162 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
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 "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
165 "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
166 "ring" "plusmn" "sup2" "sup3" "acute" "micro" "para" "middot"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
167 "cedil" "sup1" "ordm" "raquo" "frac14" "half" "frac34" "iquest"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
168 "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
169 "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
170 "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
171 "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
172 "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
173 "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
174 "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
175 "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
176 "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
177
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
178
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
179 ;; sgmls is a free SGML parser available from
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
180 ;; ftp.uu.net:pub/text-processing/sgml
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
181 ;; 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
182 ;; The -s option suppresses output.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
183
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
184 (defcustom sgml-validate-command "sgmls -s"
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
185 "*The command to validate an SGML document.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
186 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
187 separated by a space."
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
188 :type 'string
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
189 :group 'sgml)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
190
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
191 (defvar sgml-saved-validate-command nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
192 "The command last used to validate in this buffer.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
193
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
194
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
195 ;;; I doubt that null end tags are used much for large elements,
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
196 ;;; 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
197 (defcustom sgml-slash-distance 1000
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
198 "*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
199 :type '(choice (const nil) integer)
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
200 :group 'sgml)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
201
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
202 (defconst sgml-start-tag-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
203 "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
204 "Regular expression that matches a non-empty start tag.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
205 Any terminating `>' or `/' is not matched.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
206
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
207
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
208 (defvar sgml-font-lock-keywords
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
209 '(("<\\([!?][a-z0-9]+\\)" 1 font-lock-keyword-face)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
210 ("<\\(/?[a-z0-9]+\\)" 1 font-lock-function-name-face)
16404
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
211 ("[&%][-.A-Za-z0-9]+;?" . font-lock-variable-name-face)
0cdf66e69ad8 (sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents: 15867
diff changeset
212 ("<!--[^<>]*-->" . font-lock-comment-face))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
213 "*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
214
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
215 ;; internal
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
216 (defvar sgml-font-lock-keywords-1 ())
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
217
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
218 (defvar sgml-face-tag-alist ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
219 "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
220
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
221 (defvar sgml-tag-face-alist ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
222 "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
223 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
224 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
225
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
226
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
227 (defvar sgml-display-text ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
228 "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
229
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
230 ;; internal
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
231 (defvar sgml-tags-invisible nil)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
232
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
233
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
234 (defcustom sgml-tag-alist
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
235 '(("![" ("ignore" t) ("include" t))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
236 ("!attlist")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
237 ("!doctype")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
238 ("!element")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
239 ("!entity"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
240 "*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
241 This alist is made up as
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
242
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
243 ((\"tag\" . TAGRULE)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
244 ...)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
245
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
246 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
247 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
248 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
249 attribute alist.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
250
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
251 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
252
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
253 ((\"attribute\" . ATTRIBUTERULE)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
254 ...)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
255
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
256 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
257 an optional alist of possible values."
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
258 :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
259 (repeat :tag "Tag Rule" sexp)))
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
260 :group 'sgml)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
261
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
262 (defcustom sgml-tag-help
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
263 '(("!" . "Empty declaration for comment")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
264 ("![" . "Embed declarations with parser directive")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
265 ("!attlist" . "Tag attributes declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
266 ("!doctype" . "Document type (DTD) declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
267 ("!element" . "Tag declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
268 ("!entity" . "Entity (macro) declaration"))
17432
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
269 "*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
270 :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
271 (string :tag "Description")))
5d2e0051fe39 Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 17309
diff changeset
272 :group 'sgml)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
273
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
274 (defun sgml-mode-common (sgml-tag-face-alist sgml-display-text)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
275 "Common code for setting up `sgml-mode' and derived modes.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
276 SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-1'.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
277 SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
278 varables of same name)."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
279 (kill-all-local-variables)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
280 (setq local-abbrev-table text-mode-abbrev-table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
281 (set-syntax-table sgml-mode-syntax-table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
282 (make-local-variable 'indent-line-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
283 (make-local-variable 'paragraph-start)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
284 (make-local-variable 'paragraph-separate)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
285 (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
286 (make-local-variable 'comment-start)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
287 (make-local-variable 'comment-end)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
288 (make-local-variable 'comment-indent-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
289 (make-local-variable 'comment-start-skip)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
290 (make-local-variable 'comment-indent-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
291 (make-local-variable 'sgml-tags-invisible)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
292 (make-local-variable 'skeleton-transformation)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
293 (make-local-variable 'skeleton-further-elements)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
294 (make-local-variable 'skeleton-end-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
295 (make-local-variable 'font-lock-defaults)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
296 (make-local-variable 'sgml-font-lock-keywords-1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
297 (make-local-variable 'facemenu-add-face-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
298 (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
299 ;;(make-local-variable 'facemenu-remove-face-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
300 (and sgml-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
301 (not (assq 1 sgml-tag-face-alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
302 (nconc sgml-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
303 `((1 (,(concat "<\\("
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
304 (mapconcat 'car sgml-tag-face-alist "\\|")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
305 "\\)\\([ \t].+\\)?>\\(.+\\)</\\1>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
306 3 (cdr (assoc (match-string 1) ',sgml-tag-face-alist)))))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
307 (setq indent-line-function 'indent-relative-maybe
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
308 ;; A start or end tag by itself on a line separates a paragraph.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
309 ;; This is desirable because SGML discards a newline that appears
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
310 ;; immediately after a start tag or immediately before an end tag.
19483
51345fa7e08b (sgml-mode-common): Set paragraph-start like paragraph-separate.
Richard M. Stallman <rms@gnu.org>
parents: 17551
diff changeset
311 paragraph-separate "[ \t]*$\\|\
51345fa7e08b (sgml-mode-common): Set paragraph-start like paragraph-separate.
Richard M. Stallman <rms@gnu.org>
parents: 17551
diff changeset
312 \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
51345fa7e08b (sgml-mode-common): Set paragraph-start like paragraph-separate.
Richard M. Stallman <rms@gnu.org>
parents: 17551
diff changeset
313 paragraph-start "[ \t]*$\\|\
51345fa7e08b (sgml-mode-common): Set paragraph-start like paragraph-separate.
Richard M. Stallman <rms@gnu.org>
parents: 17551
diff changeset
314 \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
51345fa7e08b (sgml-mode-common): Set paragraph-start like paragraph-separate.
Richard M. Stallman <rms@gnu.org>
parents: 17551
diff changeset
315 adaptive-fill-regexp "[ \t]*"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
316 comment-start "<!-- "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
317 comment-end " -->"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
318 comment-indent-function 'sgml-comment-indent
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
319 ;; This will allow existing comments within declarations to be
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
320 ;; recognized.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
321 comment-start-skip "--[ \t]*"
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
322 skeleton-transformation sgml-transformation
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
323 skeleton-further-elements '((completion-ignore-case t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
324 skeleton-end-hook (lambda ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
325 (or (eolp)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
326 (not (or (eq v2 '\n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
327 (eq (car-safe v2) '\n)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
328 (newline-and-indent)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
329 sgml-font-lock-keywords-1 (cdr (assq 1 sgml-tag-face-alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
330 font-lock-defaults '((sgml-font-lock-keywords
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
331 sgml-font-lock-keywords-1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
332 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
333 t)
17433
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
334 facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
335 (while sgml-display-text
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
336 (put (car (car sgml-display-text)) 'before-string
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
337 (cdr (car sgml-display-text)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
338 (setq sgml-display-text (cdr sgml-display-text)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
339 (run-hooks 'text-mode-hook 'sgml-mode-hook))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
340
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
341
17433
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
342 (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
343 (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
344 (progn
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
345 (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
346 (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
347 (concat "<" face ">"))
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
348 (error "Face not configured for %s mode." mode-name)))
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
349
7df65491ab5f (sgml-mode-facemenu-add-face-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17432
diff changeset
350
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
351 ;;;###autoload
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
352 (defun sgml-mode (&optional function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
353 "Major mode for editing SGML documents.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
354 Makes > match <. Makes / blink matching /.
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
355 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
356 `sgml-quick-keys'.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
357
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
358 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
359 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
360 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
361
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
362 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
363 your `.emacs' file.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
364
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
365 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
366
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
367 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
368 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
369 \\{sgml-mode-map}"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
370 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
371 (sgml-mode-common sgml-tag-face-alist sgml-display-text)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
372 (use-local-map sgml-mode-map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
373 (setq mode-name "SGML"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
374 major-mode 'sgml-mode))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
375
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
376
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
377
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
378 (defun sgml-comment-indent ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
379 (if (and (looking-at "--")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
380 (not (and (eq (preceding-char) ?!)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
381 (eq (char-after (- (point) 2)) ?<))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
382 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
383 (skip-chars-backward " \t")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
384 (max comment-column (1+ (current-column))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
385 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
386
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
387
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
388
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
389 (defun sgml-slash (arg)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
390 "Insert `/' and display any previous matching `/'.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
391 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
392 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
393 (interactive "p")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
394 (insert-char ?/ arg)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
395 (if (> arg 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
396 (let ((oldpos (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
397 (blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
398 (level 0))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
399 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
400 (save-restriction
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
401 (if sgml-slash-distance
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
402 (narrow-to-region (max (point-min)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
403 (- (point) sgml-slash-distance))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
404 oldpos))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
405 (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
406 (eq (match-end 0) (1- oldpos)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
407 ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
408 (goto-char (1- oldpos))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
409 (while (and (not blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
410 (search-backward "/" (point-min) t))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
411 (let ((tagend (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
412 (if (re-search-backward sgml-start-tag-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
413 (point-min) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
414 (match-end 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
415 nil))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
416 (if (eq tagend (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
417 (if (eq level 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
418 (setq blinkpos (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
419 (setq level (1- level)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
420 (setq level (1+ level)))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
421 (if blinkpos
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
422 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
423 (goto-char blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
424 (if (pos-visible-in-window-p)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
425 (sit-for 1)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
426 (message "Matches %s"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
427 (buffer-substring (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
428 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
429 (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
430 (1+ blinkpos))))))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
431
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
432
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
433 (defun sgml-name-char (&optional char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
434 "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
435 8 bit chars may be inserted with the meta key as in M-SPC for no break space,
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
436 or M-- for a soft hyphen."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
437 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
438 (insert ?&)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
439 (or char
17500
e8d7c7e2acab (sgml-name-char): Ask user with a prompt.
Richard M. Stallman <rms@gnu.org>
parents: 17491
diff changeset
440 (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
441 (delete-backward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
442 (insert char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
443 (undo-boundary)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
444 (delete-backward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
445 (insert ?&
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
446 (or (aref sgml-char-names char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
447 (format "#%d" char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
448 ?\;))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
449
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
450
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
451 (defun sgml-name-self ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
452 "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
453 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
454 (sgml-name-char last-command-char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
455
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
456
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
457 (defun sgml-maybe-name-self ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
458 "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
459 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
460 (if sgml-name-8bit-mode
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
461 (sgml-name-char last-command-char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
462 (self-insert-command 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
463
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
464
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
465 (defun sgml-name-8bit-mode ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
466 "Toggle insertion of 8 bit characters."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
467 (interactive)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
468 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
469 (message "sgml name 8 bit mode is now %"
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
470 (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
471
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
472
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
473 ;; 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
474 ;; through skeleton-transformation and inserted. If "str" is to be
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
475 ;; 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
476 ;; function, e.g. (identity "str").
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
477
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
478 (define-skeleton sgml-tag
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
479 "Prompt for a tag and insert it, optionally with attributes.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
480 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
481 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
482 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
483 (setq sgml-transformation 'upcase)"
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
484 (funcall skeleton-transformation
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
485 (completing-read "Tag: " sgml-tag-alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
486 ?< (setq v1 (eval str)) |
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
487 (("") -1 '(undo-boundary) (identity "&lt;")) | ; see comment above
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
488 (("") '(setq v2 (sgml-attributes v1 t)) ?>
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
489 (if (string= "![" v1)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
490 (prog1 '(("") " [ " _ " ]]")
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
491 (backward-char))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
492 (if (or (eq v2 t)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
493 (string-match "^[/!?]" v1))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
494 ()
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
495 (if (symbolp v2)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
496 '(("") v2 _ v2 "</" v1 ?>)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
497 (if (eq (car v2) t)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
498 (cons '("") (cdr v2))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
499 (append '(("") (car v2))
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
500 (cdr v2)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
501 '(resume: (car v2) _ "</" v1 ?>))))))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
502
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
503 (autoload 'skeleton-read "skeleton")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
504
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
505 (defun sgml-attributes (tag &optional quiet)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
506 "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
507
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
508 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
509 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
510 (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
511 (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
512 (if tag
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
513 (let ((completion-ignore-case t)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
514 (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
515 car attribute i)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
516 (if (or (symbolp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
517 (symbolp (car (car alist))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
518 (setq car (car alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
519 alist (cdr alist)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
520 (or quiet
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
521 (message "No attributes configured."))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
522 (if (stringp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
523 (progn
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
524 (insert (if (eq (preceding-char) ? ) "" ? )
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
525 (funcall skeleton-transformation (car alist)))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
526 (sgml-value alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
527 (setq i (length alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
528 (while (> i 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
529 (insert ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
530 (insert (funcall skeleton-transformation
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
531 (setq attribute
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
532 (skeleton-read '(completing-read
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
533 "Attribute: "
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
534 alist)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
535 (if (string= "" attribute)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
536 (setq i 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
537 (sgml-value (assoc attribute alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
538 (setq i (1- i))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
539 (if (eq (preceding-char) ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
540 (delete-backward-char 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
541 car)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
542
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
543 (defun sgml-auto-attributes (arg)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
544 "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
545 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
546 (interactive "*P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
547 (let ((point (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
548 tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
549 (if (or arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
550 (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
551 (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
552 (eq (aref tag 0) ?/))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
553 (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
554 (sgml-attributes tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
555 (setq last-command-char ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
556 (or (> (point) point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
557 (self-insert-command 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
558
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
559
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
560 (defun sgml-tag-help (&optional tag)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
561 "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
562 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
563 (or tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
564 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
565 (if (eq (following-char) ?<)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
566 (forward-char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
567 (setq tag (sgml-beginning-of-tag))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
568 (or (stringp tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
569 (error "No tag selected"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
570 (setq tag (downcase tag))
14328
5d0e329a44d8 (sgml-tag-help): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14270
diff changeset
571 (message "%s"
5d0e329a44d8 (sgml-tag-help): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14270
diff changeset
572 (or (cdr (assoc tag sgml-tag-help))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
573 (and (eq (aref tag 0) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
574 (cdr (assoc (substring tag 1) sgml-tag-help)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
575 "No description available")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
576
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
577
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
578 (defun sgml-maybe-end-tag ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
579 "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
580 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
581 (or (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
582 (save-excursion (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
583 (error
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
584 (sgml-name-self)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
585 t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
586 (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
587 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
588 (save-excursion (up-list 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
589 (sgml-name-self))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
590 (error (self-insert-command 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
591
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
592
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
593 (defun sgml-skip-tag-backward (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
594 "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
595 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
596 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
597 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
598 (search-backward "<" nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
599 (if (looking-at "</\\([^ \n\t>]+\\)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
600 ;; end tag, skip any nested pairs
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
601 (let ((case-fold-search t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
602 (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
603 (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
604 (eq (char-after (1+ (point))) ?/))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
605 (forward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
606 (sgml-skip-tag-backward 1))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
607 (setq arg (1- arg))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
608
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
609 (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
610 "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
611 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
612 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
613 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
614 (setq return t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
615 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
616 (skip-chars-forward "^<>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
617 (if (eq (following-char) ?>)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
618 (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
619 (if (looking-at "<\\([^/ \n\t>]+\\)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
620 ;; 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
621 (let ((case-fold-search t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
622 (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
623 point close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
624 (forward-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
625 (setq point (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
626 (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
627 (not (setq close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
628 (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
629 (not (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
630 (sgml-skip-tag-forward 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
631 (setq close nil))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
632 (if close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
633 (up-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
634 (goto-char point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
635 (setq return)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
636 (forward-list 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
637 (setq arg (1- arg)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
638 return)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
639
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
640 (defun sgml-delete-tag (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
641 "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
642 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
643 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
644 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
645 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
646 (let* (close open)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
647 (if (looking-at "[ \t\n]*<")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
648 ;; just before tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
649 (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
650 ;; closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
651 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
652 (setq close (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
653 (goto-char (match-end 0))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
654 ;; on tag?
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
655 (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
656 close (and (stringp close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
657 (eq (aref close 0) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
658 (point))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
659 ;; not on closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
660 (let ((point (point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
661 (sgml-skip-tag-backward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
662 (if (or (not (eq (following-char) ?<))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
663 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
664 (forward-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
665 (<= (point) point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
666 (error "Not on or before tag")))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
667 (if close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
668 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
669 (sgml-skip-tag-backward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
670 (setq open (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
671 (goto-char close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
672 (kill-sexp 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
673 (setq open (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
674 (sgml-skip-tag-forward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
675 (backward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
676 (forward-char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
677 (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
678 (kill-sexp 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
679 (goto-char open)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
680 (kill-sexp 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
681 (setq arg (1- arg))))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
682
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
683 ;; 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
684 (or (get 'sgml-tag 'invisible)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
685 (setplist 'sgml-tag
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
686 (append '(invisible t
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
687 intangible t
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
688 point-entered sgml-point-entered
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
689 rear-nonsticky t
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
690 read-only t)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
691 (symbol-plist 'sgml-tag))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
692
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
693 (defun sgml-tags-invisible (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
694 "Toggle visibility of existing tags."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
695 (interactive "P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
696 (let ((modified (buffer-modified-p))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
697 (inhibit-read-only t)
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
698 ;; 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
699 ;; since it moves point and might call sgml-point-entered.
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
700 (inhibit-point-motion-hooks t)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
701 symbol)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
702 (save-excursion
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
703 (goto-char (point-min))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
704 (if (setq sgml-tags-invisible
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
705 (if arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
706 (>= (prefix-numeric-value arg) 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
707 (not sgml-tags-invisible)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
708 (while (re-search-forward "<\\([!/?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
709 nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
710 (setq symbol (intern-soft (downcase (match-string 1))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
711 (goto-char (match-beginning 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
712 (and (get symbol 'before-string)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
713 (not (overlays-at (point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
714 (overlay-put (make-overlay (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
715 (match-beginning 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
716 'category symbol))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
717 (put-text-property (point)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
718 (progn (forward-list) (point))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
719 'category 'sgml-tag))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
720 (let ((pos (point)))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
721 (while (< (setq pos (next-overlay-change pos)) (point-max))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
722 (delete-overlay (car (overlays-at pos)))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
723 (remove-text-properties (point-min) (point-max)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
724 '(category sgml-tag intangible t))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
725 (set-buffer-modified-p modified)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
726 (run-hooks 'sgml-tags-invisible-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
727 (message "")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
728
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
729 (defun sgml-point-entered (x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
730 ;; 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
731 (let ((inhibit-point-motion-hooks t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
732 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
733 (message "Invisible tag: %s"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
734 (buffer-substring
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
735 (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
736 (if (or (and (> x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
737 (not (eq (following-char) ?<)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
738 (and (< x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
739 (eq (preceding-char) ?>)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
740 (backward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
741 (forward-list)))))))
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
742
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
743 (autoload 'compile-internal "compile")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
744
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
745 (defun sgml-validate (command)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
746 "Validate an SGML document.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
747 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
748 with output going to the buffer `*compilation*'.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
749 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
750 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
751 (interactive
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
752 (list (read-string "Validate command: "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
753 (or sgml-saved-validate-command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
754 (concat sgml-validate-command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
755 " "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
756 (let ((name (buffer-file-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
757 (and name
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
758 (file-name-nondirectory name))))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
759 (setq sgml-saved-validate-command command)
17309
a8073ecbea23 (sgml-validate): Offer to save the buffer first.
Richard M. Stallman <rms@gnu.org>
parents: 16914
diff changeset
760 (if (or (not compilation-ask-about-save)
a8073ecbea23 (sgml-validate): Offer to save the buffer first.
Richard M. Stallman <rms@gnu.org>
parents: 16914
diff changeset
761 (y-or-n-p (message "Save buffer %s? " (buffer-name))))
a8073ecbea23 (sgml-validate): Offer to save the buffer first.
Richard M. Stallman <rms@gnu.org>
parents: 16914
diff changeset
762 (save-buffer))
3121
8cf203c42bee (sgml-validate): compile1 renamed to compile-internal.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
763 (compile-internal command "No more errors"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
764
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
765
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
766 (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
767 "Skip to beginning of tag and return its name.
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
768 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
769 (or (if top-level
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
770 (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
771 (up-list -1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
772 (error t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
773 (>= (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
774 (if (search-backward "<" nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
775 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
776 (forward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
777 (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
778 0)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
779 (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
780 (buffer-substring-no-properties
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
781 (1+ (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
782 (match-end 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
783 t)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
784
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
785 (defun sgml-value (alist)
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
786 "Interactively insert value taken from attributerule ALIST.
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
787 See `sgml-tag-alist' for info about attributerules.."
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
788 (setq alist (cdr alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
789 (if (stringp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
790 (insert "=\"" (car alist) ?\")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
791 (if (eq (car alist) t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
792 (if (cdr alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
793 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
794 (insert "=\"")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
795 (setq alist (skeleton-read '(completing-read
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
796 "Value: " (cdr alist))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
797 (if (string< "" alist)
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
798 (insert alist ?\")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
799 (delete-backward-char 2))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
800 (insert "=\"")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
801 (if alist
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
802 (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
803 (insert ?\"))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
804
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
805 (provide 'sgml-mode)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
806
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
807 (defvar html-quick-keys sgml-quick-keys
14377
2e6bd1a2712a Whitespace fix.
Richard M. Stallman <rms@gnu.org>
parents: 14328
diff changeset
808 "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
809 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
810 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
811
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
812 (defvar html-mode-map
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
813 (let ((map (nconc (make-sparse-keymap) sgml-mode-map))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
814 (menu-map (make-sparse-keymap "HTML")))
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
815 (define-key map "\C-c6" 'html-headline-6)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
816 (define-key map "\C-c5" 'html-headline-5)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
817 (define-key map "\C-c4" 'html-headline-4)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
818 (define-key map "\C-c3" 'html-headline-3)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
819 (define-key map "\C-c2" 'html-headline-2)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
820 (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
821 (define-key map "\C-c\r" 'html-paragraph)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
822 (define-key map "\C-c\n" 'html-line)
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
823 (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
824 (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
825 (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
826 (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
827 (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
828 (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
829 (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
830 (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
831 (define-key map "\C-c\C-ci" 'html-image)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
832 (if html-quick-keys
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
833 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
834 (define-key map "\C-c-" 'html-horizontal-rule)
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
835 (define-key map "\C-co" 'html-ordered-list)
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
836 (define-key map "\C-cu" 'html-unordered-list)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
837 (define-key map "\C-cr" 'html-radio-buttons)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
838 (define-key map "\C-cc" 'html-checkboxes)
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
839 (define-key map "\C-cl" 'html-list-item)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
840 (define-key map "\C-ch" 'html-href-anchor)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
841 (define-key map "\C-cn" 'html-name-anchor)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
842 (define-key map "\C-ci" 'html-image)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
843 (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
844 (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
845 (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
846 (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
847 '("Toggle Autoviewing" . html-autoview-mode))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
848 (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
849 '("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
850 (define-key menu-map [nil] '("--"))
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
851 ;;(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
852 ;;(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
853 ;;(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
854 (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
855 (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
856 (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
857 (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
858 (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
859 (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
860 (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
861 (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
862 (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
863 (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
864 (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
865 (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
866 (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
867 (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
868 map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
869 "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
870
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
871
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
872 (defvar html-face-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
873 '((bold . "b")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
874 (italic . "i")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
875 (underline . "u")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
876 (modeline . "rev"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
877 "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
878
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
879 (defvar html-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
880 '(("b" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
881 ("big" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
882 ("blink" . highlight)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
883 ("cite" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
884 ("em" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
885 ("h1" bold underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
886 ("h2" bold-italic underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
887 ("h3" italic underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
888 ("h4" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
889 ("h5" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
890 ("h6" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
891 ("i" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
892 ("rev" . modeline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
893 ("s" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
894 ("small" . default)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
895 ("strong" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
896 ("title" bold underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
897 ("tt" . default)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
898 ("u" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
899 ("var" . italic))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
900 "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
901
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
902
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
903 (defvar html-display-text
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
904 '((img . "[/]")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
905 (hr . "----------")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
906 (li . "o "))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
907 "Value of `sgml-display-text' for HTML mode.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
908
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
909
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
910 ; should code exactly HTML 3 here when that is finished
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
911 (defvar html-tag-alist
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
912 (let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7")))
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
913 (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
914 (align '(("align" ("left") ("center") ("right"))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
915 (valign '(("top") ("middle") ("bottom") ("baseline")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
916 (rel '(("next") ("previous") ("parent") ("subdocument") ("made")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
917 (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
918 ("mailto:") ("news:") ("rlogin:") ("telnet:") ("tn3270:")
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
919 ("wais:") ("/cgi-bin/")))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
920 (name '("name"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
921 (link `(,href
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
922 ("rel" ,@rel)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
923 ("rev" ,@rel)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
924 ("title")))
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
925 (list '((nil \n ( "List item: "
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
926 "<li>" str \n))))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
927 (cell `(t
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
928 ,align
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
929 ("valign" ,@valign)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
930 ("colspan" ,@1-9)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
931 ("rowspan" ,@1-9)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
932 ("nowrap" t))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
933 ;; 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
934 ;; 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
935 `(("a" ,name ,@link)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
936 ("base" t ,@href)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
937 ("dir" ,@list)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
938 ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7)
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
939 ("form" (\n _ \n "<input type=\"submit\" value=\"\">")
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
940 ("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
941 ("h1" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
942 ("h2" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
943 ("h3" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
944 ("h4" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
945 ("h5" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
946 ("h6" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
947 ("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
948 ("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
949 ("src") ("alt") ("width" "1") ("height" "1")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
950 ("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
951 ("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
952 ("type" ("text") ("password") ("checkbox") ("radio")
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
953 ("submit") ("reset"))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
954 ("value"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
955 ("link" t ,@link)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
956 ("menu" ,@list)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
957 ("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
958 ("p" t ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
959 ("select" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
960 ("Text: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
961 "<option>" str \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
962 ,name ("size" ,@1-9) ("multiple" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
963 ("table" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
964 ((completing-read "Cell kind: " '(("td") ("th"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
965 nil t "t")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
966 "<tr><" str ?> _ \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
967 ("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
968 ("td" ,@cell)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
969 ("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
970 ("th" ,@cell)
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
971 ("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
972
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
973 ,@sgml-tag-alist
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 ("abbrev")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
976 ("acronym")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
977 ("address")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
978 ("array" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
979 ("Item: " "<item>" str \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
980 "align")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
981 ("au")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
982 ("b")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
983 ("big")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
984 ("blink")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
985 ("blockquote" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
986 ("body" \n ("background" ".gif") ("bgcolor" "#") ("text" "#")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
987 ("link" "#") ("alink" "#") ("vlink" "#"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
988 ("box" (nil _ "<over>" _))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
989 ("br" t ("clear" ("left") ("right")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
990 ("caption" ("valign" ("top") ("bottom")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
991 ("center" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
992 ("cite")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
993 ("code" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
994 ("dd" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
995 ("del")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
996 ("dfn")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
997 ("dl" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
998 ( "Term: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
999 "<dt>" str "<dd>" _ \n)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1000 ("dt" (t _ "<dd>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1001 ("em")
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1002 ;("fn" "id" "fn") ; ???
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1003 ("head" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1004 ("html" (\n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1005 "<head>\n"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1006 "<title>" (setq str (read-input "Title: ")) "</title>\n"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1007 "<body>\n<h1>" str "</h1>\n" _
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1008 "\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
1009 user-mail-address
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1010 "\">" (user-full-name) "</a>\n</address>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1011 ("i")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1012 ("ins")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1013 ("isindex" t ("action") ("prompt"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1014 ("kbd")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1015 ("lang")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1016 ("li" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1017 ("math" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1018 ("nobr")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1019 ("option" t ("value") ("label") ("selected" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1020 ("over" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1021 ("person")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1022 ("pre" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1023 ("q")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1024 ("rev")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1025 ("s")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1026 ("samp")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1027 ("small")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1028 ("strong")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1029 ("sub")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1030 ("sup")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1031 ("title")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1032 ("tr" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1033 ("tt")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1034 ("u")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1035 ("var")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1036 ("wbr" t)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1037 "*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
1038
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1039 (defvar html-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1040 `(,@sgml-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1041 ("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
1042 ("abbrev" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1043 ("acronym" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1044 ("address" . "Formatted mail address")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1045 ("array" . "Math array")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1046 ("au" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1047 ("b" . "Bold face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1048 ("base" . "Base address for URLs")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1049 ("big" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1050 ("blink" . "Blinking text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1051 ("blockquote" . "Indented quotation")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1052 ("body" . "Document body")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1053 ("box" . "Math fraction")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1054 ("br" . "Line break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1055 ("caption" . "Table caption")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1056 ("center" . "Centered text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1057 ("changed" . "Change bars")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1058 ("cite" . "Citation of a document")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1059 ("code" . "Formatted source code")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1060 ("dd" . "Definition of term")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1061 ("del" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1062 ("dfn" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1063 ("dir" . "Directory list (obsolete)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1064 ("dl" . "Definition list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1065 ("dt" . "Term to be definined")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1066 ("em" . "Emphasised")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1067 ("embed" . "Embedded data in foreign format")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1068 ("fig" . "Figure")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1069 ("figa" . "Figure anchor")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1070 ("figd" . "Figure description")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1071 ("figt" . "Figure text")
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1072 ;("fn" . "?") ; ???
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1073 ("font" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1074 ("form" . "Form with input fields")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1075 ("group" . "Document grouping")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1076 ("h1" . "Most important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1077 ("h2" . "Important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1078 ("h3" . "Section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1079 ("h4" . "Minor section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1080 ("h5" . "Unimportant section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1081 ("h6" . "Least important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1082 ("head" . "Document header")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1083 ("hr" . "Horizontal rule")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1084 ("html" . "HTML Document")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1085 ("i" . "Italic face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1086 ("img" . "Graphic image")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1087 ("input" . "Form input field")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1088 ("ins" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1089 ("isindex" . "Input field for index search")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1090 ("kbd" . "Keybard example face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1091 ("lang" . "Natural language")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1092 ("li" . "List item")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1093 ("link" . "Link relationship")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1094 ("math" . "Math formula")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1095 ("menu" . "Menu list (obsolete)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1096 ("mh" . "Form mail header")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1097 ("nextid" . "Allocate new id")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1098 ("nobr" . "Text without line break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1099 ("ol" . "Ordered list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1100 ("option" . "Selection list item")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1101 ("over" . "Math fraction rule")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1102 ("p" . "Paragraph start")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1103 ("panel" . "Floating panel")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1104 ("person" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1105 ("pre" . "Preformatted fixed width text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1106 ("q" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1107 ("rev" . "Reverse video")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1108 ("s" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1109 ("samp" . "Sample text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1110 ("select" . "Selection list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1111 ("small" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1112 ("sp" . "Nobreak space")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1113 ("strong" . "Standout text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1114 ("sub" . "Subscript")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1115 ("sup" . "Superscript")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1116 ("table" . "Table with rows and columns")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1117 ("tb" . "Table vertical break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1118 ("td" . "Table data cell")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1119 ("textarea" . "Form multiline edit area")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1120 ("th" . "Table header cell")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1121 ("title" . "Document title")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1122 ("tr" . "Table row separator")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1123 ("tt" . "Typewriter face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1124 ("u" . "Underlined text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1125 ("ul" . "Unordered list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1126 ("var" . "Math variable face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1127 ("wbr" . "Enable <br> within <nobr>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1128 "*Value of `sgml-tag-help' for HTML mode.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1129
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1130
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1131
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1132 ;;;###autoload
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1133 (defun html-mode ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1134 "Major mode based on SGML mode for editing HTML documents.
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1135 This allows inserting skeleton costructs used in hypertext documents with
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1136 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
1137 \\[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
1138 which this is based.
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1139
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1140 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
1141
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1142 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
1143 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
1144 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
1145 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
1146
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1147 <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
1148 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
1149 <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
1150
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1151 <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
1152 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
1153 <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
1154 Edit/Text Properties/Face commands.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1155
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1156 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
1157 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
1158 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
1159 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
1160
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1161 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
1162
17551
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1163 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
1164 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
1165 To work around that, do:
2738b57e4704 Many doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 17545
diff changeset
1166 (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
1167
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1168 \\{html-mode-map}"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1169 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1170 (sgml-mode-common html-tag-face-alist html-display-text)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1171 (use-local-map html-mode-map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1172 (make-local-variable 'sgml-tag-alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1173 (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
1174 (make-local-variable 'sgml-tag-help)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1175 (make-local-variable 'outline-regexp)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1176 (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
1177 (make-local-variable 'outline-level)
16914
4b79df16b939 (html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents: 16404
diff changeset
1178 (make-local-variable 'sentence-end)
4b79df16b939 (html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents: 16404
diff changeset
1179 (setq sentence-end
4b79df16b939 (html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents: 16404
diff changeset
1180 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1181 (setq mode-name "HTML"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1182 major-mode 'html-mode
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1183 sgml-tag-alist html-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1184 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
1185 sgml-tag-help html-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1186 outline-regexp "^.*<[Hh][1-6]\\>"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1187 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
1188 outline-level (lambda ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1189 (char-after (1- (match-end 0)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1190 (run-hooks 'html-mode-hook))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1191
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1192
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1193 (define-skeleton html-href-anchor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1194 "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
1195 "URL: "
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1196 '(setq input "http:")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1197 "<a href=\"" str "\">" _ "</a>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1198
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1199 (define-skeleton html-name-anchor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1200 "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
1201 "Name: "
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1202 "<a name=\"" str "\">" _ "</a>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1203
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1204 (define-skeleton html-headline-1
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1205 "HTML level 1 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1206 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1207 "<h1>" _ "</h1>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1208
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1209 (define-skeleton html-headline-2
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1210 "HTML level 2 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1211 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1212 "<h2>" _ "</h2>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1213
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1214 (define-skeleton html-headline-3
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1215 "HTML level 3 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1216 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1217 "<h3>" _ "</h3>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1218
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1219 (define-skeleton html-headline-4
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1220 "HTML level 4 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1221 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1222 "<h4>" _ "</h4>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1223
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1224 (define-skeleton html-headline-5
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1225 "HTML level 5 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1226 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1227 "<h5>" _ "</h5>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1228
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1229 (define-skeleton html-headline-6
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1230 "HTML level 6 headline tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1231 nil
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1232 "<h6>" _ "</h6>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1233
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1234 (define-skeleton html-horizontal-rule
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1235 "HTML horizontal rule tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1236 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1237 "<hr>" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1238
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1239 (define-skeleton html-image
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1240 "HTML image tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1241 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1242 "<img src=\"" _ "\">")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1243
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1244 (define-skeleton html-line
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1245 "HTML line break tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1246 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1247 "<br>" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1248
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1249 (define-skeleton html-ordered-list
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1250 "HTML ordered list tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1251 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1252 "<ol>" \n
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1253 "<li>" _ \n
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1254 "</ol>")
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1255
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1256 (define-skeleton html-unordered-list
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1257 "HTML unordered list tags."
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1258 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1259 "<ul>" \n
15437
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1260 "<li>" _ \n
43b1f8a3af53 (html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 14518
diff changeset
1261 "</ul>")
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1262
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1263 (define-skeleton html-list-item
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1264 "HTML list item tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1265 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1266 (if (bolp) nil '\n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1267 "<li>")
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 (define-skeleton html-paragraph
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1270 "HTML paragraph tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1271 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1272 (if (bolp) nil ?\n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1273 \n "<p>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1274
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1275 (define-skeleton html-checkboxes
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1276 "Group of connected checkbox inputs."
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1277 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1278 '(setq v1 nil
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1279 v2 nil)
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1280 ("Value: "
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1281 "<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
1282 "\" 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
1283 "\" value=\"" str ?\"
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1284 (if (y-or-n-p "Set \"checked\" attribute? ")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1285 (funcall skeleton-transformation " checked")) ">"
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1286 (skeleton-read "Text: " (capitalize str))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1287 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1288 (funcall skeleton-transformation "<br>")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1289 "")))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1290 \n))
14270
15c3d6255a1c (sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
1291
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1292 (define-skeleton html-radio-buttons
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1293 "Group of connected radio button inputs."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1294 nil
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1295 '(setq v1 nil
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1296 v2 (cons nil nil))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1297 ("Value: "
17545
c67787f92aea (sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents: 17530
diff changeset
1298 "<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
1299 "\" 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
1300 "\" value=\"" str ?\"
17491
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1301 (if (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1302 (funcall skeleton-transformation " checked") ">")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1303 (skeleton-read "Text: " (capitalize str))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1304 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1305 (funcall skeleton-transformation "<br>")
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1306 "")))
4c6505ca34a7 (sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents: 17433
diff changeset
1307 \n))
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1308
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1309
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1310 (defun html-autoview-mode (&optional arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1311 "Toggle automatic viewing via `html-viewer' upon saving buffer.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1312 With positive prefix ARG always turns viewing on, with negative ARG always off.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1313 Can be used as a value for `html-mode-hook'."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1314 (interactive "P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1315 (if (setq arg (if arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1316 (< (prefix-numeric-value arg) 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1317 (and (boundp 'after-save-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1318 (memq 'browse-url-of-buffer after-save-hook))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1319 (setq after-save-hook (delq 'browse-url-of-buffer after-save-hook))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1320 (make-local-hook 'after-save-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1321 (add-hook 'after-save-hook 'browse-url-of-buffer nil t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1322 (message "Autoviewing turned %s."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1323 (if arg "off" "on")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1324
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1325 ;;; sgml-mode.el ends here