annotate lisp/textmodes/sgml-mode.el @ 14168:3b925cc52931

Removed auto-mode-alist hacking for html-mode to files.el.
author Erik Naggum <erik@naggum.no>
date Sat, 13 Jan 1996 00:38:41 +0000
parents 313ea10ec42c
children 83f275dcd93a
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
869
7861f8756850 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 844
diff changeset
5 ;; Author: James Clark <jjc@clark.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
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
7 ;; Keywords: wp, hypermedia, comm, languages
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11 ;; 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
12 ;; 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
13 ;; 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
14 ;; any later version.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16 ;; 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
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
24
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25 ;;; Commentary:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
27 ;; 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
28 ;; 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
29 ;; HTML hypertext markup language.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31 ;;; Code:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
33 ;; 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
34 ;; 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
35 ;; kludgy kind of tradeoff.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
36 (defvar sgml-specials '(?\" ?-)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
37 "List of characters that have a special meaning for sgml-mode.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
38 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
39 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
40
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
41 ?\\\" Makes \" in text start a string.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
42 ?' Makes ' in text start a string.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
43 ?- Makes -- in text start a comment.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
44
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
45 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
46 DTDs, start a string. To partially avoid this problem this also makes these
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
47 self insert as named entities. <!----> must contain an even multiple of two
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
48 (4, 8, ...) minuses, or Emacs' syntax mechanism won't recognize a comment.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
49
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
51 (defvar sgml-mode-map
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
52 (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
53 (menu-map (make-sparse-keymap "SGML")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
54 (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
55 (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
56 (define-key map "/" 'sgml-slash)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
57 (define-key map "&" 'sgml-name-char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
58 (define-key map "<" 'sgml-tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
59 (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
60 (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
61 (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
62 (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
63 (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
64 (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
65 (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
66 (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
67 (define-key map " " 'sgml-auto-attributes)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
68 (define-key map ">" 'sgml-maybe-end-tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
69 (if (memq ?\" sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
70 (define-key map "\"" 'sgml-name-self))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
71 (if (memq ?' sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
72 (define-key map "'" 'sgml-name-self))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
73 (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
74 (define-key map "\C-c\C-v" 'sgml-validate)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
75 (let ((c 127)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
76 (map (nth 1 map)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
77 (while (< (setq c (1+ c)) 256)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
78 (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
79 (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
80 (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
81 (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
82 '("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
83 (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
84 '("Toggle Tag Visibility" . sgml-tags-invisible))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
85 (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
86 '("Describe Tag" . sgml-tag-help))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
87 (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
88 '("Delete Tag" . sgml-delete-tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
89 (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
90 '("Forward Tag" . sgml-skip-tag-forward))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
91 (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
92 '("Backward Tag" . sgml-skip-tag-backward))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
93 (define-key menu-map [sgml-attributes]
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
94 '("Insert Attributes" . sgml-attributes))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
95 (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
96 map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
97 "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
98
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
99
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
100 (defvar sgml-mode-syntax-table
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
101 (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
102 (modify-syntax-entry ?< "(>" table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
103 (modify-syntax-entry ?> ")<" table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
104 (if (memq ?- sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
105 (modify-syntax-entry ?- "_ 1234" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
106 (if (memq ?\" sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
107 (modify-syntax-entry ?\" "\"\"" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
108 (if (memq ?' sgml-specials)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
109 (modify-syntax-entry ?\' "\"'" table))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
110 table)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
111 "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
112
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
113
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
114 (defvar sgml-name-8bit-mode nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
115 "*When non-`nil' insert 8 bit characters with their names.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
116
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
117 (defvar sgml-char-names
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
118 [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
119 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
120 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
121 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
122 "ensp" "excl" "quot" "num" "dollar" "percnt" "amp" "apos"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
123 "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
124 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
125 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
126 "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
127 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
128 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
129 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
130 "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
131 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
132 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
133 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
134 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
135 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
136 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
137 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
138 "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
139 "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
140 "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
141 "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
142 "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
143 "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
144 "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
145 "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
146 "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
147 "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
148 "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
149 "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
150 "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
151
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
152
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
153 ;; 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
154 ;; 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
155 ;; 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
156 ;; The -s option suppresses output.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
157
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
158 (defvar sgml-validate-command "sgmls -s"
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
159 "*The command to validate an SGML document.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
160 The file name of current buffer file name will be appended to this,
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
161 separated by a space.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
162
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
163 (defvar sgml-saved-validate-command nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
164 "The command last used to validate in this buffer.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
165
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
167 ;;; 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
168 ;;; so use a small distance here.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
169 (defconst sgml-slash-distance 1000
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
170 "*If non-nil, is the maximum distance to search for matching /.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
171
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
172 (defconst sgml-start-tag-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
173 "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
174 "Regular expression that matches a non-empty start tag.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
175 Any terminating > or / is not matched.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
176
14159
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 (defvar sgml-font-lock-keywords
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
179 '(("<\\([!?][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
180 ("<\\(/?[a-z0-9]+\\)" 1 font-lock-function-name-face)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
181 ("[&%][-.A-Za-z0-9]+;?" . font-lock-variable-name-face))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
182 "*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
183
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
184 ;; internal
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
185 (defvar sgml-font-lock-keywords-1 ())
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
186
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
187 (defvar sgml-face-tag-alist ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
188 "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
189
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
190 (defvar sgml-tag-face-alist ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
191 "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
192 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
193 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
194
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
195
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
196 (defvar sgml-display-text ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
197 "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
198
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
199 ;; internal
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
200 (defvar sgml-tags-invisible nil)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
201
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
202
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
203 (defvar sgml-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
204 '(("!attlist")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
205 ("!doctype")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
206 ("!element")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
207 ("!entity"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
208 "*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
209 This alist is made up as
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
210
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
211 ((\"tag\" . TAGRULE)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
212 ...)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
213
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
214 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
215 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
216 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
217 attribute alist.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
218
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
219 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
220
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
221 ((\"attribute\" . ATTRIBUTERULE)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
222 ...)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
223
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
224 ATTRIBUTERULE is a list of optionally `t' (no value when no input) followed by
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
225 an optional alist of possible values.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
226
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
227 (defvar sgml-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
228 '(("!" . "Empty declaration for comment")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
229 ("![" . "Embed declarations with parser directive")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
230 ("!attlist" . "Tag attributes declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
231 ("!doctype" . "Document type (DTD) declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
232 ("!element" . "Tag declaration")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
233 ("!entity" . "Entity (macro) declaration"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
234 "*Alist of tag name and short description.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
235
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
236
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
237 ;; put read-only last to enable setting this even when read-only enabled
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
238 (or (get 'sgml-tag 'invisible)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
239 (setplist 'sgml-tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
240 (append '(invisible t
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
241 rear-nonsticky t
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
242 point-entered sgml-point-entered
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
243 read-only t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
244 (symbol-plist 'sgml-tag))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
245
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
246
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
247 (defvar sgml-auto-attributes t
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
248 "*When non-`nil' SPC at top level of tag prompts for attributes.")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
249
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
250
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
251
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
252 (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
253 "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
254 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
255 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
256 varables of same name)."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
257 (kill-all-local-variables)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
258 (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
259 (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
260 (make-local-variable 'indent-line-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
261 (make-local-variable 'paragraph-start)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
262 (make-local-variable 'paragraph-separate)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
263 (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
264 (make-local-variable 'comment-start)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
265 (make-local-variable 'comment-end)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
266 (make-local-variable 'comment-indent-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
267 (make-local-variable 'comment-start-skip)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
268 (make-local-variable 'comment-indent-function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
269 (make-local-variable 'sgml-tags-invisible)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
270 (make-local-variable 'skeleton-transformation)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
271 (make-local-variable 'skeleton-further-elements)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
272 (make-local-variable 'skeleton-end-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
273 (make-local-variable 'font-lock-defaults)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
274 (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
275 (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
276 (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
277 ;;(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
278 (and sgml-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
279 (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
280 (nconc sgml-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
281 `((1 (,(concat "<\\("
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
282 (mapconcat 'car sgml-tag-face-alist "\\|")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
283 "\\)\\([ \t].+\\)?>\\(.+\\)</\\1>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
284 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
285 (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
286 ;; 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
287 ;; 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
288 ;; immediately after a start tag or immediately before an end tag.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
289 paragraph-start "^[ \t\n]\\|\
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
290 \\(</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$\\)"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
291 paragraph-separate "^[ \t\n]*$\\|\
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
292 ^</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
293 comment-start "<!-- "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
294 comment-end " -->"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
295 comment-indent-function 'sgml-comment-indent
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
296 ;; 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
297 ;; recognized.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
298 comment-start-skip "--[ \t]*"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
299 skeleton-transformation 'identity
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
300 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
301 skeleton-end-hook (lambda ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
302 (or (eolp)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
303 (not (or (eq v2 '\n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
304 (eq (car-safe v2) '\n)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
305 (newline-and-indent)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
306 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
307 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
308 sgml-font-lock-keywords-1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
309 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
310 t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
311 facemenu-add-face-function
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
312 (lambda (face end)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
313 (if (setq face (cdr (assq face sgml-face-tag-alist)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
314 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
315 (setq facemenu-end-add-face (concat "</" face ">"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
316 (concat "<" face ">"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
317 (error "Face not configured for %s mode." mode-name))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
318 (while sgml-display-text
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
319 (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
320 (cdr (car sgml-display-text)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
321 (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
322 (run-hooks 'text-mode-hook 'sgml-mode-hook))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
323
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
324
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
325 ;;;###autoload
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
326 (defun sgml-mode (&optional function)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
327 "Major mode for editing SGML documents.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
328 Makes > match <. Makes / blink matching /.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
329
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
330 Do \\[describe-variable] sgml- SPC to see available variables.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
331
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
332 Use \\[sgml-validate] to validate your document with an SGML parser.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
333 \\{sgml-mode-map}"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
334 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
335 (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
336 (use-local-map sgml-mode-map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
337 (setq mode-name "SGML"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
338 major-mode 'sgml-mode))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
339
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
340
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
341
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
342 (defun sgml-comment-indent ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
343 (if (and (looking-at "--")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
344 (not (and (eq (preceding-char) ?!)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
345 (eq (char-after (- (point) 2)) ?<))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
346 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
347 (skip-chars-backward " \t")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
348 (max comment-column (1+ (current-column))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
349 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
350
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
351
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
352
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
353 (defun sgml-slash (arg)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
354 "Insert / and display any previous matching /.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
355 Two /s are treated as matching if the first / ends a net-enabling
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
356 start tag, and the second / is the corresponding null end tag."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
357 (interactive "p")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
358 (insert-char ?/ arg)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
359 (if (> arg 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
360 (let ((oldpos (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
361 (blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
362 (level 0))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
363 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
364 (save-restriction
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
365 (if sgml-slash-distance
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
366 (narrow-to-region (max (point-min)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
367 (- (point) sgml-slash-distance))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
368 oldpos))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
369 (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
370 (eq (match-end 0) (1- oldpos)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
371 ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
372 (goto-char (1- oldpos))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
373 (while (and (not blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
374 (search-backward "/" (point-min) t))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
375 (let ((tagend (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
376 (if (re-search-backward sgml-start-tag-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
377 (point-min) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
378 (match-end 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
379 nil))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
380 (if (eq tagend (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
381 (if (eq level 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
382 (setq blinkpos (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
383 (setq level (1- level)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
384 (setq level (1+ level)))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
385 (if blinkpos
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
386 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
387 (goto-char blinkpos)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
388 (if (pos-visible-in-window-p)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
389 (sit-for 1)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
390 (message "Matches %s"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
391 (buffer-substring (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
392 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
393 (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
394 (1+ blinkpos))))))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
395
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
396
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
397 (defun sgml-name-char (&optional char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
398 "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
399 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
400 or M-- for a soft hyphen."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
401 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
402 (insert ?&)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
403 (or char
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
404 (setq char (read-quoted-char)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
405 (delete-backward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
406 (insert char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
407 (undo-boundary)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
408 (delete-backward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
409 (insert ?&
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
410 (or (aref sgml-char-names char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
411 (format "#%d" char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
412 ?\;))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
413
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
414
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
415 (defun sgml-name-self ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
416 "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
417 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
418 (sgml-name-char last-command-char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
419
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
420
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
421 (defun sgml-maybe-name-self ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
422 "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
423 (interactive "*")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
424 (if sgml-name-8bit-mode
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
425 (sgml-name-char last-command-char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
426 (self-insert-command 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
427
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
428
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
429 (defun sgml-name-8bit-mode ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
430 "Toggle insertion of 8 bit characters."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
431 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
432 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
433
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
434
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
435
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
436 (define-skeleton sgml-tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
437 "Insert a tag you are prompted for, optionally with attributes.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
438 Completion and configuration is according to `sgml-tag-alist'.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
439 If you like tags and attributes in uppercase set `skeleton-transformation'
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
440 to `upcase'."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
441 (funcall skeleton-transformation
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
442 (completing-read "Tag: " sgml-tag-alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
443 ?< (setq v1 (eval str)) |
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
444 (("") -1 '(undo-boundary) "&lt;") |
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
445 (("") '(setq v2 (sgml-attributes v1 t)) ?>
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
446 (if (or (eq v2 t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
447 (string-match "^[/!?]" v1))
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 (if (symbolp v2)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
450 '(("") v2 _ v2 "</" v1 ?>)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
451 (if (eq (car v2) t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
452 (cons '("") (cdr v2))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
453 (append '(("") (car v2))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
454 (cdr v2)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
455 '(resume: (car v2) _ "</" v1 ?>)))))))
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 (autoload 'skeleton-read "skeleton")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
458
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
459 (defun sgml-attributes (alist &optional quiet)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
460 "When at toplevel of a tag, interactively insert attributes."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
461 (interactive (list (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
462 (or (stringp alist) (error "Wrong context for adding attribute"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
463 (if alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
464 (let ((completion-ignore-case t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
465 car attribute i)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
466 (setq alist (cdr (assoc (downcase alist) sgml-tag-alist)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
467 (if (or (symbolp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
468 (symbolp (car (car alist))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
469 (setq car (car alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
470 alist (cdr alist)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
471 (or quiet
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
472 (message "No attributes configured."))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
473 (if (stringp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
474 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
475 (insert (if (eq (preceding-char) ? ) "" ? ) (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
476 (sgml-value alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
477 (setq i (length alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
478 (while (> i 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
479 (insert ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
480 (insert (funcall skeleton-transformation
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
481 (setq attribute
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
482 (skeleton-read '(completing-read
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
483 "[Attribute]: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
484 alist)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
485 (if (string= "" attribute)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
486 (setq i 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
487 (sgml-value (assoc attribute alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
488 (setq i (1- i))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
489 (if (eq (preceding-char) ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
490 (delete-backward-char 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
491 car)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
492
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
493 (defun sgml-auto-attributes (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
494 "Self insert, except, when at top level of tag, prompt for attributes.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
495 With prefix ARG, or if `sgml-auto-attributes' is `nil' only self insert."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
496 (interactive "*P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
497 (let ((point (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
498 tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
499 (if (or arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
500 (not sgml-auto-attributes)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
501 (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
502 (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
503 (eq (aref tag 0) ?/))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
504 (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
505 (sgml-attributes tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
506 (setq last-command-char ? )
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
507 (or (> (point) point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
508 (self-insert-command 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
509
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
510
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
511 (defun sgml-tag-help (&optional tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
512 "Display description of optional TAG or tag at point."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
513 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
514 (or tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
515 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
516 (if (eq (following-char) ?<)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
517 (forward-char))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
518 (setq tag (sgml-beginning-of-tag))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
519 (or (stringp tag)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
520 (error "No tag selected"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
521 (setq tag (downcase tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
522 (message (or (cdr (assoc tag sgml-tag-help))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
523 (and (eq (aref tag 0) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
524 (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
525 "No description available")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
526
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
527
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
528 (defun sgml-maybe-end-tag ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
529 "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
530 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
531 (or (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
532 (save-excursion (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
533 (error
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
534 (sgml-name-self)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
535 t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
536 (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
537 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
538 (save-excursion (up-list 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
539 (sgml-name-self))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
540 (error (self-insert-command 1)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
541
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-skip-tag-backward (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
544 "Skip to beginning of tag or matching opening tag if present.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
545 With prefix ARG, repeat that many times."
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 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
548 (search-backward "<" nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
549 (if (looking-at "</\\([^ \n\t>]+\\)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
550 ;; end tag, skip any nested pairs
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
551 (let ((case-fold-search t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
552 (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
553 (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
554 (eq (char-after (1+ (point))) ?/))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
555 (forward-char 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
556 (sgml-skip-tag-backward 1))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
557 (setq arg (1- arg))))
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 (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
560 "Skip to end of tag or matching closing tag if present.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
561 With prefix ARG, repeat that many times.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
562 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
563 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
564 (setq return t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
565 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
566 (skip-chars-forward "^<>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
567 (if (eq (following-char) ?>)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
568 (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
569 (if (looking-at "<\\([^/ \n\t>]+\\)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
570 ;; 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
571 (let ((case-fold-search t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
572 (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
573 point close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
574 (forward-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
575 (setq point (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
576 (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
577 (not (setq close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
578 (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
579 (not (up-list -1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
580 (sgml-skip-tag-forward 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
581 (setq close nil))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
582 (if close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
583 (up-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
584 (goto-char point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
585 (setq return)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
586 (forward-list 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
587 (setq arg (1- arg)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
588 return)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
589
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
590 (defun sgml-delete-tag (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
591 "Delete tag on or after cursor, and matching closing or opening tag.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
592 With prefix ARG, repeat that many times."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
593 (interactive "p")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
594 (while (>= arg 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
595 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
596 (let* (close open)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
597 (if (looking-at "[ \t]*<")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
598 ;; just before tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
599 (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
600 ;; closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
601 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
602 (setq close (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
603 (goto-char (match-end 0))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
604 ;; on tag?
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
605 (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
606 close (and (stringp close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
607 (eq (aref close 0) ?/)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
608 (point))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
609 ;; not on closing tag
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
610 (let ((point (point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
611 (sgml-skip-tag-backward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
612 (if (or (not (eq (following-char) ?<))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
613 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
614 (forward-list 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
615 (<= (point) point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
616 (error "Not on or before tag")))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
617 (if close
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
618 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
619 (sgml-skip-tag-backward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
620 (setq open (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
621 (goto-char close)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
622 (kill-sexp 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
623 (setq open (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
624 (sgml-skip-tag-forward 1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
625 (backward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
626 (forward-char)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
627 (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
628 (kill-sexp 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
629 (goto-char open)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
630 (kill-sexp 1)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
631 (setq arg (1- arg))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
632
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
633
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
634
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
635 (defun sgml-tags-invisible (arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
636 "Toggle visibility of existing tags."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
637 (interactive "P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
638 (let ((modified (buffer-modified-p))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
639 (inhibit-read-only t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
640 (point (point-min))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
641 symbol)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
642 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
643 (goto-char point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
644 (if (setq sgml-tags-invisible
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
645 (if arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
646 (>= (prefix-numeric-value arg) 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
647 (not sgml-tags-invisible)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
648 (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
649 nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
650 (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
651 (goto-char (match-beginning 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
652 (and (get symbol 'before-string)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
653 (not (overlays-at (point)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
654 (overlay-put (make-overlay (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
655 (match-beginning 1))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
656 'category symbol))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
657 (put-text-property (setq point (point)) (forward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
658 'intangible (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
659 (put-text-property point (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
660 'category 'sgml-tag))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
661 (while (< (setq point (next-overlay-change point)) (point-max))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
662 (delete-overlay (car (overlays-at point))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
663 (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
664 '(category sgml-tag intangible t))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
665 (set-buffer-modified-p modified)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
666 (run-hooks 'sgml-tags-invisible-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
667 (message "")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
668
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
669 (defun sgml-point-entered (x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
670 ;; 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
671 (let ((inhibit-point-motion-hooks t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
672 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
673 (message "Invisible tag: %s"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
674 (buffer-substring
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
675 (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
676 (if (or (and (> x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
677 (not (eq (following-char) ?<)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
678 (and (< x y)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
679 (eq (preceding-char) ?>)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
680 (backward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
681 (forward-list)))))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
682
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
683
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
684 (autoload 'compile-internal "compile")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
685
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
686 (defun sgml-validate (command)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
687 "Validate an SGML document.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
688 Runs COMMAND, a shell command, in a separate process asynchronously
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
689 with output going to the buffer *compilation*.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
690 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
691 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
692 (interactive
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
693 (list (read-string "Validate command: "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
694 (or sgml-saved-validate-command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
695 (concat sgml-validate-command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
696 " "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
697 (let ((name (buffer-file-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
698 (and name
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
699 (file-name-nondirectory name))))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
700 (setq sgml-saved-validate-command command)
3121
8cf203c42bee (sgml-validate): compile1 renamed to compile-internal.
Richard M. Stallman <rms@gnu.org>
parents: 2315
diff changeset
701 (compile-internal command "No more errors"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
702
14159
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
703
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
704 (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
705 "Skip to beginning of tag and return its name.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
706 Else `t'."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
707 (or (if top-level
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
708 (condition-case nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
709 (up-list -1)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
710 (error t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
711 (>= (point)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
712 (if (search-backward "<" nil t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
713 (save-excursion
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
714 (forward-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
715 (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
716 0)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
717 (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
718 (buffer-substring-no-properties
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
719 (1+ (point))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
720 (match-end 0))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
721 t)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
722
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
723 (defun sgml-value (alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
724 (setq alist (cdr alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
725 (if (stringp (car alist))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
726 (insert "=\"" (car alist) ?\")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
727 (if (eq (car alist) t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
728 (if (cdr alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
729 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
730 (insert "=\"")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
731 (setq alist (skeleton-read '(completing-read
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
732 "[Value]: " (cdr alist))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
733 (if (string< "" alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
734 (insert (funcall skeleton-transformation alist) ?\")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
735 (delete-backward-char 2))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
736 (insert "=\"")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
737 (if alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
738 (insert (funcall skeleton-transformation
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
739 (skeleton-read '(completing-read "Value: " alist)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
740 (insert ?\"))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
741
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
742 (provide 'sgml-mode)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
743
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
744 (defvar html-quick-keys t
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
745 "Use C-c <x> combinations for quick insertion of frequent tags when non-nil.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
746 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
747
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
748 (defvar html-mode-map
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
749 (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
750 (menu-map (make-sparse-keymap "HTML")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
751 (if html-quick-keys
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
752 (progn
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
753 (define-key map "\C-c1" 'html-headline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
754 (define-key map "\C-c2" 'html-headline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
755 (define-key map "\C-c3" 'html-headline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
756 (define-key map "\C-c4" 'html-headline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
757 (define-key map "\C-c5" 'html-headline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
758 (define-key map "\C-c6" 'html-headline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
759 (define-key map "\C-c-" 'html-horizontal-rule)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
760 (define-key map "\C-c\r" 'html-paragraph)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
761 (define-key map "\C-c\n" 'html-line)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
762 (define-key map "\C-co" 'html-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
763 (define-key map "\C-cu" 'html-list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
764 (define-key map "\C-cr" 'html-radio-buttons)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
765 (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
766 (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
767 (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
768 (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
769 (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
770 (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
771 (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
772 (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
773 '("Toggle Autoviewing" . html-autoview-mode))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
774 (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
775 '("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
776 (define-key menu-map [nil] '("--"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
777 ;;(define-key menu-map "6" '("Heading 6" . html-headline))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
778 ;;(define-key menu-map "5" '("Heading 5" . html-headline))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
779 ;;(define-key menu-map "4" '("Heading 4" . html-headline))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
780 (define-key menu-map "3" '("Heading 3" . html-headline))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
781 (define-key menu-map "2" '("Heading 2" . html-headline))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
782 (define-key menu-map "1" '("Heading 1" . html-headline))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
783 (define-key menu-map "l" '("Radio Buttons" . html-radio-buttons))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
784 (define-key menu-map "l" '("List Item" . html-list-item))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
785 (define-key menu-map "u" '("Unordered List" . html-list))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
786 (define-key menu-map "o" '("Ordered List" . html-list))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
787 (define-key menu-map "-" '("Horizontal rule" . html-horizontal-rule))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
788 (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
789 (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
790 (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
791 (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
792 (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
793 map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
794 "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
795
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
796
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
797 (defvar html-face-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
798 '((bold . "b")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
799 (italic . "i")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
800 (underline . "u")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
801 (modeline . "rev"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
802 "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
803
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
804 (defvar html-tag-face-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
805 '(("b" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
806 ("big" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
807 ("blink" . highlight)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
808 ("cite" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
809 ("em" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
810 ("h1" bold underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
811 ("h2" bold-italic underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
812 ("h3" italic underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
813 ("h4" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
814 ("h5" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
815 ("h6" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
816 ("i" . italic)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
817 ("rev" . modeline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
818 ("s" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
819 ("small" . default)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
820 ("strong" . bold)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
821 ("title" bold underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
822 ("tt" . default)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
823 ("u" . underline)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
824 ("var" . italic))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
825 "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
826
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
827
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
828 (defvar html-display-text
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
829 '((img . "[/]")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
830 (hr . "----------")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
831 (li . "o "))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
832 "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
833
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
834
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
835 ; 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
836 (defvar html-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
837 (let* ((1-9 '(("8") ("9")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
838 ("1") ("2") ("3") ("4") ("5") ("6") ("7")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
839 (align '(("align" ("left") ("center") ("right"))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
840 (valign '(("top") ("middle") ("bottom") ("baseline")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
841 (rel '(("next") ("previous") ("parent") ("subdocument") ("made")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
842 (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
843 ("mailto:") ("news:") ("rlogin:") ("telnet:") ("tn3270:")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
844 ("wais:")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
845 (name '("name"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
846 (link `(,href
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
847 ("rel" ,@rel)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
848 ("rev" ,@rel)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
849 ("title")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
850 (list '((nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
851 ( "List item: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
852 "<li>" str \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
853 ("type" ("A") ("a") ("I") ("i") ("1"))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
854 (cell `(t
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
855 ,align
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
856 ("valign" ,@valign)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
857 ("colspan" ,@1-9)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
858 ("rowspan" ,@1-9)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
859 ("nowrap" t))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
860 ;; 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
861 ;; 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
862 `(("a" ,name ,@link)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
863 ("base" t ,@href)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
864 ("dir" ,@list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
865 ("font" "size" ("-1") ("+1") ("-2") ("+2") ,@(cdr (cdr 1-9)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
866 ("form" \n ("action" ,@(cdr href)) ("method" ("get") ("post")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
867 ("h1" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
868 ("h2" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
869 ("h3" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
870 ("h4" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
871 ("h5" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
872 ("h6" ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
873 ("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
874 ("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
875 ("src") ("alt") ("width" "1") ("height" "1")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
876 ("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
877 ("input" t ("size" ,@1-9) ("maxlength" ,@1-9) ("checked" t) ,name
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
878 ("type" ("text") ("password") ("checkbox") ("radio") ("sbmit") ("reset"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
879 ("value"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
880 ("link" t ,@link)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
881 ("menu" ,@list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
882 ("ol" ,@list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
883 ("p" t ,@align)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
884 ("select" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
885 ("Text: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
886 "<option>" str \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
887 ,name ("size" ,@1-9) ("multiple" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
888 ("table" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
889 ((completing-read "Cell kind: " '(("td") ("th"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
890 nil t "t")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
891 "<tr><" str ?> _ \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
892 ("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
893 ("td" ,@cell)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
894 ("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
895 ("th" ,@cell)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
896 ("ul" ,@list)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
897
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
898 ,@sgml-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
899
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
900 ("abbrev")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
901 ("acronym")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
902 ("address")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
903 ("array" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
904 ("Item: " "<item>" str \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
905 "align")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
906 ("au")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
907 ("b")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
908 ("big")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
909 ("blink")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
910 ("blockquote" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
911 ("body" \n ("background" ".gif") ("bgcolor" "#") ("text" "#")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
912 ("link" "#") ("alink" "#") ("vlink" "#"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
913 ("box" (nil _ "<over>" _))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
914 ("br" t ("clear" ("left") ("right")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
915 ("caption" ("valign" ("top") ("bottom")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
916 ("center" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
917 ("cite")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
918 ("code" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
919 ("dd" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
920 ("del")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
921 ("dfn")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
922 ("dl" (nil \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
923 ( "Term: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
924 "<dt>" str "<dd>" _ \n)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
925 ("dt" (t _ "<dd>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
926 ("em")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
927 ("fn" "id" "fn")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
928 ("head" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
929 ("html" (\n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
930 "<head>\n"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
931 "<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
932 "<body>\n<h1>" str "</h1>\n" _
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
933 "\n<address>\n<a href=\"mailto:"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
934 (user-login-name) ?@ (system-name)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
935 "\">" (user-full-name) "</a>\n</address>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
936 ("i")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
937 ("ins")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
938 ("isindex" t ("action") ("prompt"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
939 ("kbd")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
940 ("lang")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
941 ("li" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
942 ("math" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
943 ("nobr")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
944 ("option" t ("value") ("label") ("selected" t))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
945 ("over" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
946 ("person")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
947 ("pre" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
948 ("q")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
949 ("rev")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
950 ("s")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
951 ("samp")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
952 ("small")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
953 ("strong")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
954 ("sub")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
955 ("sup")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
956 ("title")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
957 ("tr" t)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
958 ("tt")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
959 ("u")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
960 ("var")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
961 ("wbr" t)))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
962 "*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
963
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
964 (defvar html-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
965 `(,@sgml-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
966 ("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
967 ("abbrev" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
968 ("acronym" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
969 ("address" . "Formatted mail address")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
970 ("array" . "Math array")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
971 ("au" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
972 ("b" . "Bold face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
973 ("base" . "Base address for URLs")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
974 ("big" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
975 ("blink" . "Blinking text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
976 ("blockquote" . "Indented quotation")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
977 ("body" . "Document body")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
978 ("box" . "Math fraction")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
979 ("br" . "Line break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
980 ("caption" . "Table caption")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
981 ("center" . "Centered text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
982 ("changed" . "Change bars")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
983 ("cite" . "Citation of a document")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
984 ("code" . "Formatted source code")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
985 ("dd" . "Definition of term")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
986 ("del" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
987 ("dfn" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
988 ("dir" . "Directory list (obsolete)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
989 ("dl" . "Definition list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
990 ("dt" . "Term to be definined")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
991 ("em" . "Emphasised")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
992 ("embed" . "Embedded data in foreign format")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
993 ("fig" . "Figure")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
994 ("figa" . "Figure anchor")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
995 ("figd" . "Figure description")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
996 ("figt" . "Figure text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
997 ("fn" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
998 ("font" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
999 ("form" . "Form with input fields")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1000 ("group" . "Document grouping")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1001 ("h1" . "Most important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1002 ("h2" . "Important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1003 ("h3" . "Section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1004 ("h4" . "Minor section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1005 ("h5" . "Unimportant section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1006 ("h6" . "Least important section headline")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1007 ("head" . "Document header")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1008 ("hr" . "Horizontal rule")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1009 ("html" . "HTML Document")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1010 ("i" . "Italic face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1011 ("img" . "Graphic image")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1012 ("input" . "Form input field")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1013 ("ins" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1014 ("isindex" . "Input field for index search")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1015 ("kbd" . "Keybard example face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1016 ("lang" . "Natural language")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1017 ("li" . "List item")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1018 ("link" . "Link relationship")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1019 ("math" . "Math formula")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1020 ("menu" . "Menu list (obsolete)")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1021 ("mh" . "Form mail header")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1022 ("nextid" . "Allocate new id")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1023 ("nobr" . "Text without line break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1024 ("ol" . "Ordered list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1025 ("option" . "Selection list item")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1026 ("over" . "Math fraction rule")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1027 ("p" . "Paragraph start")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1028 ("panel" . "Floating panel")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1029 ("person" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1030 ("pre" . "Preformatted fixed width text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1031 ("q" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1032 ("rev" . "Reverse video")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1033 ("s" . "?")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1034 ("samp" . "Sample text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1035 ("select" . "Selection list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1036 ("small" . "Font size")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1037 ("sp" . "Nobreak space")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1038 ("strong" . "Standout text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1039 ("sub" . "Subscript")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1040 ("sup" . "Superscript")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1041 ("table" . "Table with rows and columns")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1042 ("tb" . "Table vertical break")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1043 ("td" . "Table data cell")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1044 ("textarea" . "Form multiline edit area")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1045 ("th" . "Table header cell")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1046 ("title" . "Document title")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1047 ("tr" . "Table row separator")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1048 ("tt" . "Typewriter face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1049 ("u" . "Underlined text")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1050 ("ul" . "Unordered list")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1051 ("var" . "Math variable face")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1052 ("wbr" . "Enable <br> within <nobr>"))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1053 "*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
1054
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1055
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1056
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1057 ;;;###autoload
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1058 (defun html-mode ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1059 "Major mode based on SGML mode for editing HTML documents.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1060 This allows inserting skeleton costructs used in hypertext documents via
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1061 the command `<' with completion. See below for an introduction to HTML.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1062 Use \\[browse-url-of-buffer] to see how this comes out.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1063 See also `sgml-mode' on which this is based.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1064
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1065 Do \\[describe-variable] html- SPC to see available variables.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1066
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1067 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
1068 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
1069 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
1070 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
1071
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1072 <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
1073 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
1074 <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
1075
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1076 <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
1077 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
1078 <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
1079 Edit/Text Properties/Face commands.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1080
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1081 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
1082 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
1083 href=\"URL\">see also URL</a> where URL is a filename relative to current
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1084 directory or something like http://www.cs.indiana.edu/elisp/w3/docs.html.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1085
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1086 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
1087
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1088 If you mainly create your own documents, `sgml-specials' might be interesting.
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1089 But note that some HTML 2 browsers can't handle &apos;. To work around that
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1090 do:
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1091
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1092 \(eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1093 \\{html-mode-map}"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1094 (interactive)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1095 (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
1096 (use-local-map html-mode-map)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1097 (make-local-variable 'sgml-tag-alist)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1098 (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
1099 (make-local-variable 'sgml-tag-help)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1100 (make-local-variable 'outline-regexp)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1101 (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
1102 (make-local-variable 'outline-level)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1103 (setq mode-name "HTML"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1104 major-mode 'html-mode
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1105 sgml-tag-alist html-tag-alist
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1106 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
1107 sgml-tag-help html-tag-help
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1108 outline-regexp "^.*<[Hh][1-6]\\>"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1109 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
1110 outline-level (lambda ()
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1111 (char-after (1- (match-end 0)))))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1112 (run-hooks 'html-mode-hook))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1113
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1114
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1115 (define-skeleton html-href-anchor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1116 "HTML anchor tag with href attribute."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1117 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1118 "<a href=\"http:" _ "\"></a>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1119
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1120 (define-skeleton html-name-anchor
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1121 "HTML anchor tag with name attribute."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1122 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1123 "<a name=\"" _ "\"></a>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1124
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1125 (define-skeleton html-headline
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1126 "HTML headline tags."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1127 last-command-char
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1128 "<h" str ?> _ "</h" str ?>)
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 (define-skeleton html-horizontal-rule
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1131 "HTML horizontal rule tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1132 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1133 "<hr>" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1134
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1135 (define-skeleton html-image
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1136 "HTML image tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1137 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1138 "<img src=\"http:" _ "\">")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1139
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1140 (define-skeleton html-line
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1141 "HTML line break tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1142 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1143 "<br>" \n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1144
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1145 (define-skeleton html-list
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1146 "HTML unordered/ordered list tags."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1147 last-command-char
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1148 ?< str "l>" \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1149 "<li>" _ \n
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1150 "</" str "l>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1151
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1152 (define-skeleton html-list-item
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1153 "HTML list item tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1154 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1155 (if (bolp) nil '\n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1156 "<li>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1157
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1158 (define-skeleton html-paragraph
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1159 "HTML paragraph tag."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1160 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1161 (if (bolp) nil ?\n)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1162 \n "<p>")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1163
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1164 (define-skeleton html-radio-buttons
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1165 "Group of connected radio button inputs."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1166 nil
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1167 '(setq v1 (eval str)) ; allow passing name as argument
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1168 ("Value & Text: "
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1169 "<input type=\"radio\" name=\""
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1170 (or v1 (setq v1 (skeleton-read "Name: ")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1171 "\" value=\"" str ?\"
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1172 (if v2 "" " checked") ?> str
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1173 (or v2 (setq v2 (if (y-or-n-p "Newline? ") "<br>" ""))) \n))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1174
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1175
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1176 (defun html-autoview-mode (&optional arg)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1177 "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
1178 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
1179 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
1180 (interactive "P")
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1181 (if (setq arg (if arg
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1182 (< (prefix-numeric-value arg) 0)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1183 (and (boundp 'after-save-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1184 (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
1185 (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
1186 (make-local-hook 'after-save-hook)
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1187 (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
1188 (message "Autoviewing turned %s."
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1189 (if arg "off" "on")))
93175ed23e01 Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents: 12244
diff changeset
1190
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1191 ;;; sgml-mode.el ends here