annotate lisp/modes/linuxdoc-sgml.el @ 200:f0deb0c0e6be

Added tag r20-3b26 for changeset 169c0442b401
author cvs
date Mon, 13 Aug 2007 10:00:35 +0200
parents 85ec50267440
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
167
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
1 ;;; linuxdoc-sgml.el --- sgml-mode enhancements for linuxdoc
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
2
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
3 ;; Copyright (C) 1996 by Free Software Foundation, Inc.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
4
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
5 ;; Author: Arun Sharma <asharma@sco.com>
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
6 ;; Keywords: docs, languages
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
7
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
9
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
13 ;; any later version.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
14
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
18 ;; GNU General Public License for more details.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
19
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
24
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
25 ;;; Commentary:
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
26
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
27 ;; Installation:
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
28 ;; Make sure that this file is in your load-path and put this line
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
29 ;; in your .emacs.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
30 ;; (autoload 'linuxdoc-sgml-mode "linuxdoc-sgml" t t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
31 ;; (setq auto-mode-alist (cons '("\\.sgml$" . linuxdoc-sgml-mode)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
32 ;; auto-mode-alist))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
33 ;;
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
34 ;; Optionally:
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
35 ;; (add-hook 'linuxdoc-sgml-mode-hook 'turn-on-font-lock)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
36 ;;
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
37 ;; Caveat: I've had problems getting sgml/html code to work with
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
38 ;; lazy-lock. Currently under investigation.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
39 ;;; Code:
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
40
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
41 (require 'sgml-mode)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
42
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
43 (defvar linuxdoc-sgml-tag-alist
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
44 (let* ((htmlurl '(("ftp:") ("file:") ("finger:")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
45 ("gopher:") ("http:") ("mailto:") ("news:")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
46 ("rlogin:") ("telnet:") ("tn3270:") ("wais:")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
47 ("/cgi-bin/")))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
48 (name '(str))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
49 (id '(str)))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
50 `(("abstract" \n)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
51 ("article" \n)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
52 ("author" t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
53 ("bf")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
54 ("date" t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
55 ("descrip" \n)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
56 ("enum" \n)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
57 ("footnote")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
58 ("htmlurl" t ("url" ,@htmlurl) ("name" ,@name))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
59 ("item" t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
60 ("itemize" \n)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
61 ("label" ("id" ,@id))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
62 ("p" t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
63 ("quote" \n)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
64 ("ref" t ("id") ("name" ,@name))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
65 ("sect" (t (setq str (read-input "Sect: ")) "\n<p>\n"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
66 ("sect1" (t (setq str (read-input "Sect1: ")) "\n<p>\n"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
67 ("sect2" (t (setq str (read-input "Sect2: ")) "\n<p>\n"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
68 ("sect3" (t (setq str (read-input "Sect3: ")) "\n<p>\n"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
69 ("sect4" (t (setq str (read-input "Sect4: ")) "\n<p>\n"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
70 ("tag //" t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
71 ("title" (t (setq str (read-input "Title: ")) "\n"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
72 ("toc" t)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
73 ("tscreen")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
74 ("tt" (nil (setq str (read-input "Text: "))))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
75 ("url" t ("url" ,@htmlurl) ("name" ,@name))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
76 ("verb" \n)))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
77 "Linuxdoc specific tags")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
78
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
79 (defvar linuxdoc-sgml-tag-help
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
80 '(("abstract" . "Abstract of the document")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
81 ("article" . "Beginning of the article")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
82 ("author" . "Name of the Author")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
83 ("bf" . "Bold font")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
84 ("date" . "Date")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
85 ("descrip" . "Description environment")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
86 ("enum" . "Enumerated items")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
87 ("footnote" . "Footnotes")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
88 ("htmlurl" . "Insert a URL that shows up only in the HTML version")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
89 ("item" . "An enumerated or unordered item")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
90 ("itemize" . "Unordered list")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
91 ("label" . "A label for cross reference")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
92 ("p" . "Marks the end of the sect* tag")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
93 ("quote" . "Quote a piece of text")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
94 ("ref" . "Cross reference")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
95 ("sect" . "Main section heading")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
96 ("sect1" . "Level 1 section heading")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
97 ("sect2" . "Level 2 section heading")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
98 ("sect3" . "Level 3 section heading")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
99 ("sect4" . "Level 4 section heading")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
100 ("tag //" . "A description tag")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
101 ("title" . "Title of the document")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
102 ("toc" . "The table of contents")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
103 ("tscreen" . "Indents the text and uses tt font")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
104 ("tt" . "Uses the tt font")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
105 ("url" . "Insert a URL")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
106 ("verb" . "The text will be typed verbatim"))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
107 "Help for linuxdoc specific tags")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
108
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
109 (defvar linuxdoc-sgml-tag-face-alist
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
110 '(("abstract" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
111 ("article" . italic)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
112 ("author" . italic)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
113 ("bf" . bold)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
114 ("date" . italic)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
115 ("descrip" . font-lock-reference-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
116 ("enum" . font-lock-type-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
117 ("footnote" . font-lock-keyword-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
118 ("htmlurl" . font-lock-string-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
119 ("item" . font-lock-function-name-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
120 ("itemize" . font-lock-type-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
121 ("label" . font-lock-comment-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
122 ("p" . default)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
123 ("quote" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
124 ("ref" . font-lock-comment-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
125 ("sect" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
126 ("sect1" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
127 ("sect2" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
128 ("sect3" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
129 ("sect4" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
130 ("tag" . font-lock-function-name-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
131 ("title" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
132 ("toc" . default)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
133 ("tscreen" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
134 ("tt" . underline)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
135 ("url" . font-lock-string-face)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
136 ("verb" . underline))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
137 "Value of `sgml-tag-face-alist' for linuxdoc-sgml mode.")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
138
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
139 (defvar linuxdoc-sgml-font-lock-keywords
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
140 '(("<\\([^>]*\\)>" . font-lock-comment-face))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
141 "Patterns to highlight in LD-SGML buffers.")
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
142
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
143 ;;;###autoload
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
144 (defun linuxdoc-sgml-mode ()
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
145 "Major mode based on SGML mode for editing linuxdoc-sgml documents.
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
146 See the documentation on sgml-mode for more info. This mode
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
147 understands the linuxdoc-sgml tags."
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
148 (interactive)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
149 (sgml-mode-common linuxdoc-sgml-tag-face-alist nil)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
150 (use-local-map sgml-mode-map)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
151 (make-local-variable 'sgml-tag-alist)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
152 (make-local-variable 'sgml-face-tag-alist)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
153 (make-local-variable 'sgml-tag-help)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
154 (make-local-variable 'outline-regexp)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
155 (make-local-variable 'outline-heading-end-regexp)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
156 (make-local-variable 'outline-level)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
157 (make-local-variable 'sgml-font-lock-keywords)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
158 (setq mode-name "LD-SGML"
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
159 major-mode 'linuxdoc-sgml-mode
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
160 sgml-tag-alist linuxdoc-sgml-tag-alist
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
161 sgml-face-tag-alist linuxdoc-sgml-tag-face-alist
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
162 sgml-tag-help linuxdoc-sgml-tag-help
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
163 outline-regexp "^.*<sect[1-4]\\>"
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
164 outline-heading-end-regexp "<p>"
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
165 sgml-font-lock-keywords-1 (append sgml-font-lock-keywords-1
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
166 linuxdoc-sgml-font-lock-keywords
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
167 sgml-font-lock-keywords)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
168
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
169 outline-level (lambda ()
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
170 (char-after (1- (match-end 0)))))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
171 (run-hooks 'linuxdoc-sgml-mode-hook))
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
172
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
173
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
174 (provide 'linuxdoc-sgml)
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
175
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents:
diff changeset
176 ;;; linuxdoc-sgml.el ends here