Mercurial > emacs
annotate lisp/textmodes/sgml-mode.el @ 47341:bbfc60a6c247
(isearch-cmds): Add docstring.
(isearch-mouse-2): Lookup binding in the proper buffer.
Use call-interactively and remove the now useless `arg'.
(isearch-search-fun-function): New var.
(isearch-search-fun): New fun.
(isearch-search, isearch-lazy-highlight-search): Use it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 09 Sep 2002 21:05:22 +0000 |
parents | 66fb3c24b4ba |
children | 96093793b6b4 |
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 | 2 |
43692
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
3 ;; Copyright (C) 1992,95,96,98,2001,2002 Free Software Foundation, Inc. |
844
bf829a2d63b4
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
828
diff
changeset
|
4 |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
5 ;; Author: James Clark <jjc@jclark.com> |
43692
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
6 ;; Maintainer: FSF |
23869 | 7 ;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org>, |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
8 ;; F.Potorti@cnuce.cnr.it |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
9 ;; Keywords: wp, hypermedia, comm, languages |
809 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
12244 | 15 ;; the Free Software Foundation; either version 2, or (at your option) |
809 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
26 ;; Boston, MA 02111-1307, USA. | |
809 | 27 |
28 ;;; Commentary: | |
29 | |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
30 ;; 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
|
31 ;; 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
|
32 ;; HTML hypertext markup language. |
809 | 33 |
34 ;;; Code: | |
35 | |
25175 | 36 (eval-when-compile |
37 (require 'skeleton) | |
44388
01d388c4b0a3
Remember to (require 'cl).
Mike Williams <mdub@bigfoot.com>
parents:
44387
diff
changeset
|
38 (require 'outline) |
01d388c4b0a3
Remember to (require 'cl).
Mike Williams <mdub@bigfoot.com>
parents:
44387
diff
changeset
|
39 (require 'cl)) |
23726 | 40 |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
41 (defgroup sgml nil |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
42 "SGML editing mode" |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
43 :group 'languages) |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
44 |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
45 (defcustom sgml-basic-offset 2 |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
46 "*Specifies the basic indentation level for `sgml-indent-line'." |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
47 :type 'integer |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
48 :group 'sgml) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
49 |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
50 (defcustom sgml-transformation 'identity |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
51 "*Default value for `skeleton-transformation' (which see) in SGML mode." |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
52 :type 'function |
17530
9fb83ef40566
(sgml-transformation): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17500
diff
changeset
|
53 :group 'sgml) |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
54 |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
55 (put 'sgml-transformation 'variable-interactive |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
56 "aTransformation function: ") |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
57 |
25175 | 58 (defcustom sgml-mode-hook nil |
59 "Hook run by command `sgml-mode'. | |
60 `text-mode-hook' is run first." | |
61 :group 'sgml | |
62 :type 'hook) | |
63 | |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
64 ;; 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
|
65 ;; 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
|
66 ;; kludgy kind of tradeoff. |
16404
0cdf66e69ad8
(sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents:
15867
diff
changeset
|
67 (defvar sgml-specials '(?\") |
17551 | 68 "List of characters that have a special meaning for SGML mode. |
43589
57e4f81f3346
(sgml-specials, sgml-quick-keys): Doc fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
40624
diff
changeset
|
69 This list is used when first loading the `sgml-mode' library. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
70 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
|
71 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
72 ?\\\" Makes \" in text start a string. |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
73 ?' Makes ' in text start a string. |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
74 ?- Makes -- in text start a comment. |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
75 |
22319
18b5b2445726
(sgml-font-lock-keywords-1): Add -. as
Dave Love <fx@gnu.org>
parents:
22222
diff
changeset
|
76 When only one of ?\\\" or ?' are included, \"'\" or '\"', as can be found in |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
77 DTDs, start a string. To partially avoid this problem this also makes these |
16404
0cdf66e69ad8
(sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents:
15867
diff
changeset
|
78 self insert as named entities depending on `sgml-quick-keys'. |
0cdf66e69ad8
(sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents:
15867
diff
changeset
|
79 |
0cdf66e69ad8
(sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents:
15867
diff
changeset
|
80 Including ?- has the problem of affecting dashes that have nothing to do |
0cdf66e69ad8
(sgml-specials): Delete `-' from the list.
Richard M. Stallman <rms@gnu.org>
parents:
15867
diff
changeset
|
81 with comments, so we normally turn it off.") |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
82 |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
83 (defvar sgml-quick-keys nil |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
84 "Use <, >, &, /, SPC and `sgml-specials' keys \"electrically\" when non-nil. |
43589
57e4f81f3346
(sgml-specials, sgml-quick-keys): Doc fixes.
Pavel Janík <Pavel@Janik.cz>
parents:
40624
diff
changeset
|
85 This takes effect when first loading the `sgml-mode' library.") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
86 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
87 (defvar sgml-mode-map |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
88 (let ((map (make-keymap)) ;`sparse' doesn't allow binding to charsets. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
89 (menu-map (make-sparse-keymap "SGML"))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
90 (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
|
91 (define-key map "/" 'sgml-slash) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
92 (define-key map "\C-c\C-n" 'sgml-name-char) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
93 (define-key map "\C-c\C-t" 'sgml-tag) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
94 (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
|
95 (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
|
96 (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
|
97 (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
|
98 (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
|
99 (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
|
100 (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
|
101 (define-key map "\C-c?" 'sgml-tag-help) |
44333
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
102 (define-key map "\C-c/" 'sgml-close-tag) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
103 (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
|
104 (define-key map "\C-c\C-v" 'sgml-validate) |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
105 (when sgml-quick-keys |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
106 (define-key map "&" 'sgml-name-char) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
107 (define-key map "<" 'sgml-tag) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
108 (define-key map " " 'sgml-auto-attributes) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
109 (define-key map ">" 'sgml-maybe-end-tag) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
110 (when (memq ?\" sgml-specials) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
111 (define-key map "\"" 'sgml-name-self)) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
112 (when (memq ?' sgml-specials) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
113 (define-key map "'" 'sgml-name-self))) |
38108
f535923264bd
(sgml-mode-map): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38068
diff
changeset
|
114 (define-key map (vector (make-char 'latin-iso8859-1)) |
f535923264bd
(sgml-mode-map): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38068
diff
changeset
|
115 'sgml-maybe-name-self) |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
116 (let ((c 127) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
117 (map (nth 1 map))) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
118 (while (< (setq c (1+ c)) 256) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
119 (aset map c 'sgml-maybe-name-self))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
120 (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
|
121 (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
|
122 (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
|
123 '("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
|
124 (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
|
125 '("Toggle Tag Visibility" . sgml-tags-invisible)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
126 (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
|
127 '("Describe Tag" . sgml-tag-help)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
128 (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
|
129 '("Delete Tag" . sgml-delete-tag)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
130 (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
|
131 '("Forward Tag" . sgml-skip-tag-forward)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
132 (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
|
133 '("Backward Tag" . sgml-skip-tag-backward)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
134 (define-key menu-map [sgml-attributes] |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
135 '("Insert Attributes" . sgml-attributes)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
136 (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
|
137 map) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
138 "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
|
139 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
140 (defun sgml-make-syntax-table (specials) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
141 (let ((table (make-syntax-table text-mode-syntax-table))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
142 (modify-syntax-entry ?< "(>" table) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
143 (modify-syntax-entry ?> ")<" table) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
144 (modify-syntax-entry ?: "_" table) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
145 (modify-syntax-entry ?_ "_" table) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
146 (modify-syntax-entry ?. "_" table) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
147 (if (memq ?- specials) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
148 (modify-syntax-entry ?- "_ 1234" table)) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
149 (if (memq ?\" specials) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
150 (modify-syntax-entry ?\" "\"\"" table)) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
151 (if (memq ?' specials) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
152 (modify-syntax-entry ?\' "\"'" table)) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
153 table)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
154 |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
155 (defvar sgml-mode-syntax-table (sgml-make-syntax-table sgml-specials) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
156 "Syntax table used in SGML mode. See also `sgml-specials'.") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
157 |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
158 (defconst sgml-tag-syntax-table |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
159 (let ((table (sgml-make-syntax-table '(?- ?\" ?\')))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
160 (dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
161 (modify-syntax-entry char "." table)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
162 table) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
163 "Syntax table used to parse SGML tags.") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
164 |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
165 (defcustom sgml-name-8bit-mode nil |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
166 "*When non-nil, insert non-ASCII characters as named entities." |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
167 :type 'boolean |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
168 :group 'sgml) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
169 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
170 (defvar sgml-char-names |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
171 [nil nil nil nil nil nil nil nil |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
172 nil nil nil nil nil nil nil nil |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
173 nil nil nil nil nil nil nil nil |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
174 nil nil nil nil nil nil nil nil |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
175 "nbsp" "excl" "quot" "num" "dollar" "percnt" "amp" "apos" |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
176 "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
|
177 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
|
178 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
|
179 "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
|
180 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
|
181 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
|
182 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
|
183 "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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 "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
|
192 "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
|
193 "ring" "plusmn" "sup2" "sup3" "acute" "micro" "para" "middot" |
26250
194bcc8d17db
* textmodes/sgml-mode.el (sgml-char-names): Change "half" to
Gerd Moellmann <gerd@gnu.org>
parents:
25175
diff
changeset
|
194 "cedil" "sup1" "ordm" "raquo" "frac14" "frac12" "frac34" "iquest" |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
195 "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
|
196 "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
|
197 "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
|
198 "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
|
199 "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
|
200 "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
|
201 "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
|
202 "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
|
203 "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
|
204 |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
205 (put 'sgml-table 'char-table-extra-slots 0) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
206 |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
207 (defvar sgml-char-names-table |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
208 (let ((table (make-char-table 'sgml-table)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
209 (i 32) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
210 elt) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
211 (while (< i 256) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
212 (setq elt (aref sgml-char-names i)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
213 (if elt (aset table (make-char 'latin-iso8859-1 i) elt)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
214 (setq i (1+ i))) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
215 table) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
216 "A table for mapping non-ASCII characters into SGML entity names. |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
217 Currently, only Latin-1 characters are supported.") |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
218 |
25052
d2a4359531e0
(sgml-validate-command): Use nsgmls.
Dave Love <fx@gnu.org>
parents:
24463
diff
changeset
|
219 ;; nsgmls is a free SGML parser in the SP suite available from |
d2a4359531e0
(sgml-validate-command): Use nsgmls.
Dave Love <fx@gnu.org>
parents:
24463
diff
changeset
|
220 ;; ftp.jclark.com and otherwise packaged for GNU systems. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
221 ;; 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
|
222 ;; The -s option suppresses output. |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
223 |
25052
d2a4359531e0
(sgml-validate-command): Use nsgmls.
Dave Love <fx@gnu.org>
parents:
24463
diff
changeset
|
224 (defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls' |
809 | 225 "*The command to validate an SGML document. |
226 The file name of current buffer file name will be appended to this, | |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
227 separated by a space." |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
228 :type 'string |
25175 | 229 :version "21.1" |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
230 :group 'sgml) |
809 | 231 |
232 (defvar sgml-saved-validate-command nil | |
233 "The command last used to validate in this buffer.") | |
234 | |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
235 ;; I doubt that null end tags are used much for large elements, |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
236 ;; so use a small distance here. |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
237 (defcustom sgml-slash-distance 1000 |
17551 | 238 "*If non-nil, is the maximum distance to search for matching `/'." |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
239 :type '(choice (const nil) integer) |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
240 :group 'sgml) |
809 | 241 |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
242 (defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*") |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
243 (defconst sgml-tag-name-re (concat "<\\([!/?]?" sgml-name-re "\\)")) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
244 (defconst sgml-attrs-re "\\(?:[^\"'/><]\\|\"[^\"]*\"\\|'[^']*'\\)*") |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
245 (defconst sgml-start-tag-regex (concat "<" sgml-name-re sgml-attrs-re) |
809 | 246 "Regular expression that matches a non-empty start tag. |
17551 | 247 Any terminating `>' or `/' is not matched.") |
809 | 248 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
249 |
21780
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
250 ;; internal |
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
251 (defconst sgml-font-lock-keywords-1 |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
252 `((,(concat "<\\([!?]" sgml-name-re "\\)") 1 font-lock-keyword-face) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
253 (,(concat "<\\(/?" sgml-name-re"\\)") 1 font-lock-function-name-face) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
254 ;; FIXME: this doesn't cover the variables using a default value. |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
255 (,(concat "\\(" sgml-name-re "\\)=[\"']") 1 font-lock-variable-name-face) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
256 (,(concat "[&%]" sgml-name-re ";?") . font-lock-variable-name-face))) |
21780
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
257 |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
258 (defconst sgml-font-lock-keywords-2 |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
259 (append |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
260 sgml-font-lock-keywords-1 |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
261 '((eval |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
262 . (cons (concat "<" |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
263 (regexp-opt (mapcar 'car sgml-tag-face-alist) t) |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
264 "\\([ \t][^>]*\\)?>\\([^<]+\\)</\\1>") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
265 '(3 (cdr (assoc (downcase (match-string 1)) |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
266 sgml-tag-face-alist)))))))) |
21780
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
267 |
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
268 ;; for font-lock, but must be defvar'ed after |
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
269 ;; sgml-font-lock-keywords-1 and sgml-font-lock-keywords-2 above |
5dc3fe7cd300
(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords.
Richard M. Stallman <rms@gnu.org>
parents:
20922
diff
changeset
|
270 (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
271 "*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
|
272 |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
273 (defvar sgml-font-lock-syntactic-keywords |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
274 ;; Use the `b' style of comments to avoid interference with the -- ... -- |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
275 ;; comments recognized when `sgml-specials' includes ?-. |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
276 ;; FIXME: beware of <!--> blabla <!--> !! |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
277 '(("\\(<\\)!--" (1 "< b")) |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
278 ("--[ \t\n]*\\(>\\)" (1 "> b"))) |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
279 "Syntactic keywords for `sgml-mode'.") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
280 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
281 ;; internal |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
282 (defvar sgml-face-tag-alist () |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
283 "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
|
284 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
285 (defvar sgml-tag-face-alist () |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
286 "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
|
287 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
|
288 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
|
289 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
290 (defvar sgml-display-text () |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
291 "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
|
292 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
293 ;; internal |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
294 (defvar sgml-tags-invisible nil) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
295 |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
296 (defcustom sgml-tag-alist |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
297 '(("![" ("ignore" t) ("include" t)) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
298 ("!attlist") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
299 ("!doctype") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
300 ("!element") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
301 ("!entity")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
302 "*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
|
303 This alist is made up as |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
304 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
305 ((\"tag\" . TAGRULE) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
306 ...) |
809 | 307 |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
308 TAGRULE is a list of optionally t (no endtag) or `\\n' (separate endtag by |
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
309 newlines) or a skeleton with nil, t or `\\n' in place of the interactor |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
310 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
|
311 attribute alist. |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
312 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
313 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
|
314 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
315 ((\"attribute\" . ATTRIBUTERULE) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
316 ...) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
317 |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
318 ATTRIBUTERULE is a list of optionally t (no value when no input) followed by |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
319 an optional alist of possible values." |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
320 :type '(repeat (cons (string :tag "Tag Name") |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
321 (repeat :tag "Tag Rule" sexp))) |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
322 :group 'sgml) |
809 | 323 |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
324 (defcustom sgml-tag-help |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
325 '(("!" . "Empty declaration for comment") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
326 ("![" . "Embed declarations with parser directive") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
327 ("!attlist" . "Tag attributes declaration") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
328 ("!doctype" . "Document type (DTD) declaration") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
329 ("!element" . "Tag declaration") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
330 ("!entity" . "Entity (macro) declaration")) |
17432
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
331 "*Alist of tag name and short description." |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
332 :type '(repeat (cons (string :tag "Tag Name") |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
333 (string :tag "Description"))) |
5d2e0051fe39
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17309
diff
changeset
|
334 :group 'sgml) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
335 |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
336 (defcustom sgml-xml-mode nil |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
337 "*When non-nil, tag insertion functions will be XML-compliant. |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
338 If this variable is customized, the custom value is used always. |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
339 Otherwise, it is set to be buffer-local when the file has |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
340 a DOCTYPE or an XML declaration." |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
341 :type 'boolean |
45255
20c79f08a7da
Change all post-21.1 :version attributes to 21.4.
Eli Zaretskii <eliz@gnu.org>
parents:
44619
diff
changeset
|
342 :version "21.4" |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
343 :group 'sgml) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
344 |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
345 (defvar sgml-empty-tags nil |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
346 "List of tags whose !ELEMENT definition says EMPTY.") |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
347 |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
348 (defvar sgml-unclosed-tags nil |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
349 "List of tags whose !ELEMENT definition says the end-tag is optional.") |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
350 |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
351 (defun sgml-xml-guess () |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
352 "Guess whether the current buffer is XML." |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
353 (save-excursion |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
354 (goto-char (point-min)) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
355 (when (or (string= "xml" (file-name-extension (or buffer-file-name ""))) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
356 (looking-at "\\s-*<\\?xml") |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
357 (when (re-search-forward |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
358 (eval-when-compile |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
359 (mapconcat 'identity |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
360 '("<!DOCTYPE" "\\(\\w+\\)" "\\(\\w+\\)" |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
361 "\"\\([^\"]+\\)\"" "\"\\([^\"]+\\)\"") |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
362 "\\s-+")) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
363 nil t) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
364 (string-match "X\\(HT\\)?ML" (match-string 3)))) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
365 (set (make-local-variable 'sgml-xml-mode) t)))) |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
366 |
23726 | 367 (defvar v2) ; free for skeleton |
368 | |
44443
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
369 (defun sgml-comment-indent-new-line (&optional soft) |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
370 (let ((comment-start "-- ") |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
371 (comment-start-skip "\\(<!\\)?--[ \t]*") |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
372 (comment-end " --") |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
373 (comment-style 'plain)) |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
374 (comment-indent-new-line soft))) |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
375 |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
376 (defun sgml-mode-facemenu-add-face-function (face end) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
377 (if (setq face (cdr (assq face sgml-face-tag-alist))) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
378 (progn |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
379 (setq face (funcall skeleton-transformation face)) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
380 (setq facemenu-end-add-face (concat "</" face ">")) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
381 (concat "<" face ">")) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
382 (error "Face not configured for %s mode" mode-name))) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
383 |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
384 ;;;###autoload |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
385 (define-derived-mode sgml-mode text-mode "SGML" |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
386 "Major mode for editing SGML documents. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
387 Makes > match <. |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
388 Keys <, &, SPC within <>, \", / and ' can be electric depending on |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
389 `sgml-quick-keys'. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
390 |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
391 An argument of N to a tag-inserting command means to wrap it around |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
392 the next N words. In Transient Mark mode, when the mark is active, |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
393 N defaults to -1, which means to wrap it around the current region. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
394 |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
395 If you like upcased tags, put (setq sgml-transformation 'upcase) in |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
396 your `.emacs' file. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
397 |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
398 Use \\[sgml-validate] to validate your document with an SGML parser. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
399 |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
400 Do \\[describe-variable] sgml- SPC to see available variables. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
401 Do \\[describe-key] on the following bindings to discover what they do. |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
402 \\{sgml-mode-map}" |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
403 (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
|
404 (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
|
405 ;;(make-local-variable 'facemenu-remove-face-function) |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
406 ;; A start or end tag by itself on a line separates a paragraph. |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
407 ;; This is desirable because SGML discards a newline that appears |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
408 ;; immediately after a start tag or immediately before an end tag. |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
409 (set (make-local-variable 'paragraph-start) (concat "[ \t]*$\\|\ |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
410 \[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>")) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
411 (set (make-local-variable 'paragraph-separate) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
412 (concat paragraph-start "$")) |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
413 (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*") |
44293
a1bba2ef8c34
(sgml-mode): Set indent-line-function to sgml-indent-line.
Mike Williams <mdub@bigfoot.com>
parents:
44286
diff
changeset
|
414 (set (make-local-variable 'indent-line-function) 'sgml-indent-line) |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
415 (set (make-local-variable 'comment-start) "<!-- ") |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
416 (set (make-local-variable 'comment-end) " -->") |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
417 (set (make-local-variable 'comment-indent-function) 'sgml-comment-indent) |
44443
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
418 (set (make-local-variable 'comment-line-break-function) |
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
419 'sgml-comment-indent-new-line) |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
420 (set (make-local-variable 'skeleton-further-elements) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
421 '((completion-ignore-case t))) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
422 (set (make-local-variable 'skeleton-end-hook) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
423 (lambda () |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
424 (or (eolp) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
425 (not (or (eq v2 '\n) (eq (car-safe v2) '\n))) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
426 (newline-and-indent)))) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
427 (set (make-local-variable 'font-lock-defaults) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
428 '((sgml-font-lock-keywords |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
429 sgml-font-lock-keywords-1 |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
430 sgml-font-lock-keywords-2) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
431 nil t nil nil |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
432 (font-lock-syntactic-keywords |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
433 . sgml-font-lock-syntactic-keywords))) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
434 (set (make-local-variable 'facemenu-add-face-function) |
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
435 'sgml-mode-facemenu-add-face-function) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
436 (sgml-xml-guess) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
437 (if sgml-xml-mode |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
438 (setq mode-name "XML") |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
439 (set (make-local-variable 'skeleton-transformation) sgml-transformation)) |
36609
8e1755c3dd2b
(sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27683
diff
changeset
|
440 ;; This will allow existing comments within declarations to be |
8e1755c3dd2b
(sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27683
diff
changeset
|
441 ;; recognized. |
8e1755c3dd2b
(sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27683
diff
changeset
|
442 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*") |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
443 (set (make-local-variable 'comment-end-skip) "[ \t]*--\\([ \t\n]*>\\)?") |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
444 ;; This definition probably is not useful in derived modes. |
40377
ea7ef845ccf3
renamed `html-xhtml' to `sgml-xml' and generalized accordingly
Sam Steingold <sds@gnu.org>
parents:
40350
diff
changeset
|
445 (set (make-local-variable 'imenu-generic-expression) |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
446 (concat "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\(" |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
447 sgml-name-re "\\)"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
448 |
45557
1cae8564d2c7
(xml-mode): New alias for `sgml-mode'.
Colin Walters <walters@gnu.org>
parents:
45463
diff
changeset
|
449 ;; Some programs (such as Glade 2) generate XML which has |
1cae8564d2c7
(xml-mode): New alias for `sgml-mode'.
Colin Walters <walters@gnu.org>
parents:
45463
diff
changeset
|
450 ;; -*- mode: xml -*-. |
1cae8564d2c7
(xml-mode): New alias for `sgml-mode'.
Colin Walters <walters@gnu.org>
parents:
45463
diff
changeset
|
451 (defalias 'xml-mode 'sgml-mode) |
1cae8564d2c7
(xml-mode): New alias for `sgml-mode'.
Colin Walters <walters@gnu.org>
parents:
45463
diff
changeset
|
452 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
453 (defun sgml-comment-indent () |
36609
8e1755c3dd2b
(sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27683
diff
changeset
|
454 (if (looking-at "--") comment-column 0)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
455 |
809 | 456 (defun sgml-slash (arg) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
457 "Insert ARG slash characters. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
458 Behaves electrically if `sgml-quick-keys' is non-nil." |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
459 (interactive "p") |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
460 (cond |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
461 ((not (and (eq (char-before) ?<) (= arg 1))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
462 (sgml-slash-matching arg)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
463 ((eq sgml-quick-keys 'indent) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
464 (insert-char ?/ 1) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
465 (indent-according-to-mode)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
466 ((eq sgml-quick-keys 'close) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
467 (delete-backward-char 1) |
44333
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
468 (sgml-close-tag)) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
469 (t |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
470 (sgml-slash-matching arg)))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
471 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
472 (defun sgml-slash-matching (arg) |
17551 | 473 "Insert `/' and display any previous matching `/'. |
474 Two `/'s are treated as matching if the first `/' ends a net-enabling | |
475 start tag, and the second `/' is the corresponding null end tag." | |
809 | 476 (interactive "p") |
477 (insert-char ?/ arg) | |
478 (if (> arg 0) | |
479 (let ((oldpos (point)) | |
480 (blinkpos) | |
481 (level 0)) | |
482 (save-excursion | |
483 (save-restriction | |
484 (if sgml-slash-distance | |
485 (narrow-to-region (max (point-min) | |
486 (- (point) sgml-slash-distance)) | |
487 oldpos)) | |
488 (if (and (re-search-backward sgml-start-tag-regex (point-min) t) | |
489 (eq (match-end 0) (1- oldpos))) | |
490 () | |
491 (goto-char (1- oldpos)) | |
492 (while (and (not blinkpos) | |
493 (search-backward "/" (point-min) t)) | |
494 (let ((tagend (save-excursion | |
495 (if (re-search-backward sgml-start-tag-regex | |
496 (point-min) t) | |
497 (match-end 0) | |
498 nil)))) | |
499 (if (eq tagend (point)) | |
500 (if (eq level 0) | |
501 (setq blinkpos (point)) | |
502 (setq level (1- level))) | |
503 (setq level (1+ level))))))) | |
40343
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
504 (when blinkpos |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
505 (goto-char blinkpos) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
506 (if (pos-visible-in-window-p) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
507 (sit-for 1) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
508 (message "Matches %s" |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
509 (buffer-substring (line-beginning-position) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
510 (1+ blinkpos))))))))) |
809 | 511 |
43692
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
512 ;; Why doesn't this use the iso-cvt table or, preferably, generate the |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
513 ;; inverse of the extensive table in the SGML Quail input method? -- fx |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
514 ;; I guess that's moot since it only works with Latin-1 anyhow. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
515 (defun sgml-name-char (&optional char) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
516 "Insert a symbolic character name according to `sgml-char-names'. |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
517 Non-ASCII chars may be inserted either with the meta key, as in M-SPC for |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
518 no-break space or M-- for a soft hyphen; or via an input method or |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
519 encoded keyboard operation." |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
520 (interactive "*") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
521 (insert ?&) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
522 (or char |
17500
e8d7c7e2acab
(sgml-name-char): Ask user with a prompt.
Richard M. Stallman <rms@gnu.org>
parents:
17491
diff
changeset
|
523 (setq char (read-quoted-char "Enter char or octal number"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
524 (delete-backward-char 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
525 (insert char) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
526 (undo-boundary) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
527 (delete-backward-char 1) |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
528 (cond |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
529 ((< char 256) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
530 (insert ?& |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
531 (or (aref sgml-char-names char) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
532 (format "#%d" char)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
533 ?\;)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
534 ((aref sgml-char-names-table char) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
535 (insert ?& (aref sgml-char-names-table char) ?\;)) |
43692
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
536 ((let ((c (encode-char char 'ucs))) |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
537 (when c |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
538 (insert (format "&#%d;" c)) |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
539 t))) |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
540 (t ; should be an error? -- fx |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
541 (insert char)))) |
14159
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-name-self () |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
544 "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
|
545 (interactive "*") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
546 (sgml-name-char last-command-char)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
547 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
548 (defun sgml-maybe-name-self () |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
549 "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
|
550 (interactive "*") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
551 (if sgml-name-8bit-mode |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
552 (let ((mc last-command-char)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
553 (if (< mc 256) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
554 (setq mc (unibyte-char-to-multibyte mc))) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
555 (or mc (setq mc last-command-char)) |
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
556 (sgml-name-char mc)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
557 (self-insert-command 1))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
558 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
559 (defun sgml-name-8bit-mode () |
43692
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
560 "Toggle whether to insert named entities instead of non-ASCII characters. |
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
561 This only works for Latin-1 input." |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
562 (interactive) |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
563 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode)) |
40176
744190a4880c
(sgml-mode-map): Bind 8-bit codes above 127 to sgml-maybe-name-self.
Eli Zaretskii <eliz@gnu.org>
parents:
39616
diff
changeset
|
564 (message "sgml name entity mode is now %s" |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
565 (if sgml-name-8bit-mode "ON" "OFF"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
566 |
17551 | 567 ;; When an element of a skeleton is a string "str", it is passed |
568 ;; through skeleton-transformation and inserted. If "str" is to be | |
569 ;; inserted literally, one should obtain it as the return value of a | |
570 ;; function, e.g. (identity "str"). | |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
571 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
572 (define-skeleton sgml-tag |
17551 | 573 "Prompt for a tag and insert it, optionally with attributes. |
574 Completion and configuration are done according to `sgml-tag-alist'. | |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
575 If you like tags and attributes in uppercase do \\[set-variable] |
17551 | 576 skeleton-transformation RET upcase RET, or put this in your `.emacs': |
577 (setq sgml-transformation 'upcase)" | |
45286
6373f485f3c2
(sgml-tag): Default skeleton-transformation to `identity'.
Mike Williams <mdub@bigfoot.com>
parents:
45255
diff
changeset
|
578 (funcall (or skeleton-transformation 'identity) |
6373f485f3c2
(sgml-tag): Default skeleton-transformation to `identity'.
Mike Williams <mdub@bigfoot.com>
parents:
45255
diff
changeset
|
579 (completing-read "Tag: " sgml-tag-alist)) |
36609
8e1755c3dd2b
(sgml-mode-common): Correct value of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
27683
diff
changeset
|
580 ?< str | |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
581 (("") -1 '(undo-boundary) (identity "<")) | ; see comment above |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
582 `(("") '(setq v2 (sgml-attributes ,str t)) ?> |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
583 (cond |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
584 ((string= "![" ,str) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
585 (backward-char) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
586 '(("") " [ " _ " ]]")) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
587 ((and (eq v2 t) sgml-xml-mode (member ,str sgml-empty-tags)) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
588 '(("") -1 "/>")) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
589 ((or (and (eq v2 t) (not sgml-xml-mode)) (string-match "^[/!?]" ,str)) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
590 nil) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
591 ((symbolp v2) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
592 ;; Make sure we don't fall into an infinite loop. |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
593 ;; For xhtml's `tr' tag, we should maybe use \n instead. |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
594 (if (eq v2 t) (setq v2 nil)) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
595 ;; We use `identity' to prevent skeleton from passing |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
596 ;; `str' through skeleton-transformation a second time. |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
597 '(("") v2 _ v2 "</" (identity ',str) ?>)) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
598 ((eq (car v2) t) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
599 (cons '("") (cdr v2))) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
600 (t |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
601 (append '(("") (car v2)) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
602 (cdr v2) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
603 '(resume: (car v2) _ "</" (identity ',str) ?>)))))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
604 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
605 (autoload 'skeleton-read "skeleton") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
606 |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
607 (defun sgml-attributes (tag &optional quiet) |
17551 | 608 "When at top level of a tag, interactively insert attributes. |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
609 |
17551 | 610 Completion and configuration of TAG are done according to `sgml-tag-alist'. |
611 If QUIET, do not print a message when there are no attributes for TAG." | |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
612 (interactive (list (save-excursion (sgml-beginning-of-tag t)))) |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
613 (or (stringp tag) (error "Wrong context for adding attribute")) |
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
614 (if tag |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
615 (let ((completion-ignore-case t) |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
616 (alist (cdr (assoc (downcase tag) sgml-tag-alist))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
617 car attribute i) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
618 (if (or (symbolp (car alist)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
619 (symbolp (car (car alist)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
620 (setq car (car alist) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
621 alist (cdr alist))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
622 (or quiet |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
623 (message "No attributes configured.")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
624 (if (stringp (car alist)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
625 (progn |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
626 (insert (if (eq (preceding-char) ? ) "" ? ) |
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
627 (funcall skeleton-transformation (car alist))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
628 (sgml-value alist)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
629 (setq i (length alist)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
630 (while (> i 0) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
631 (insert ? ) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
632 (insert (funcall skeleton-transformation |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
633 (setq attribute |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
634 (skeleton-read '(completing-read |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
635 "Attribute: " |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
636 alist))))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
637 (if (string= "" attribute) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
638 (setq i 0) |
20922
3ae81bc17b19
(sgml-mode-common): Downcase key for
Dave Love <fx@gnu.org>
parents:
20394
diff
changeset
|
639 (sgml-value (assoc (downcase attribute) alist)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
640 (setq i (1- i)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
641 (if (eq (preceding-char) ? ) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
642 (delete-backward-char 1))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
643 car))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
644 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
645 (defun sgml-auto-attributes (arg) |
17551 | 646 "Self insert the character typed; at top level of tag, prompt for attributes. |
647 With prefix argument, only self insert." | |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
648 (interactive "*P") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
649 (let ((point (point)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
650 tag) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
651 (if (or arg |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
652 (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
|
653 (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
|
654 (eq (aref tag 0) ?/)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
655 (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
|
656 (sgml-attributes tag) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
657 (setq last-command-char ? ) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
658 (or (> (point) point) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
659 (self-insert-command 1))))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
660 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
661 (defun sgml-tag-help (&optional tag) |
17551 | 662 "Display description of tag TAG. If TAG is omitted, use the tag at point." |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
663 (interactive) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
664 (or tag |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
665 (save-excursion |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
666 (if (eq (following-char) ?<) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
667 (forward-char)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
668 (setq tag (sgml-beginning-of-tag)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
669 (or (stringp tag) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
670 (error "No tag selected")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
671 (setq tag (downcase tag)) |
14328
5d0e329a44d8
(sgml-tag-help): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14270
diff
changeset
|
672 (message "%s" |
20922
3ae81bc17b19
(sgml-mode-common): Downcase key for
Dave Love <fx@gnu.org>
parents:
20394
diff
changeset
|
673 (or (cdr (assoc (downcase tag) sgml-tag-help)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
674 (and (eq (aref tag 0) ?/) |
20922
3ae81bc17b19
(sgml-mode-common): Downcase key for
Dave Love <fx@gnu.org>
parents:
20394
diff
changeset
|
675 (cdr (assoc (downcase (substring tag 1)) sgml-tag-help))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
676 "No description available"))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
677 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
678 (defun sgml-maybe-end-tag (&optional arg) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
679 "Name self unless in position to end a tag or a prefix ARG is given." |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
680 (interactive "P") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
681 (if (or arg (eq (car (sgml-lexical-context)) 'tag)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
682 (self-insert-command (prefix-numeric-value arg)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
683 (sgml-name-self))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
684 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
685 (defun sgml-skip-tag-backward (arg) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
686 "Skip to beginning of tag or matching opening tag if present. |
17551 | 687 With prefix argument ARG, repeat this ARG times." |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
688 (interactive "p") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
689 (while (>= arg 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
690 (search-backward "<" nil t) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
691 (if (looking-at "</\\([^ \n\t>]+\\)") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
692 ;; end tag, skip any nested pairs |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
693 (let ((case-fold-search t) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
694 (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
|
695 (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
|
696 (eq (char-after (1+ (point))) ?/)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
697 (forward-char 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
698 (sgml-skip-tag-backward 1)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
699 (setq arg (1- arg)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
700 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
701 (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
|
702 "Skip to end of tag or matching closing tag if present. |
17551 | 703 With prefix argument ARG, repeat this ARG times. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
704 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
|
705 (interactive "p") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
706 (setq return t) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
707 (while (>= arg 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
708 (skip-chars-forward "^<>") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
709 (if (eq (following-char) ?>) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
710 (up-list -1)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
711 (if (looking-at "<\\([^/ \n\t>]+\\)") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
712 ;; 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
|
713 (let ((case-fold-search t) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
714 (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
|
715 point close) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
716 (forward-list 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
717 (setq point (point)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
718 (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
|
719 (not (setq close |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
720 (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
|
721 (not (up-list -1)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
722 (sgml-skip-tag-forward 1)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
723 (setq close nil)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
724 (if close |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
725 (up-list 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
726 (goto-char point) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
727 (setq return))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
728 (forward-list 1)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
729 (setq arg (1- arg))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
730 return) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
731 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
732 (defun sgml-delete-tag (arg) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
733 "Delete tag on or after cursor, and matching closing or opening tag. |
17551 | 734 With prefix argument ARG, repeat this ARG times." |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
735 (interactive "p") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
736 (while (>= arg 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
737 (save-excursion |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
738 (let* (close open) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
739 (if (looking-at "[ \t\n]*<") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
740 ;; just before tag |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
741 (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
|
742 ;; closing tag |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
743 (progn |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
744 (setq close (point)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
745 (goto-char (match-end 0)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
746 ;; on tag? |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
747 (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
|
748 close (and (stringp close) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
749 (eq (aref close 0) ?/) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
750 (point)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
751 ;; not on closing tag |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
752 (let ((point (point))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
753 (sgml-skip-tag-backward 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
754 (if (or (not (eq (following-char) ?<)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
755 (save-excursion |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
756 (forward-list 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
757 (<= (point) point))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
758 (error "Not on or before tag"))))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
759 (if close |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
760 (progn |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
761 (sgml-skip-tag-backward 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
762 (setq open (point)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
763 (goto-char close) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
764 (kill-sexp 1)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
765 (setq open (point)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
766 (sgml-skip-tag-forward 1) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
767 (backward-list) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
768 (forward-char) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
769 (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
|
770 (kill-sexp 1))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
771 (goto-char open) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
772 (kill-sexp 1))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
773 (setq arg (1- arg)))) |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
774 |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
775 |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
776 ;; Put read-only last to enable setting this even when read-only enabled. |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
777 (or (get 'sgml-tag 'invisible) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
778 (setplist 'sgml-tag |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
779 (append '(invisible t |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
780 intangible t |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
781 point-entered sgml-point-entered |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
782 rear-nonsticky t |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
783 read-only t) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
784 (symbol-plist 'sgml-tag)))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
785 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
786 (defun sgml-tags-invisible (arg) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
787 "Toggle visibility of existing tags." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
788 (interactive "P") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
789 (let ((modified (buffer-modified-p)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
790 (inhibit-read-only t) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
791 (inhibit-modification-hooks t) |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
792 ;; Avoid spurious the `file-locked' checks. |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
793 (buffer-file-name nil) |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
794 ;; This is needed in case font lock gets called, |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
795 ;; since it moves point and might call sgml-point-entered. |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
796 ;; How could it get called? -stef |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
797 (inhibit-point-motion-hooks t) |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
798 string) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
799 (unwind-protect |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
800 (save-excursion |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
801 (goto-char (point-min)) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
802 (if (set (make-local-variable 'sgml-tags-invisible) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
803 (if arg |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
804 (>= (prefix-numeric-value arg) 0) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
805 (not sgml-tags-invisible))) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
806 (while (re-search-forward sgml-tag-name-re nil t) |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
807 (setq string |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
808 (cdr (assq (intern-soft (downcase (match-string 1))) |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
809 sgml-display-text))) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
810 (goto-char (match-beginning 0)) |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
811 (and (stringp string) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
812 (not (overlays-at (point))) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
813 (let ((ol (make-overlay (point) (match-beginning 1)))) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
814 (overlay-put ol 'before-string string) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
815 (overlay-put ol 'sgml-tag t))) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
816 (put-text-property (point) |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
817 (progn (forward-list) (point)) |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
818 'category 'sgml-tag)) |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
819 (let ((pos (point-min))) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
820 (while (< (setq pos (next-overlay-change pos)) (point-max)) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
821 (dolist (ol (overlays-at pos)) |
40393
591afd36f0b3
(sgml-tags-invisible): Typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40392
diff
changeset
|
822 (if (overlay-get ol 'sgml-tag) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
823 (delete-overlay ol))))) |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
824 (remove-text-properties (point-min) (point-max) '(category nil)))) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
825 (restore-buffer-modified-p modified)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
826 (run-hooks 'sgml-tags-invisible-hook) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
827 (message ""))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
828 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
829 (defun sgml-point-entered (x y) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
830 ;; 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
|
831 (let ((inhibit-point-motion-hooks t)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
832 (save-excursion |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
833 (message "Invisible tag: %s" |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
834 ;; Strip properties, otherwise, the text is invisible. |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
835 (buffer-substring-no-properties |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
836 (point) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
837 (if (or (and (> x y) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
838 (not (eq (following-char) ?<))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
839 (and (< x y) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
840 (eq (preceding-char) ?>))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
841 (backward-list) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
842 (forward-list))))))) |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
843 |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
844 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
845 (autoload 'compile-internal "compile") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
846 |
809 | 847 (defun sgml-validate (command) |
848 "Validate an SGML document. | |
849 Runs COMMAND, a shell command, in a separate process asynchronously | |
17551 | 850 with output going to the buffer `*compilation*'. |
809 | 851 You can then use the command \\[next-error] to find the next error message |
852 and move to the line in the SGML document that caused it." | |
853 (interactive | |
854 (list (read-string "Validate command: " | |
855 (or sgml-saved-validate-command | |
856 (concat sgml-validate-command | |
857 " " | |
858 (let ((name (buffer-file-name))) | |
859 (and name | |
860 (file-name-nondirectory name)))))))) | |
861 (setq sgml-saved-validate-command command) | |
23970
d1d08f461c9c
(sgml-validate): Ask whether to save only
Richard M. Stallman <rms@gnu.org>
parents:
23869
diff
changeset
|
862 (save-some-buffers (not compilation-ask-about-save) nil) |
3121
8cf203c42bee
(sgml-validate): compile1 renamed to compile-internal.
Richard M. Stallman <rms@gnu.org>
parents:
2315
diff
changeset
|
863 (compile-internal command "No more errors")) |
809 | 864 |
44619
504c3192243a
(sgml-at-indentation-p): Move to fix compilation error.
Mike Williams <mdub@bigfoot.com>
parents:
44582
diff
changeset
|
865 (defsubst sgml-at-indentation-p () |
504c3192243a
(sgml-at-indentation-p): Move to fix compilation error.
Mike Williams <mdub@bigfoot.com>
parents:
44582
diff
changeset
|
866 "Return true if point is at the first non-whitespace character on the line." |
504c3192243a
(sgml-at-indentation-p): Move to fix compilation error.
Mike Williams <mdub@bigfoot.com>
parents:
44582
diff
changeset
|
867 (save-excursion |
504c3192243a
(sgml-at-indentation-p): Move to fix compilation error.
Mike Williams <mdub@bigfoot.com>
parents:
44582
diff
changeset
|
868 (skip-chars-backward " \t") |
504c3192243a
(sgml-at-indentation-p): Move to fix compilation error.
Mike Williams <mdub@bigfoot.com>
parents:
44582
diff
changeset
|
869 (bolp))) |
504c3192243a
(sgml-at-indentation-p): Move to fix compilation error.
Mike Williams <mdub@bigfoot.com>
parents:
44582
diff
changeset
|
870 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
871 (defun sgml-lexical-context (&optional limit) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
872 "Return the lexical context at point as (TYPE . START). |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
873 START is the location of the start of the lexical element. |
44362 | 874 TYPE is one of `string', `comment', `tag', `cdata', or `text'. |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
875 |
44460
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
876 Optional argument LIMIT is the position to start parsing from. |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
877 If nil, start from a preceding tag at indentation." |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
878 (save-excursion |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
879 (let ((pos (point)) |
44387
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
880 text-start state) |
44460
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
881 (if limit |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
882 (goto-char limit) |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
883 ;; Skip tags backwards until we find one at indentation |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
884 (while (and (ignore-errors (sgml-parse-tag-backward)) |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
885 (not (sgml-at-indentation-p))))) |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
886 (with-syntax-table sgml-tag-syntax-table |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
887 (while (< (point) pos) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
888 ;; When entering this loop we're inside text. |
44335
1a7be1d554f5
(sgml-looking-back-at): Short-circuit at beg of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44333
diff
changeset
|
889 (setq text-start (point)) |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
890 (skip-chars-forward "^<" pos) |
44387
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
891 (setq state |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
892 (cond |
44443
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
893 ((= (point) pos) |
44387
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
894 ;; We got to the end without seeing a tag. |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
895 nil) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
896 ((looking-at "<!\\[[A-Z]+\\[") |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
897 ;; We've found a CDATA section or similar. |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
898 (let ((cdata-start (point))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
899 (unless (search-forward "]]>" pos 'move) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
900 (list 0 nil nil 'cdata nil nil nil nil cdata-start)))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
901 (t |
44502
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
902 ;; We've reached a tag. Parse it. |
44387
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
903 ;; FIXME: Handle net-enabling start-tags |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
904 (parse-partial-sexp (point) pos 0)))))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
905 (cond |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
906 ((eq (nth 3 state) 'cdata) (cons 'cdata (nth 8 state))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
907 ((nth 3 state) (cons 'string (nth 8 state))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
908 ((nth 4 state) (cons 'comment (nth 8 state))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
909 ((and state (> (nth 0 state) 0)) (cons 'tag (nth 1 state))) |
a8edf3f6811d
(sgml-lexical-context): Fix up CDATA detection for boundary cases.
Mike Williams <mdub@bigfoot.com>
parents:
44362
diff
changeset
|
910 (t (cons 'text text-start)))))) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
911 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
912 (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
|
913 "Skip to beginning of tag and return its name. |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
914 If this can't be done, return nil." |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
915 (let ((context (sgml-lexical-context))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
916 (if (eq (car context) 'tag) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
917 (progn |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
918 (goto-char (cdr context)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
919 (when (looking-at sgml-tag-name-re) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
920 (match-string-no-properties 1))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
921 (if top-level nil |
44244
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
922 (when (not (eq (car context) 'text)) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
923 (goto-char (cdr context)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
924 (sgml-beginning-of-tag t)))))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
925 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
926 (defun sgml-value (alist) |
44286
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
927 "Interactively insert value taken from attribute-rule ALIST. |
40343
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
928 See `sgml-tag-alist' for info about attribute rules." |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
929 (setq alist (cdr alist)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
930 (if (stringp (car alist)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
931 (insert "=\"" (car alist) ?\") |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
932 (if (and (eq (car alist) t) (not sgml-xml-mode)) |
40343
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
933 (when (cdr alist) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
934 (insert "=\"") |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
935 (setq alist (skeleton-read '(completing-read "Value: " (cdr alist)))) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
936 (if (string< "" alist) |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
937 (insert alist ?\") |
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
938 (delete-backward-char 2))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
939 (insert "=\"") |
40343
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
940 (when alist |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
941 (insert (skeleton-read '(completing-read "Value: " alist)))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
942 (insert ?\")))) |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
943 |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
944 (defun sgml-quote (start end &optional unquotep) |
46352
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
945 "Quote SGML text in region START ... END. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
946 Only &, < and > are quoted, the rest is left untouched. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
947 With prefix argument UNQUOTEP, unquote the region." |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
948 (interactive "r\nP") |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
949 (save-restriction |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
950 (narrow-to-region start end) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
951 (goto-char (point-min)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
952 (if unquotep |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
953 ;; FIXME: We should unquote other named character references as well. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
954 (while (re-search-forward |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
955 "\\(&\\(amp\\|\\(l\\|\\(g\\)\\)t\\)\\)[][<>&;\n\t \"%!'(),/=?]" |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
956 nil t) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
957 (replace-match (if (match-end 4) ">" (if (match-end 3) "<" "&")) t t |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
958 nil (if (eq (char-before (match-end 0)) ?\;) 0 1))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
959 (while (re-search-forward "[&<>]" nil t) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
960 (replace-match (cdr (assq (char-before) '((?& . "&") |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
961 (?< . "<") |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
962 (?> . ">")))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
963 t t))))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
964 |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
965 (defun sgml-pretty-print (beg end) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
966 "Simple-minded pretty printer for SGML. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
967 Re-indents the code and inserts newlines between BEG and END. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
968 You might want to turn on `auto-fill-mode' to get better results." |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
969 ;; TODO: |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
970 ;; - insert newline between some start-tag and text. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
971 ;; - don't insert newline in front of some end-tags. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
972 (interactive "r") |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
973 (save-excursion |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
974 (if (< beg end) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
975 (goto-char beg) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
976 (goto-char end) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
977 (setq end beg) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
978 (setq beg (point))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
979 ;; Don't use narrowing because it screws up auto-indent. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
980 (setq end (copy-marker end t)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
981 (with-syntax-table sgml-tag-syntax-table |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
982 (while (re-search-forward "<" end t) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
983 (goto-char (match-beginning 0)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
984 (unless (or ;;(looking-at "</") |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
985 (progn (skip-chars-backward " \t") (bolp))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
986 (reindent-then-newline-and-indent)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
987 (forward-sexp 1))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
988 ;; (indent-region beg end) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
989 )) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
990 |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
991 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
992 ;; Parsing |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
993 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
994 (defstruct (sgml-tag |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
995 (:constructor sgml-make-tag (type start end name))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
996 type start end name) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
997 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
998 (defsubst sgml-parse-tag-name () |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
999 "Skip past a tag-name, and return the name." |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1000 (buffer-substring-no-properties |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1001 (point) (progn (skip-syntax-forward "w_") (point)))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1002 |
44460
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
1003 (defsubst sgml-looking-back-at (str) |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
1004 "Return t if the test before point matches STR." |
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
1005 (let ((start (- (point) (length str)))) |
44335
1a7be1d554f5
(sgml-looking-back-at): Short-circuit at beg of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44333
diff
changeset
|
1006 (and (>= start (point-min)) |
44460
45c30120001e
(sgml-lexical-context): Use sgml-parse-tag-backward to find start point.
Mike Williams <mdub@bigfoot.com>
parents:
44459
diff
changeset
|
1007 (equal str (buffer-substring-no-properties start (point)))))) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1008 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1009 (defun sgml-parse-tag-backward () |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1010 "Parse an SGML tag backward, and return information about the tag. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1011 Assume that parsing starts from within a textual context. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1012 Leave point at the beginning of the tag." |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1013 (let (tag-type tag-start tag-end name) |
44582
aca4f7ef2d56
(sgml-parse-tag-backward): Fix to work at beginning of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44502
diff
changeset
|
1014 (or (search-backward ">" nil 'move) |
aca4f7ef2d56
(sgml-parse-tag-backward): Fix to work at beginning of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44502
diff
changeset
|
1015 (error "No tag found")) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1016 (setq tag-end (1+ (point))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1017 (cond |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1018 ((sgml-looking-back-at "--") ; comment |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1019 (setq tag-type 'comment |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1020 tag-start (search-backward "<!--" nil t))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1021 ((sgml-looking-back-at "]]") ; cdata |
44443
9e6f2afa9f19
(sgml-comment-indent-new-line): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44388
diff
changeset
|
1022 (setq tag-type 'cdata |
44362 | 1023 tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t))) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1024 (t |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1025 (setq tag-start |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1026 (with-syntax-table sgml-tag-syntax-table |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1027 (goto-char tag-end) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1028 (backward-sexp) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1029 (point))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1030 (goto-char (1+ tag-start)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1031 (case (char-after) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1032 (?! ; declaration |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1033 (setq tag-type 'decl)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1034 (?? ; processing-instruction |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1035 (setq tag-type 'pi)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1036 (?/ ; close-tag |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1037 (forward-char 1) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1038 (setq tag-type 'close |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1039 name (sgml-parse-tag-name))) |
44333
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1040 (?% ; JSP tags |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1041 (setq tag-type 'jsp)) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1042 (t ; open or empty tag |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1043 (setq tag-type 'open |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1044 name (sgml-parse-tag-name)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1045 (if (or (eq ?/ (char-before (- tag-end 1))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1046 (sgml-empty-tag-p name)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1047 (setq tag-type 'empty)))))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1048 (goto-char tag-start) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1049 (sgml-make-tag tag-type tag-start tag-end name))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1050 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1051 (defun sgml-get-context (&optional full) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1052 "Determine the context of the current position. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1053 If FULL is `empty', return even if the context is empty (i.e. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1054 we just skipped over some element and got to a beginning of line). |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1055 If FULL is non-nil, parse back to the beginning of the buffer, otherwise |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1056 parse until we find a start-tag as the first thing on a line. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1057 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1058 The context is a list of tag-info structures. The last one is the tag |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1059 immediately enclosing the current position." |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1060 (let ((here (point)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1061 (ignore nil) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1062 (context nil) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1063 tag-info) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1064 ;; CONTEXT keeps track of the tag-stack |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1065 ;; IGNORE keeps track of the nesting level of point relative to the |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1066 ;; first (outermost) tag on the context. This is the list of |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1067 ;; enclosing start-tags we'll have to ignore. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1068 (skip-chars-backward " \t\n") ; Make sure we're not at indentation. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1069 (while |
44502
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1070 (and (or ignore |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1071 (not (if full (eq full 'empty) context)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1072 (not (sgml-at-indentation-p)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1073 (and context |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1074 (/= (point) (sgml-tag-start (car context))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1075 (sgml-unclosed-tag-p (sgml-tag-name (car context))))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1076 (setq tag-info (ignore-errors (sgml-parse-tag-backward)))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1077 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1078 ;; This tag may enclose things we thought were tags. If so, |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1079 ;; discard them. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1080 (while (and context |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1081 (> (sgml-tag-end tag-info) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1082 (sgml-tag-end (car context)))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1083 (setq context (cdr context))) |
46352
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1084 |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1085 (cond |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1086 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1087 ;; start-tag |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1088 ((eq (sgml-tag-type tag-info) 'open) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1089 (cond |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1090 ((null ignore) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1091 (if (and context |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1092 (sgml-unclosed-tag-p (sgml-tag-name tag-info)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1093 (eq t (compare-strings |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1094 (sgml-tag-name tag-info) nil nil |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1095 (sgml-tag-name (car context)) nil nil t))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1096 ;; There was an implicit end-tag. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1097 nil |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1098 (push tag-info context))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1099 ((eq t (compare-strings (sgml-tag-name tag-info) nil nil |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1100 (car ignore) nil nil t)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1101 (setq ignore (cdr ignore))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1102 (t |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1103 ;; The open and close tags don't match. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1104 (if (not sgml-xml-mode) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1105 (unless (sgml-unclosed-tag-p (sgml-tag-name tag-info)) |
46352
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1106 (message "Unclosed tag <%s>" (sgml-tag-name tag-info)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1107 (let ((tmp ignore)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1108 ;; We could just assume that the tag is simply not closed |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1109 ;; but it's a bad assumption when tags *are* closed but |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1110 ;; not properly nested. |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1111 (while (and (cdr tmp) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1112 (not (eq t (compare-strings |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1113 (sgml-tag-name tag-info) nil nil |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1114 (cadr tmp) nil nil t)))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1115 (setq tmp (cdr tmp))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1116 (if (cdr tmp) (setcdr tmp (cddr tmp))))) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1117 (message "Unmatched tags <%s> and </%s>" |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1118 (sgml-tag-name tag-info) (pop ignore)))))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1119 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1120 ;; end-tag |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1121 ((eq (sgml-tag-type tag-info) 'close) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1122 (if (sgml-empty-tag-p (sgml-tag-name tag-info)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1123 (message "Spurious </%s>: empty tag" (sgml-tag-name tag-info)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1124 (push (sgml-tag-name tag-info) ignore))) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1125 )) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1126 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1127 ;; return context |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1128 context)) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1129 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1130 (defun sgml-show-context (&optional full) |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1131 "Display the current context. |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1132 If FULL is non-nil, parse back to the beginning of the buffer." |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1133 (interactive "P") |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1134 (with-output-to-temp-buffer "*XML Context*" |
46352
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1135 (save-excursion |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1136 (let ((context (sgml-get-context))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1137 (when full |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1138 (let ((more nil)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1139 (while (setq more (sgml-get-context)) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1140 (setq context (nconc more context))))) |
66fb3c24b4ba
(sgml-quote): Use narrowing. Improve the regexp used when unquoting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45557
diff
changeset
|
1141 (pp context))))) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1142 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1143 |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1144 ;; Editing shortcuts |
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1145 |
44333
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1146 (defun sgml-close-tag () |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1147 "Insert an close-tag for the current element." |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1148 (interactive) |
44333
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1149 (case (car (sgml-lexical-context)) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1150 (comment (insert " -->")) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1151 (cdata (insert "]]>")) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1152 (pi (insert " ?>")) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1153 (jsp (insert " %>")) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1154 (tag (insert " />")) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1155 (text |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1156 (let ((context (save-excursion (sgml-get-context)))) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1157 (if context |
44502
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1158 (progn |
44333
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1159 (insert "</" (sgml-tag-name (car (last context))) ">") |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1160 (indent-according-to-mode))))) |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1161 (otherwise |
efbd9e76f0a4
(sgml-close-tag): Rename from
Mike Williams <mdub@bigfoot.com>
parents:
44330
diff
changeset
|
1162 (error "Nothing to close")))) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1163 |
44286
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1164 (defun sgml-empty-tag-p (tag-name) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1165 "Return non-nil if TAG-NAME is an implicitly empty tag." |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1166 (and (not sgml-xml-mode) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1167 (member-ignore-case tag-name sgml-empty-tags))) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1168 |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1169 (defun sgml-unclosed-tag-p (tag-name) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1170 "Return non-nil if TAG-NAME is a tag for which an end-tag is optional." |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1171 (and (not sgml-xml-mode) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1172 (member-ignore-case tag-name sgml-unclosed-tags))) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1173 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1174 (defun sgml-calculate-indent () |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1175 "Calculate the column to which this line should be indented." |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1176 (let ((lcon (sgml-lexical-context))) |
44286
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1177 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1178 ;; Indent comment-start markers inside <!-- just like comment-end markers. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1179 (if (and (eq (car lcon) 'tag) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1180 (looking-at "--") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1181 (save-excursion (goto-char (cdr lcon)) (looking-at "<!--"))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1182 (setq lcon (cons 'comment (+ (cdr lcon) 2)))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1183 |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1184 (case (car lcon) |
44286
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1185 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1186 (string |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1187 ;; Go back to previous non-empty line. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1188 (while (and (> (point) (cdr lcon)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1189 (zerop (forward-line -1)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1190 (looking-at "[ \t]*$"))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1191 (if (> (point) (cdr lcon)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1192 ;; Previous line is inside the string. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1193 (current-indentation) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1194 (goto-char (cdr lcon)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1195 (1+ (current-column)))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1196 |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1197 (comment |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1198 (let ((mark (looking-at "--"))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1199 ;; Go back to previous non-empty line. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1200 (while (and (> (point) (cdr lcon)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1201 (zerop (forward-line -1)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1202 (or (looking-at "[ \t]*$") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1203 (if mark (not (looking-at "[ \t]*--")))))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1204 (if (> (point) (cdr lcon)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1205 ;; Previous line is inside the comment. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1206 (skip-chars-forward " \t") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1207 (goto-char (cdr lcon))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1208 (when (and (not mark) (looking-at "--")) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1209 (forward-char 2) (skip-chars-forward " \t")) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1210 (current-column))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1211 |
44335
1a7be1d554f5
(sgml-looking-back-at): Short-circuit at beg of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44333
diff
changeset
|
1212 (cdata |
1a7be1d554f5
(sgml-looking-back-at): Short-circuit at beg of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44333
diff
changeset
|
1213 (current-column)) |
1a7be1d554f5
(sgml-looking-back-at): Short-circuit at beg of buffer.
Mike Williams <mdub@bigfoot.com>
parents:
44333
diff
changeset
|
1214 |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1215 (tag |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1216 (goto-char (1+ (cdr lcon))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1217 (skip-chars-forward "^ \t\n") ;Skip tag name. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1218 (skip-chars-forward " \t") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1219 (if (not (eolp)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1220 (current-column) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1221 ;; This is the first attribute: indent. |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1222 (goto-char (1+ (cdr lcon))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1223 (+ (current-column) sgml-basic-offset))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1224 |
44286
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1225 (text |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1226 (while (looking-at "</") |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1227 (forward-sexp 1) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1228 (skip-chars-forward " \t")) |
44244
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1229 (let* ((here (point)) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1230 (unclosed (and ;; (not sgml-xml-mode) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1231 (looking-at sgml-tag-name-re) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1232 (member-ignore-case (match-string 1) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1233 sgml-unclosed-tags) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1234 (match-string 1))) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1235 (context |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1236 ;; If possible, align on the previous non-empty text line. |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1237 ;; Otherwise, do a more serious parsing to find the |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1238 ;; tag(s) relative to which we should be indenting. |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1239 (if (and (not unclosed) (skip-chars-backward " \t") |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1240 (< (skip-chars-backward " \t\n") 0) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1241 (back-to-indentation) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1242 (> (point) (cdr lcon))) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1243 nil |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1244 (goto-char here) |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1245 (nreverse (sgml-get-context (if unclosed nil 'empty))))) |
44244
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1246 (there (point))) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1247 ;; Ignore previous unclosed start-tag in context. |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1248 (while (and context unclosed |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1249 (eq t (compare-strings |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1250 (sgml-tag-name (car context)) nil nil |
44244
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1251 unclosed nil nil t))) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1252 (setq context (cdr context))) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1253 ;; Indent to reflect nesting. |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1254 (if (and context |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1255 (goto-char (sgml-tag-end (car context))) |
44244
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1256 (skip-chars-forward " \t\n") |
44330
96c839b7b4c2
(sgml-at-indentation-p, sgml-tag)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44293
diff
changeset
|
1257 (< (point) here) (sgml-at-indentation-p)) |
44244
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1258 (current-column) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1259 (goto-char there) |
31f1fc31fd45
(sgml-lexical-context): Return (text . START)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44241
diff
changeset
|
1260 (+ (current-column) |
44286
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1261 (* sgml-basic-offset (length context)))))) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1262 |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1263 (otherwise |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1264 (error "Unrecognised context %s" (car lcon))) |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1265 |
1d7ee8515c45
Add an explicit check for 'text syntax, to protect against future
Mike Williams <mdub@bigfoot.com>
parents:
44244
diff
changeset
|
1266 ))) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1267 |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1268 (defun sgml-indent-line () |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1269 "Indent the current line as SGML." |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1270 (interactive) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1271 (let* ((savep (point)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1272 (indent-col |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1273 (save-excursion |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1274 (back-to-indentation) |
44200
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1275 (if (>= (point) savep) (setq savep nil)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1276 (sgml-calculate-indent)))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1277 (if savep |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1278 (save-excursion (indent-line-to indent-col)) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1279 (indent-line-to indent-col)))) |
3ea526b58b9e
(sgml-make-syntax-table): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43979
diff
changeset
|
1280 |
44502
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1281 (defun sgml-guess-indent () |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1282 "Guess an appropriate value for `sgml-basic-offset'. |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1283 Base the guessed identation level on the first indented tag in the buffer. |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1284 Add this to `sgml-mode-hook' for convenience." |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1285 (interactive) |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1286 (save-excursion |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1287 (goto-char (point-min)) |
45463
62d5e10140e7
(sgml-guess-indent): Look further into the buffer.
Mike Williams <mdub@bigfoot.com>
parents:
45286
diff
changeset
|
1288 (if (re-search-forward "^\\([ \t]+\\)<" 500 'noerror) |
44502
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1289 (progn |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1290 (set (make-local-variable 'sgml-basic-offset) |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1291 (length (match-string 1))) |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1292 (message "Guessed sgml-basic-offset = %d" |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1293 sgml-basic-offset) |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1294 )))) |
4067d1e7f884
(sgml-guess-indent): New function.
Mike Williams <mdub@bigfoot.com>
parents:
44460
diff
changeset
|
1295 |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1296 (defun sgml-parse-dtd () |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1297 "Simplistic parse of the current buffer as a DTD. |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1298 Currently just returns (EMPTY-TAGS UNCLOSED-TAGS)." |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1299 (goto-char (point-min)) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1300 (let ((empty nil) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1301 (unclosed nil)) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1302 (while (re-search-forward "<!ELEMENT[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+[-O][ \t\n]+\\([-O]\\)[ \t\n]+\\([^ \t\n]+\\)" nil t) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1303 (cond |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1304 ((string= (match-string 3) "EMPTY") |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1305 (push (match-string-no-properties 1) empty)) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1306 ((string= (match-string 2) "O") |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1307 (push (match-string-no-properties 1) unclosed)))) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1308 (setq empty (sort (mapcar 'downcase empty) 'string<)) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1309 (setq unclosed (sort (mapcar 'downcase unclosed) 'string<)) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1310 (list empty unclosed))) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1311 |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1312 ;;; HTML mode |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1313 |
25175 | 1314 (defcustom html-mode-hook nil |
1315 "Hook run by command `html-mode'. | |
1316 `text-mode-hook' and `sgml-mode-hook' are run first." | |
1317 :group 'sgml | |
1318 :type 'hook | |
1319 :options '(html-autoview-mode)) | |
1320 | |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1321 (defvar html-quick-keys sgml-quick-keys |
14377 | 1322 "Use C-c X combinations for quick insertion of frequent tags when non-nil. |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1323 This defaults to `sgml-quick-keys'. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1324 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
|
1325 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1326 (defvar html-mode-map |
37252
5db39c2eba1e
Add unknown maintainer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36609
diff
changeset
|
1327 (let ((map (make-sparse-keymap)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1328 (menu-map (make-sparse-keymap "HTML"))) |
37252
5db39c2eba1e
Add unknown maintainer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
36609
diff
changeset
|
1329 (set-keymap-parent map sgml-mode-map) |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1330 (define-key map "\C-c6" 'html-headline-6) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1331 (define-key map "\C-c5" 'html-headline-5) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1332 (define-key map "\C-c4" 'html-headline-4) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1333 (define-key map "\C-c3" 'html-headline-3) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1334 (define-key map "\C-c2" 'html-headline-2) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1335 (define-key map "\C-c1" 'html-headline-1) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1336 (define-key map "\C-c\r" 'html-paragraph) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1337 (define-key map "\C-c\n" 'html-line) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1338 (define-key map "\C-c\C-c-" 'html-horizontal-rule) |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1339 (define-key map "\C-c\C-co" 'html-ordered-list) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1340 (define-key map "\C-c\C-cu" 'html-unordered-list) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1341 (define-key map "\C-c\C-cr" 'html-radio-buttons) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1342 (define-key map "\C-c\C-cc" 'html-checkboxes) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1343 (define-key map "\C-c\C-cl" 'html-list-item) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1344 (define-key map "\C-c\C-ch" 'html-href-anchor) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1345 (define-key map "\C-c\C-cn" 'html-name-anchor) |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1346 (define-key map "\C-c\C-ci" 'html-image) |
40343
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1347 (when html-quick-keys |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1348 (define-key map "\C-c-" 'html-horizontal-rule) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1349 (define-key map "\C-co" 'html-ordered-list) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1350 (define-key map "\C-cu" 'html-unordered-list) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1351 (define-key map "\C-cr" 'html-radio-buttons) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1352 (define-key map "\C-cc" 'html-checkboxes) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1353 (define-key map "\C-cl" 'html-list-item) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1354 (define-key map "\C-ch" 'html-href-anchor) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1355 (define-key map "\C-cn" 'html-name-anchor) |
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1356 (define-key map "\C-ci" 'html-image)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1357 (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
|
1358 (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
|
1359 (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
|
1360 (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
|
1361 '("Toggle Autoviewing" . html-autoview-mode)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1362 (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
|
1363 '("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
|
1364 (define-key menu-map [nil] '("--")) |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1365 ;;(define-key menu-map "6" '("Heading 6" . html-headline-6)) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1366 ;;(define-key menu-map "5" '("Heading 5" . html-headline-5)) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1367 ;;(define-key menu-map "4" '("Heading 4" . html-headline-4)) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1368 (define-key menu-map "3" '("Heading 3" . html-headline-3)) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1369 (define-key menu-map "2" '("Heading 2" . html-headline-2)) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1370 (define-key menu-map "1" '("Heading 1" . html-headline-1)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1371 (define-key menu-map "l" '("Radio Buttons" . html-radio-buttons)) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1372 (define-key menu-map "c" '("Checkboxes" . html-checkboxes)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1373 (define-key menu-map "l" '("List Item" . html-list-item)) |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1374 (define-key menu-map "u" '("Unordered List" . html-unordered-list)) |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1375 (define-key menu-map "o" '("Ordered List" . html-ordered-list)) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1376 (define-key menu-map "-" '("Horizontal Rule" . html-horizontal-rule)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1377 (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
|
1378 (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
|
1379 (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
|
1380 (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
|
1381 (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
|
1382 map) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1383 "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
|
1384 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1385 (defvar html-face-tag-alist |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1386 '((bold . "b") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1387 (italic . "i") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1388 (underline . "u") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1389 (modeline . "rev")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1390 "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
|
1391 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1392 (defvar html-tag-face-alist |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1393 '(("b" . bold) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1394 ("big" . bold) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1395 ("blink" . highlight) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1396 ("cite" . italic) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1397 ("em" . italic) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1398 ("h1" bold underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1399 ("h2" bold-italic underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1400 ("h3" italic underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1401 ("h4" . underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1402 ("h5" . underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1403 ("h6" . underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1404 ("i" . italic) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1405 ("rev" . modeline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1406 ("s" . underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1407 ("small" . default) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1408 ("strong" . bold) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1409 ("title" bold underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1410 ("tt" . default) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1411 ("u" . underline) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1412 ("var" . italic)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1413 "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
|
1414 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1415 (defvar html-display-text |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1416 '((img . "[/]") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1417 (hr . "----------") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1418 (li . "o ")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1419 "Value of `sgml-display-text' for HTML mode.") |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
1420 |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1421 |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1422 ;; should code exactly HTML 3 here when that is finished |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1423 (defvar html-tag-alist |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1424 (let* ((1-7 '(("1") ("2") ("3") ("4") ("5") ("6") ("7"))) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1425 (1-9 `(,@1-7 ("8") ("9"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1426 (align '(("align" ("left") ("center") ("right")))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1427 (valign '(("top") ("middle") ("bottom") ("baseline"))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1428 (rel '(("next") ("previous") ("parent") ("subdocument") ("made"))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1429 (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
|
1430 ("mailto:") ("news:") ("rlogin:") ("telnet:") ("tn3270:") |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1431 ("wais:") ("/cgi-bin/"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1432 (name '("name")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1433 (link `(,href |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1434 ("rel" ,@rel) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1435 ("rev" ,@rel) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1436 ("title"))) |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1437 (list '((nil \n ("List item: " "<li>" str |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1438 (if sgml-xml-mode "</li>") \n)))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1439 (cell `(t |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1440 ,@align |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1441 ("valign" ,@valign) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1442 ("colspan" ,@1-9) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1443 ("rowspan" ,@1-9) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1444 ("nowrap" t)))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1445 ;; 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
|
1446 ;; 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
|
1447 `(("a" ,name ,@link) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1448 ("base" t ,@href) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1449 ("dir" ,@list) |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1450 ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
1451 ("form" (\n _ \n "<input type=\"submit\" value=\"\"" |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1452 (if sgml-xml-mode "/>" ">")) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1453 ("action" ,@(cdr href)) ("method" ("get") ("post"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1454 ("h1" ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1455 ("h2" ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1456 ("h3" ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1457 ("h4" ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1458 ("h5" ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1459 ("h6" ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1460 ("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
|
1461 ("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
|
1462 ("src") ("alt") ("width" "1") ("height" "1") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1463 ("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
|
1464 ("input" t ("size" ,@1-9) ("maxlength" ,@1-9) ("checked" t) ,name |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1465 ("type" ("text") ("password") ("checkbox") ("radio") |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1466 ("submit") ("reset")) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1467 ("value")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1468 ("link" t ,@link) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1469 ("menu" ,@list) |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1470 ("ol" ,@list ("type" ("A") ("a") ("I") ("i") ("1"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1471 ("p" t ,@align) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1472 ("select" (nil \n |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1473 ("Text: " |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1474 "<option>" str (if sgml-xml-mode "</option>") \n)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1475 ,name ("size" ,@1-9) ("multiple" t)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1476 ("table" (nil \n |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1477 ((completing-read "Cell kind: " '(("td") ("th")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1478 nil t "t") |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
1479 "<tr><" str ?> _ |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1480 (if sgml-xml-mode (concat "<" str "></tr>")) \n)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1481 ("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
|
1482 ("td" ,@cell) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1483 ("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
|
1484 ("th" ,@cell) |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1485 ("ul" ,@list ("type" ("disc") ("circle") ("square"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1486 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1487 ,@sgml-tag-alist |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1488 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1489 ("abbrev") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1490 ("acronym") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1491 ("address") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1492 ("array" (nil \n |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1493 ("Item: " "<item>" str (if sgml-xml-mode "</item>") \n)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1494 "align") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1495 ("au") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1496 ("b") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1497 ("big") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1498 ("blink") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1499 ("blockquote" \n) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1500 ("body" \n ("background" ".gif") ("bgcolor" "#") ("text" "#") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1501 ("link" "#") ("alink" "#") ("vlink" "#")) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1502 ("box" (nil _ "<over>" _ (if sgml-xml-mode "</over>"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1503 ("br" t ("clear" ("left") ("right"))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1504 ("caption" ("valign" ("top") ("bottom"))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1505 ("center" \n) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1506 ("cite") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1507 ("code" \n) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1508 ("dd" ,(not sgml-xml-mode)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1509 ("del") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1510 ("dfn") |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1511 ("div") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1512 ("dl" (nil \n |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1513 ( "Term: " |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1514 "<dt>" str (if sgml-xml-mode "</dt>") |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1515 "<dd>" _ (if sgml-xml-mode "</dd>") \n))) |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1516 ("dt" (t _ (if sgml-xml-mode "</dt>") |
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1517 "<dd>" (if sgml-xml-mode "</dd>") \n)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1518 ("em") |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1519 ;("fn" "id" "fn") ; ??? |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1520 ("head" \n) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1521 ("html" (\n |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1522 "<head>\n" |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1523 "<title>" (setq str (read-input "Title: ")) "</title>\n" |
24413
e2c5b1571392
(html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents:
23970
diff
changeset
|
1524 "</head>\n" |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1525 "<body>\n<h1>" str "</h1>\n" _ |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1526 "\n<address>\n<a href=\"mailto:" |
14518
5b2bc060c90d
(html-tag-alist): within the <ADDRESS> tag
Richard M. Stallman <rms@gnu.org>
parents:
14377
diff
changeset
|
1527 user-mail-address |
24413
e2c5b1571392
(html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents:
23970
diff
changeset
|
1528 "\">" (user-full-name) "</a>\n</address>\n" |
e2c5b1571392
(html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents:
23970
diff
changeset
|
1529 "</body>" |
e2c5b1571392
(html-tag-alist): Add /head and /body to the "html" template.
Richard M. Stallman <rms@gnu.org>
parents:
23970
diff
changeset
|
1530 )) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1531 ("i") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1532 ("ins") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1533 ("isindex" t ("action") ("prompt")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1534 ("kbd") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1535 ("lang") |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1536 ("li" ,(not sgml-xml-mode)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1537 ("math" \n) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1538 ("nobr") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1539 ("option" t ("value") ("label") ("selected" t)) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1540 ("over" t) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1541 ("person") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1542 ("pre" \n) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1543 ("q") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1544 ("rev") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1545 ("s") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1546 ("samp") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1547 ("small") |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1548 ("span" nil |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1549 ("class" |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1550 ("builtin") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1551 ("comment") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1552 ("constant") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1553 ("function-name") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1554 ("keyword") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1555 ("string") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1556 ("type") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1557 ("variable-name") |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1558 ("warning"))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1559 ("strong") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1560 ("sub") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1561 ("sup") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1562 ("title") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1563 ("tr" t) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1564 ("tt") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1565 ("u") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1566 ("var") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1567 ("wbr" t))) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1568 "*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
|
1569 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1570 (defvar html-tag-help |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1571 `(,@sgml-tag-help |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1572 ("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
|
1573 ("abbrev" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1574 ("acronym" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1575 ("address" . "Formatted mail address") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1576 ("array" . "Math array") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1577 ("au" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1578 ("b" . "Bold face") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1579 ("base" . "Base address for URLs") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1580 ("big" . "Font size") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1581 ("blink" . "Blinking text") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1582 ("blockquote" . "Indented quotation") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1583 ("body" . "Document body") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1584 ("box" . "Math fraction") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1585 ("br" . "Line break") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1586 ("caption" . "Table caption") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1587 ("center" . "Centered text") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1588 ("changed" . "Change bars") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1589 ("cite" . "Citation of a document") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1590 ("code" . "Formatted source code") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1591 ("dd" . "Definition of term") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1592 ("del" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1593 ("dfn" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1594 ("dir" . "Directory list (obsolete)") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1595 ("dl" . "Definition list") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1596 ("dt" . "Term to be definined") |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1597 ("em" . "Emphasised") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1598 ("embed" . "Embedded data in foreign format") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1599 ("fig" . "Figure") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1600 ("figa" . "Figure anchor") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1601 ("figd" . "Figure description") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1602 ("figt" . "Figure text") |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1603 ;("fn" . "?") ; ??? |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1604 ("font" . "Font size") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1605 ("form" . "Form with input fields") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1606 ("group" . "Document grouping") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1607 ("h1" . "Most important section headline") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1608 ("h2" . "Important section headline") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1609 ("h3" . "Section headline") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1610 ("h4" . "Minor section headline") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1611 ("h5" . "Unimportant section headline") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1612 ("h6" . "Least important section headline") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1613 ("head" . "Document header") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1614 ("hr" . "Horizontal rule") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1615 ("html" . "HTML Document") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1616 ("i" . "Italic face") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1617 ("img" . "Graphic image") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1618 ("input" . "Form input field") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1619 ("ins" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1620 ("isindex" . "Input field for index search") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1621 ("kbd" . "Keybard example face") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1622 ("lang" . "Natural language") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1623 ("li" . "List item") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1624 ("link" . "Link relationship") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1625 ("math" . "Math formula") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1626 ("menu" . "Menu list (obsolete)") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1627 ("mh" . "Form mail header") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1628 ("nextid" . "Allocate new id") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1629 ("nobr" . "Text without line break") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1630 ("ol" . "Ordered list") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1631 ("option" . "Selection list item") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1632 ("over" . "Math fraction rule") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1633 ("p" . "Paragraph start") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1634 ("panel" . "Floating panel") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1635 ("person" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1636 ("pre" . "Preformatted fixed width text") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1637 ("q" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1638 ("rev" . "Reverse video") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1639 ("s" . "?") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1640 ("samp" . "Sample text") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1641 ("select" . "Selection list") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1642 ("small" . "Font size") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1643 ("sp" . "Nobreak space") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1644 ("strong" . "Standout text") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1645 ("sub" . "Subscript") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1646 ("sup" . "Superscript") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1647 ("table" . "Table with rows and columns") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1648 ("tb" . "Table vertical break") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1649 ("td" . "Table data cell") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1650 ("textarea" . "Form multiline edit area") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1651 ("th" . "Table header cell") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1652 ("title" . "Document title") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1653 ("tr" . "Table row separator") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1654 ("tt" . "Typewriter face") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1655 ("u" . "Underlined text") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1656 ("ul" . "Unordered list") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1657 ("var" . "Math variable face") |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1658 ("wbr" . "Enable <br> within <nobr>")) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1659 "*Value of `sgml-tag-help' for HTML mode.") |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
1660 |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1661 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1662 ;;;###autoload |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1663 (define-derived-mode html-mode sgml-mode "HTML" |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1664 "Major mode based on SGML mode for editing HTML documents. |
23652 | 1665 This allows inserting skeleton constructs used in hypertext documents with |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1666 completion. See below for an introduction to HTML. Use |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1667 \\[browse-url-of-buffer] to see how this comes out. See also `sgml-mode' on |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1668 which this is based. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1669 |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1670 Do \\[describe-variable] html- SPC and \\[describe-variable] sgml- SPC to see available variables. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1671 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1672 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
|
1673 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
|
1674 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
|
1675 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
|
1676 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1677 <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
|
1678 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
|
1679 <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
|
1680 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1681 <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
|
1682 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
|
1683 <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
|
1684 Edit/Text Properties/Face commands. |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1685 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1686 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
|
1687 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
|
1688 href=\"URL\">see also URL</a> where URL is a filename relative to current |
17551 | 1689 directory, or absolute as in `http://www.cs.indiana.edu/elisp/w3/docs.html'. |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1690 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1691 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
|
1692 |
17551 | 1693 If you mainly create your own documents, `sgml-specials' might be |
1694 interesting. But note that some HTML 2 browsers can't handle `''. | |
1695 To work around that, do: | |
1696 (eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil)) | |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1697 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1698 \\{html-mode-map}" |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1699 (set (make-local-variable 'sgml-display-text) html-display-text) |
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1700 (set (make-local-variable 'sgml-tag-face-alist) html-tag-face-alist) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1701 (make-local-variable 'sgml-tag-alist) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1702 (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
|
1703 (make-local-variable 'sgml-tag-help) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1704 (make-local-variable 'outline-regexp) |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1705 (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
|
1706 (make-local-variable 'outline-level) |
16914
4b79df16b939
(html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents:
16404
diff
changeset
|
1707 (make-local-variable 'sentence-end) |
4b79df16b939
(html-mode): Locally set sentence-end.
Richard M. Stallman <rms@gnu.org>
parents:
16404
diff
changeset
|
1708 (setq sentence-end |
24463
9ef31386cb47
(html-mode): Use sentence-end-double-space when setting sentence-end.
Dave Love <fx@gnu.org>
parents:
24413
diff
changeset
|
1709 (if sentence-end-double-space |
9ef31386cb47
(html-mode): Use sentence-end-double-space when setting sentence-end.
Dave Love <fx@gnu.org>
parents:
24413
diff
changeset
|
1710 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*" |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1711 "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\|[ \t]\\)[ \t\n]*")) |
22772
3dc5c3a4f1f8
(sgml-mode): Call kill-local-variables
Richard M. Stallman <rms@gnu.org>
parents:
22629
diff
changeset
|
1712 (setq sgml-tag-alist html-tag-alist |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1713 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
|
1714 sgml-tag-help html-tag-help |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1715 outline-regexp "^.*<[Hh][1-6]\\>" |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1716 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
|
1717 outline-level (lambda () |
43692
568974ab1796
Change maintainer to FSF.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43589
diff
changeset
|
1718 (char-before (match-end 0)))) |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1719 (setq imenu-create-index-function 'html-imenu-index) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1720 (when sgml-xml-mode (setq mode-name "XHTML")) |
40392
e4b72489cdc4
(sgml-empty-tags): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40377
diff
changeset
|
1721 (set (make-local-variable 'sgml-empty-tags) |
44241
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1722 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd', |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1723 ;; plus manual addition of "wbr". |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1724 '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input" |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1725 "isindex" "link" "meta" "param" "wbr")) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1726 (set (make-local-variable 'sgml-unclosed-tags) |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1727 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'. |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1728 '("body" "colgroup" "dd" "dt" "head" "html" "li" "option" |
600b7e53cf18
(sgml-basic-offset): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44200
diff
changeset
|
1729 "p" "tbody" "td" "tfoot" "th" "thead" "tr")) |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1730 ;; It's for the user to decide if it defeats it or not -stef |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1731 ;; (make-local-variable 'imenu-sort-function) |
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1732 ;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose |
40320
66ba1d523634
(sgml-font-lock-keywords-1): Ignore comments.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40176
diff
changeset
|
1733 ) |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
1734 |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1735 (defvar html-imenu-regexp |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1736 "\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)" |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1737 "*A regular expression matching a head line to be added to the menu. |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1738 The first `match-string' should be a number from 1-9. |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1739 The second `match-string' matches extra tags and is ignored. |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1740 The third `match-string' will be the used in the menu.") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1741 |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1742 (defun html-imenu-index () |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1743 "Return an table of contents for an HTML buffer for use with Imenu." |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1744 (let (toc-index) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1745 (save-excursion |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1746 (goto-char (point-min)) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1747 (while (re-search-forward html-imenu-regexp nil t) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1748 (setq toc-index |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1749 (cons (cons (concat (make-string |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1750 (* 2 (1- (string-to-number (match-string 1)))) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1751 ?\ ) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1752 (match-string 3)) |
40343
25129ef47b45
some code simplifications: when instead of if+progn;
Sam Steingold <sds@gnu.org>
parents:
40320
diff
changeset
|
1753 (line-beginning-position)) |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1754 toc-index)))) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1755 (nreverse toc-index))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1756 |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1757 (defun html-autoview-mode (&optional arg) |
25175 | 1758 "Toggle automatic viewing via `browse-url-of-buffer' upon saving buffer. |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1759 With positive prefix ARG always turns viewing on, with negative ARG always off. |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1760 Can be used as a value for `html-mode-hook'." |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1761 (interactive "P") |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1762 (if (setq arg (if arg |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1763 (< (prefix-numeric-value arg) 0) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1764 (and (boundp 'after-save-hook) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1765 (memq 'browse-url-of-buffer after-save-hook)))) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1766 (setq after-save-hook (delq 'browse-url-of-buffer after-save-hook)) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1767 (add-hook 'after-save-hook 'browse-url-of-buffer nil t)) |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1768 (message "Autoviewing turned %s." |
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1769 (if arg "off" "on"))) |
44459
25c3c51b0375
(sgml-tag-alist): Doc fix.
Mike Williams <mdub@bigfoot.com>
parents:
44443
diff
changeset
|
1770 |
22629
5d51b13e0d1f
(html-imenu-regexp): New defvar.
Richard M. Stallman <rms@gnu.org>
parents:
22319
diff
changeset
|
1771 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1772 (define-skeleton html-href-anchor |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1773 "HTML anchor tag with href attribute." |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1774 "URL: " |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1775 '(setq input "http:") |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1776 "<a href=\"" str "\">" _ "</a>") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1777 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1778 (define-skeleton html-name-anchor |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1779 "HTML anchor tag with name attribute." |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1780 "Name: " |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1781 "<a name=\"" str "\">" _ "</a>") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1782 |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1783 (define-skeleton html-headline-1 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1784 "HTML level 1 headline tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1785 nil |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1786 "<h1>" _ "</h1>") |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1787 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1788 (define-skeleton html-headline-2 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1789 "HTML level 2 headline tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1790 nil |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1791 "<h2>" _ "</h2>") |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1792 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1793 (define-skeleton html-headline-3 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1794 "HTML level 3 headline tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1795 nil |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1796 "<h3>" _ "</h3>") |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1797 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1798 (define-skeleton html-headline-4 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1799 "HTML level 4 headline tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1800 nil |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1801 "<h4>" _ "</h4>") |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1802 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1803 (define-skeleton html-headline-5 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1804 "HTML level 5 headline tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1805 nil |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1806 "<h5>" _ "</h5>") |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1807 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1808 (define-skeleton html-headline-6 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1809 "HTML level 6 headline tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1810 nil |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1811 "<h6>" _ "</h6>") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1812 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1813 (define-skeleton html-horizontal-rule |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1814 "HTML horizontal rule tag." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1815 nil |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1816 (if sgml-xml-mode "<hr/>" "<hr>") \n) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1817 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1818 (define-skeleton html-image |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1819 "HTML image tag." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1820 nil |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1821 "<img src=\"" _ "\"" |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1822 (if sgml-xml-mode "/>" ">")) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1823 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1824 (define-skeleton html-line |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1825 "HTML line break tag." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1826 nil |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1827 (if sgml-xml-mode "<br/>" "<br>") \n) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1828 |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1829 (define-skeleton html-ordered-list |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1830 "HTML ordered list tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1831 nil |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1832 "<ol>" \n |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1833 "<li>" _ (if sgml-xml-mode "</li>") \n |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1834 "</ol>") |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1835 |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1836 (define-skeleton html-unordered-list |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1837 "HTML unordered list tags." |
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1838 nil |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1839 "<ul>" \n |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1840 "<li>" _ (if sgml-xml-mode "</li>") \n |
15437
43b1f8a3af53
(html-list): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
14518
diff
changeset
|
1841 "</ul>") |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1842 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1843 (define-skeleton html-list-item |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1844 "HTML list item tag." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1845 nil |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1846 (if (bolp) nil '\n) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1847 "<li>" _ (if sgml-xml-mode "</li>")) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1848 |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1849 (define-skeleton html-paragraph |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1850 "HTML paragraph tag." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1851 nil |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1852 (if (bolp) nil ?\n) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1853 \n "<p>" _ (if sgml-xml-mode "</p>")) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1854 |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1855 (define-skeleton html-checkboxes |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1856 "Group of connected checkbox inputs." |
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1857 nil |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1858 '(setq v1 nil |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1859 v2 nil) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1860 ("Value: " |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1861 "<input type=\"" (identity "checkbox") ; see comment above about identity |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1862 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: "))) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1863 "\" value=\"" str ?\" |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1864 (when (y-or-n-p "Set \"checked\" attribute? ") |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1865 (funcall skeleton-transformation " checked")) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1866 (if sgml-xml-mode "/>" ">") |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1867 (skeleton-read "Text: " (capitalize str)) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1868 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1869 (funcall skeleton-transformation |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1870 (if sgml-xml-mode "<br/>" "<br>")) |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1871 ""))) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1872 \n)) |
14270
15c3d6255a1c
(sgml-quick-keys): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1873 |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1874 (define-skeleton html-radio-buttons |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1875 "Group of connected radio button inputs." |
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1876 nil |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1877 '(setq v1 nil |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1878 v2 (cons nil nil)) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1879 ("Value: " |
17545
c67787f92aea
(sgml-value): Use 'identity as default value.
Richard M. Stallman <rms@gnu.org>
parents:
17530
diff
changeset
|
1880 "<input type=\"" (identity "radio") ; see comment above about identity |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1881 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: "))) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1882 "\" value=\"" str ?\" |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1883 (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) |
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1884 (funcall skeleton-transformation " checked")) |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1885 (if sgml-xml-mode "/>" ">") |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1886 (skeleton-read "Text: " (capitalize str)) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1887 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") |
39616
13a1b8cf5135
added `html-xhtml' for XHTML input
Sam Steingold <sds@gnu.org>
parents:
38431
diff
changeset
|
1888 (funcall skeleton-transformation |
43979
6dff5806cdcd
(sgml-xml-mode): Renamed from sgml-xml.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43692
diff
changeset
|
1889 (if sgml-xml-mode "<br/>" "<br>")) |
17491
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1890 ""))) |
4c6505ca34a7
(sgml-value): Don't perform the skeleton-transformation
Richard M. Stallman <rms@gnu.org>
parents:
17433
diff
changeset
|
1891 \n)) |
14159
93175ed23e01
Also load for .sgm and .dtd files.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1892 |
38068
e3bd229672c1
Move `provide' to the end. Update copyright.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37252
diff
changeset
|
1893 (provide 'sgml-mode) |
38431
853c3674f20a
Fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38108
diff
changeset
|
1894 |
809 | 1895 ;;; sgml-mode.el ends here |