118
|
1 ;;; latexinfo.el - Support for LaTeXinfo files.
|
|
2
|
|
3 ;; Copyright (C) 1993 Marc Gemis <makke@wins.uia.ac.be>
|
|
4
|
|
5 ;; Author: Marc Gemis <makke@wins.uia.ac.be>
|
|
6 ;; Version: $Id: latexinfo.el,v 1.1 1997/04/05 17:56:47 steve Exp $
|
|
7
|
|
8 ;; This program is free software; you can redistribute it and/or modify
|
|
9 ;; it under the terms of the GNU General Public License as published by
|
|
10 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
11 ;; any later version.
|
|
12 ;;
|
|
13 ;; This program is distributed in the hope that it will be useful,
|
|
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 ;; GNU General Public License for more details.
|
|
17 ;;
|
|
18 ;; You should have received a copy of the GNU General Public License
|
|
19 ;; along with this program; if not, write to the Free Software
|
|
20 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
21
|
|
22 ;;; Code:
|
|
23
|
|
24 (require 'latex)
|
|
25
|
|
26 ;;; LaTeXinfo mode
|
|
27
|
|
28 (defvar TeX-latexinfo-node-regexp
|
|
29 '("\\\\node[ \t]+\\([^,\n\r%]+\\)" 1 TeX-auto-label)
|
|
30 "Matches LaTeXinfo \\node commands, only current node will be found.
|
|
31 We ignore next, previous and up fields.")
|
|
32
|
|
33 (defvar LaTeXinfo-mode nil
|
|
34 "Non-nil means LaTeXinfo minor mode is active.")
|
|
35 (make-variable-buffer-local 'LaTeXinfo-mode)
|
|
36
|
|
37 (defvar LaTeXinfo-mode-map nil
|
|
38 "Keymap containing LaTeXinfo commands.")
|
|
39
|
|
40 (if LaTeXinfo-mode-map
|
|
41 ()
|
|
42 (setq LaTeXinfo-mode-map (make-sparse-keymap))
|
|
43 (define-key LaTeXinfo-mode-map "\C-c\C-u\C-b" 'latexinfo-format-buffer)
|
|
44 (define-key LaTeXinfo-mode-map "\C-c\C-u\C-r" 'latexinfo-format-region)
|
|
45 (define-key LaTeXinfo-mode-map "\C-c\C-u\C-s" 'latexinfo-show-structure)
|
|
46 (define-key LaTeXinfo-mode-map "\C-c\C-ud" 'makke:latexinfo-delete-structure)
|
|
47 (define-key LaTeXinfo-mode-map "\C-c\C-ug" 'latexinfo-goto-node)
|
|
48 (define-key LaTeXinfo-mode-map "\C-c\C-ui" 'makke:latexinfo-structure))
|
|
49
|
|
50 (or (assq 'LaTeXinfo-mode minor-mode-map-alist)
|
|
51 (setq minor-mode-map-alist
|
|
52 (cons (cons 'LaTeXinfo-mode LaTeXinfo-mode-map)
|
|
53 minor-mode-map-alist)))
|
|
54
|
|
55 (defun TeX-arg-latexinfo-index (optional &optional prompt)
|
|
56 "Prompt for a LaTeXinfo index type with completion."
|
|
57 (TeX-argument-insert
|
|
58 (completing-read (TeX-argument-prompt optional prompt "Index")
|
|
59 '(("cp") ("vr") ("fn") ("tp") ("pg") ("ky"))
|
|
60 nil t)
|
|
61 optional))
|
|
62
|
|
63 (defun LaTeX-item-latexinfo-menu ()
|
|
64 "Insert a new menu item"
|
|
65 (insert "* ::")
|
|
66 (backward-char 2))
|
|
67
|
|
68 (defun latexinfo-goto-node () ; temporarily here, later in latexinfo-upd.el ??
|
|
69 "Place pointer on the node given by the user, read node with completion
|
|
70 This fails when the user types in the label of something else"
|
|
71 (interactive)
|
|
72 (let ((node-name (completing-read "Goto Node: " (LaTeX-label-list))))
|
|
73 (goto-char (point-min))
|
|
74 (if (re-search-forward
|
|
75 (concat
|
|
76 TeX-esc "node[ \\t]+" node-name ","
|
|
77 "\\|"
|
|
78 TeX-esc "label{" LaTeX-section-label node-name
|
|
79 "\\|"
|
|
80 TeX-esc "label{" node-name
|
|
81 )
|
|
82 (point-max) t)
|
|
83 (beginning-of-line 1)
|
|
84 (error "No such node"))))
|
|
85
|
|
86 ;;; Hook
|
|
87
|
|
88 (TeX-add-style-hook "latexinfo"
|
|
89 (function
|
|
90 (lambda ()
|
|
91 (require 'latexinfo)
|
|
92 (require 'latexinfo-structure)
|
|
93
|
|
94 (require 'min-map)
|
|
95 (setq LaTeXinfo-mode t)
|
|
96
|
|
97 (TeX-auto-add-regexp TeX-latexinfo-node-regexp)
|
|
98
|
|
99 (TeX-add-symbols
|
|
100 '("node"
|
|
101 (TeX-arg-literal " ")
|
|
102 (TeX-arg-free TeX-arg-define-label "Node name")
|
|
103 (TeX-arg-literal ", ")
|
|
104 (TeX-arg-free TeX-arg-label "Next node")
|
|
105 (TeX-arg-literal ", ")
|
|
106 (TeX-arg-free TeX-arg-label "Previous node")
|
|
107 (TeX-arg-literal ", ")
|
|
108 (TeX-arg-free TeX-arg-label "Up node"))
|
|
109 '("setfilename" TeX-arg-file)
|
|
110
|
|
111 '("var" t)
|
|
112 '("dfn" t)
|
|
113 '("emph" t)
|
|
114 '("kbd" t)
|
|
115 '("code" t)
|
|
116 '("samp" t)
|
|
117 '("key" t)
|
|
118 '("ctrl" t)
|
|
119 '("file" t)
|
|
120
|
|
121 '("comment"
|
|
122 (TeX-arg-literal " ")
|
|
123 (TeX-arg-free "Comment"))
|
|
124 '("c"
|
|
125 (TeX-arg-literal " ")
|
|
126 (TeX-arg-free "Comment"))
|
|
127
|
|
128 '("cindex" t)
|
|
129 '("cpsubindex" 2)
|
|
130 '("cpindexbold" t)
|
|
131
|
|
132 '("newindex" TeX-arg-latexinfo-index)
|
|
133
|
|
134 '("br" nil)
|
|
135 '("w" "Text")
|
|
136 '("dots" nil)
|
|
137 '("refill" nil)
|
|
138 '("bullet" nil)
|
|
139 '("copyright" nil)
|
|
140 '("sp" nil)
|
|
141
|
|
142 '("xref" TeX-arg-label)
|
|
143 '("pxref" TeX-arg-label)
|
|
144 '("inforef"
|
|
145 (TeX-arg-literal "{")
|
|
146 (TeX-arg-free "Name of node")
|
|
147 (TeX-arg-literal ", ")
|
|
148 (TeX-arg-free "Name for note")
|
|
149 (TeX-arg-literal ", ")
|
|
150 (TeX-arg-free TeX-arg-file "Info file")
|
|
151 (TeX-arg-literal "}")))
|
|
152
|
|
153 (LaTeX-add-environments "menu" "tex" "ignore" "ifinfo" "iftex"
|
|
154 "example" "same" "display" "format")
|
|
155
|
|
156 ; Menu's have a special kind of items
|
|
157 (make-local-variable 'LaTeX-item-list)
|
|
158 (setq LaTeX-item-list (cons '("menu" . LaTeX-item-latexinfo-menu)
|
|
159 LaTeX-item-list))
|
|
160
|
|
161 (make-local-variable 'TeX-font-list)
|
|
162 (setq TeX-font-list
|
|
163 (list (list ?\C-b (concat TeX-esc "b{") "}")
|
|
164 (list ?\C-c (concat TeX-esc "sc{") "}")
|
|
165 (list ?\C-e (concat TeX-esc "emph{") "}")
|
|
166 (list ?\C-i (concat TeX-esc "i{") "}")
|
|
167 (list ?\C-r (concat TeX-esc "r{") "}")
|
|
168 (list ?\C-s (concat TeX-esc "samp{") "}")
|
|
169 (list ?\C-t (concat TeX-esc "t{") "}")
|
|
170 (list ?s (concat TeX-esc "strong{") "}")
|
|
171 (list ?\C-f (concat TeX-esc "file{") "}")
|
|
172 (list ?\C-d (concat TeX-esc "dfn{") "}")
|
|
173 (list ?\C-v (concat TeX-esc "var{") "}")
|
|
174 (list ?k (concat TeX-esc "key{") "}")
|
|
175 (list ?\C-k (concat TeX-esc "kbd{") "}")
|
|
176 (list ?c (concat TeX-esc "code{") "}")
|
|
177 (list ?C (concat TeX-esc "cite{") "}")))
|
|
178
|
|
179 ;; need the following stuff to let xref and pxref work
|
|
180 (make-local-variable 'LaTeX-section-label)
|
|
181 (setq LaTeX-section-label ""))))
|
|
182
|
|
183 ;;; latexinfo.el ends here
|