rev |
line source |
yuuji@83
|
1 ;;; -*- Emacs-Lisp -*-
|
yuuji@83
|
2 ;;; YaTeX interfaces for Texinfo mode.
|
yuuji@83
|
3 ;;; (c)1994,1998,2001 by HIROSE, Yuuji [yuuji@yatex.org]
|
yuuji@83
|
4 ;;; Last modified Fri Jun 27 12:10:03 2003 on firestorm
|
yuuji@83
|
5
|
yuuji@83
|
6 (require 'yatex)
|
yuuji@83
|
7 (or (boundp 'texinfo-mode-map)
|
yuuji@83
|
8 (load "texinfo"))
|
yuuji@83
|
9
|
yuuji@83
|
10 ;;Put next expressions into your ~/.emacs
|
yuuji@83
|
11 ;;(defvar texinfo-mode-hook nil)
|
yuuji@83
|
12 ;;(or (featurep 'yatexinf)
|
yuuji@83
|
13 ;; (setq texinfo-mode-hook
|
yuuji@83
|
14 ;; (append (or texinfo-mode-hook '(lambda ()))
|
yuuji@83
|
15 ;; '((require 'yatexinf) (yatexinfo-setup)))))
|
yuuji@83
|
16
|
yuuji@83
|
17 (defun yatexinfo-define-key (map key binding)
|
yuuji@83
|
18 "Define keys of yatexinfo with YaTeX-prefix."
|
yuuji@83
|
19 (if YaTeX-inhibit-prefix-letter
|
yuuji@83
|
20 (let ((c (aref key 0)))
|
yuuji@83
|
21 (cond
|
yuuji@83
|
22 ((and (>= c ?a) (<= c ?z)) (aset key 0 (1+ (- c ?a))))
|
yuuji@83
|
23 ((and (>= c ?A) (<= c ?Z) (numberp YaTeX-inhibit-prefix-letter))
|
yuuji@83
|
24 (aset key 0 (1+ (- c ?A))))
|
yuuji@83
|
25 (t nil))))
|
yuuji@83
|
26 (define-key map (concat YaTeX-prefix key) binding))
|
yuuji@83
|
27
|
yuuji@83
|
28 (if (featurep 'yatexinf) nil
|
yuuji@83
|
29 (yatexinfo-define-key texinfo-mode-map "s" 'YaTeX-make-section)
|
yuuji@83
|
30 (yatexinfo-define-key texinfo-mode-map "S" 'YaTeX-make-section-region)
|
yuuji@83
|
31 (yatexinfo-define-key texinfo-mode-map "b" 'YaTeX-make-begin-end)
|
yuuji@83
|
32 (yatexinfo-define-key texinfo-mode-map "B" 'YaTeX-make-begin-end-region)
|
yuuji@83
|
33 (yatexinfo-define-key texinfo-mode-map "m" 'YaTeX-make-singlecmd)
|
yuuji@83
|
34 (yatexinfo-define-key texinfo-mode-map "g" 'YaTeX-goto-corresponding-*)
|
yuuji@83
|
35 (yatexinfo-define-key texinfo-mode-map ">" 'YaTeX-comment-region)
|
yuuji@83
|
36 (yatexinfo-define-key texinfo-mode-map "<" 'YaTeX-uncomment-region)
|
yuuji@83
|
37 (yatexinfo-define-key texinfo-mode-map "." 'YaTeX-comment-paragraph)
|
yuuji@83
|
38 (yatexinfo-define-key texinfo-mode-map "," 'YaTeX-uncomment-region)
|
yuuji@83
|
39 (yatexinfo-define-key texinfo-mode-map "t" 'YaTeX-typeset-menu)
|
yuuji@83
|
40 (define-key texinfo-mode-map "\e\C-t" 'lisp-complete-symbol))
|
yuuji@83
|
41
|
yuuji@83
|
42 (defvar yatexinfo-section-table
|
yuuji@83
|
43 '(("leftline") ("file") ("kbd") ("key") ("code") ("var") ("samp")
|
yuuji@83
|
44 ("ref") ("xref") ("pxref") ("value") ("footnote")
|
yuuji@83
|
45 )
|
yuuji@83
|
46 "Completion table of section-type command of Texinfo.")
|
yuuji@83
|
47
|
yuuji@83
|
48 (defvar yatexinfo-singlecmd-table
|
yuuji@83
|
49 '(("TeX{}") ("copyright{}") ("setfilename") ("settitle") ("author")
|
yuuji@83
|
50 ("noindent") ("dots{}") ("bullet") ("cindex")
|
yuuji@83
|
51 ("chapter") ("section") ("subsection") ("subsubsection")
|
yuuji@83
|
52 ("unnumbered") ("unnumberedsec") ("unnumberedsubsec")
|
yuuji@83
|
53 ("unnumberedsubsubsec")
|
yuuji@83
|
54 ("item") ("itemx"))
|
yuuji@83
|
55 "Completion table of maketitle-type command of Texinfo.")
|
yuuji@83
|
56
|
yuuji@83
|
57 (defvar yatexinfo-env-table
|
yuuji@83
|
58 '(("example") ("enumerate") ("iftex") ("titlepage") ("menu") ("table")
|
yuuji@83
|
59 ("lisp") ("itemize") ("display") ("quotation")
|
yuuji@83
|
60 ("flushright") ("flushleft") ("center"))
|
yuuji@83
|
61 "Completion table of begin-type command of Texinfo.")
|
yuuji@83
|
62
|
yuuji@83
|
63 (defvar yatexinfo-struct-begin
|
yuuji@83
|
64 "@%1%2"
|
yuuji@83
|
65 "Structure beginning form of Texinfo begin-type commands.")
|
yuuji@83
|
66
|
yuuji@83
|
67 (defvar yatexinfo-struct-end
|
yuuji@83
|
68 "@end %1"
|
yuuji@83
|
69 "Structure ending form of Texinfo begin-type commands.")
|
yuuji@83
|
70
|
yuuji@83
|
71 (defvar yatexinfo-struct-name-regexp
|
yuuji@83
|
72 "table\\|itemize\\|enumerate\\|display\\|example\\|lisp\\|group\\|menu"
|
yuuji@83
|
73 "All of begin-end type structures")
|
yuuji@83
|
74
|
yuuji@83
|
75 (defvar yatexinfo-ec "@" "Escape character of Texinfo.")
|
yuuji@83
|
76 (defvar yatexinfo-ec-regexp "@" "Regexp of the escape character of Texinfo.")
|
yuuji@83
|
77 (defvar yatexinfo-comment-prefix "@c " "Comment prefix of Texinfo.")
|
yuuji@83
|
78
|
yuuji@83
|
79 (defvar yatexinfo-user-completion-table
|
yuuji@83
|
80 (if YaTeX-dos "~/_inforc" ".yatexinforc")
|
yuuji@83
|
81 "*Default dictionary of completion table.")
|
yuuji@83
|
82
|
yuuji@83
|
83 (defun yatexinfo-setup ()
|
yuuji@83
|
84 "Setup all for yatexinfo."
|
yuuji@83
|
85 (mapcar 'make-local-variable
|
yuuji@83
|
86 '(env-table section-table singlecmd-table
|
yuuji@83
|
87 YaTeX-user-completion-table YaTeX-comment-prefix
|
yuuji@83
|
88 YaTeX-struct-name-regexp
|
yuuji@83
|
89 YaTeX-struct-begin YaTeX-struct-end YaTeX-ec YaTeX-ec-regexp))
|
yuuji@83
|
90 (setq env-table yatexinfo-env-table
|
yuuji@83
|
91 section-table yatexinfo-section-table
|
yuuji@83
|
92 singlecmd-table yatexinfo-singlecmd-table
|
yuuji@83
|
93 YaTeX-user-completion-table yatexinfo-user-completion-table
|
yuuji@83
|
94 YaTeX-comment-prefix yatexinfo-comment-prefix
|
yuuji@83
|
95 YaTeX-struct-begin yatexinfo-struct-begin
|
yuuji@83
|
96 YaTeX-struct-end yatexinfo-struct-end
|
yuuji@83
|
97 YaTeX-struct-name-regexp yatexinfo-struct-name-regexp
|
yuuji@83
|
98 YaTeX-ec yatexinfo-ec
|
yuuji@83
|
99 YaTeX-ec-regexp yatexinfo-ec-regexp)
|
yuuji@83
|
100 (load yatexinfo-user-completion-table t)
|
yuuji@83
|
101 (run-hooks 'yatex-mode-hook))
|
yuuji@83
|
102
|
yuuji@83
|
103 (provide 'yatexinf)
|