yuuji@287: ;;; yatexinf.el -- YaTeX interfaces for Texinfo mode yuuji@294: ;;; (c)1994-2013 by HIROSE, Yuuji [yuuji@yatex.org] yuuji@294: ;;; Last modified Mon Apr 1 22:43:58 2013 on firestorm yuuji@83: yuuji@287: ;;; Code: yuuji@83: (require 'yatex) yuuji@83: (or (boundp 'texinfo-mode-map) yuuji@83: (load "texinfo")) yuuji@83: yuuji@83: ;;Put next expressions into your ~/.emacs yuuji@83: ;;(defvar texinfo-mode-hook nil) yuuji@83: ;;(or (featurep 'yatexinf) yuuji@83: ;; (setq texinfo-mode-hook yuuji@83: ;; (append (or texinfo-mode-hook '(lambda ())) yuuji@83: ;; '((require 'yatexinf) (yatexinfo-setup))))) yuuji@83: yuuji@83: (defun yatexinfo-define-key (map key binding) yuuji@83: "Define keys of yatexinfo with YaTeX-prefix." yuuji@83: (if YaTeX-inhibit-prefix-letter yuuji@83: (let ((c (aref key 0))) yuuji@83: (cond yuuji@83: ((and (>= c ?a) (<= c ?z)) (aset key 0 (1+ (- c ?a)))) yuuji@83: ((and (>= c ?A) (<= c ?Z) (numberp YaTeX-inhibit-prefix-letter)) yuuji@83: (aset key 0 (1+ (- c ?A)))) yuuji@83: (t nil)))) yuuji@83: (define-key map (concat YaTeX-prefix key) binding)) yuuji@83: yuuji@83: (if (featurep 'yatexinf) nil yuuji@83: (yatexinfo-define-key texinfo-mode-map "s" 'YaTeX-make-section) yuuji@83: (yatexinfo-define-key texinfo-mode-map "S" 'YaTeX-make-section-region) yuuji@83: (yatexinfo-define-key texinfo-mode-map "b" 'YaTeX-make-begin-end) yuuji@83: (yatexinfo-define-key texinfo-mode-map "B" 'YaTeX-make-begin-end-region) yuuji@83: (yatexinfo-define-key texinfo-mode-map "m" 'YaTeX-make-singlecmd) yuuji@83: (yatexinfo-define-key texinfo-mode-map "g" 'YaTeX-goto-corresponding-*) yuuji@83: (yatexinfo-define-key texinfo-mode-map ">" 'YaTeX-comment-region) yuuji@83: (yatexinfo-define-key texinfo-mode-map "<" 'YaTeX-uncomment-region) yuuji@83: (yatexinfo-define-key texinfo-mode-map "." 'YaTeX-comment-paragraph) yuuji@83: (yatexinfo-define-key texinfo-mode-map "," 'YaTeX-uncomment-region) yuuji@83: (yatexinfo-define-key texinfo-mode-map "t" 'YaTeX-typeset-menu) yuuji@83: (define-key texinfo-mode-map "\e\C-t" 'lisp-complete-symbol)) yuuji@83: yuuji@83: (defvar yatexinfo-section-table yuuji@83: '(("leftline") ("file") ("kbd") ("key") ("code") ("var") ("samp") yuuji@83: ("ref") ("xref") ("pxref") ("value") ("footnote") yuuji@83: ) yuuji@83: "Completion table of section-type command of Texinfo.") yuuji@83: yuuji@83: (defvar yatexinfo-singlecmd-table yuuji@83: '(("TeX{}") ("copyright{}") ("setfilename") ("settitle") ("author") yuuji@83: ("noindent") ("dots{}") ("bullet") ("cindex") yuuji@83: ("chapter") ("section") ("subsection") ("subsubsection") yuuji@83: ("unnumbered") ("unnumberedsec") ("unnumberedsubsec") yuuji@83: ("unnumberedsubsubsec") yuuji@83: ("item") ("itemx")) yuuji@83: "Completion table of maketitle-type command of Texinfo.") yuuji@83: yuuji@83: (defvar yatexinfo-env-table yuuji@83: '(("example") ("enumerate") ("iftex") ("titlepage") ("menu") ("table") yuuji@83: ("lisp") ("itemize") ("display") ("quotation") yuuji@83: ("flushright") ("flushleft") ("center")) yuuji@83: "Completion table of begin-type command of Texinfo.") yuuji@83: yuuji@83: (defvar yatexinfo-struct-begin yuuji@83: "@%1%2" yuuji@83: "Structure beginning form of Texinfo begin-type commands.") yuuji@83: yuuji@83: (defvar yatexinfo-struct-end yuuji@83: "@end %1" yuuji@83: "Structure ending form of Texinfo begin-type commands.") yuuji@83: yuuji@83: (defvar yatexinfo-struct-name-regexp yuuji@83: "table\\|itemize\\|enumerate\\|display\\|example\\|lisp\\|group\\|menu" yuuji@83: "All of begin-end type structures") yuuji@83: yuuji@83: (defvar yatexinfo-ec "@" "Escape character of Texinfo.") yuuji@83: (defvar yatexinfo-ec-regexp "@" "Regexp of the escape character of Texinfo.") yuuji@83: (defvar yatexinfo-comment-prefix "@c " "Comment prefix of Texinfo.") yuuji@83: yuuji@83: (defvar yatexinfo-user-completion-table yuuji@83: (if YaTeX-dos "~/_inforc" ".yatexinforc") yuuji@83: "*Default dictionary of completion table.") yuuji@83: yuuji@83: (defun yatexinfo-setup () yuuji@83: "Setup all for yatexinfo." yuuji@83: (mapcar 'make-local-variable yuuji@83: '(env-table section-table singlecmd-table yuuji@83: YaTeX-user-completion-table YaTeX-comment-prefix yuuji@83: YaTeX-struct-name-regexp yuuji@83: YaTeX-struct-begin YaTeX-struct-end YaTeX-ec YaTeX-ec-regexp)) yuuji@83: (setq env-table yatexinfo-env-table yuuji@83: section-table yatexinfo-section-table yuuji@83: singlecmd-table yatexinfo-singlecmd-table yuuji@83: YaTeX-user-completion-table yatexinfo-user-completion-table yuuji@83: YaTeX-comment-prefix yatexinfo-comment-prefix yuuji@83: YaTeX-struct-begin yatexinfo-struct-begin yuuji@83: YaTeX-struct-end yatexinfo-struct-end yuuji@83: YaTeX-struct-name-regexp yatexinfo-struct-name-regexp yuuji@83: YaTeX-ec yatexinfo-ec yuuji@83: YaTeX-ec-regexp yatexinfo-ec-regexp) yuuji@83: (load yatexinfo-user-completion-table t) yuuji@83: (run-hooks 'yatex-mode-hook)) yuuji@83: yuuji@83: (provide 'yatexinf)