annotate yatexinf.el @ 170:269fb1992c2d dev

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

yatex.org