texinfo-mode.zip (2007/06/20)
texinfo-mode.l、texinfo-mode.lc を xyzzy の site-lisp ディレクトリに置き、.xyzzy か siteinit.l に以下のよう記述。
(in-package "editor")
(export 'texinfo-mode "editor")
(autoload 'texinfo-mode "texinfo-mode" t)
(in-package "user")
これにより、M-x texinfo-mode とすると Texinfo-mode となります。
拡張子 .texinfo, .texi, .txi のファイルを開いた時、自動的に Texinfo-mode にしたいときは ‘(autoload 'texinfo-mode "texinfo-mode" t)’ の下に以下のように記述します。
(pushnew '("\\.texinfo$" . texinfo-mode) *auto-mode-alist* :test 'equal)
(pushnew '("\\.texi$" . texinfo-mode) *auto-mode-alist* :test 'equal)
(pushnew '("\\.txi$" . texinfo-mode) *auto-mode-alist* :test 'equal)
また好みに応じ以下の各種設定を記述して下さい。以下の例はデフォルト値です。変更する必要がない場合は記述しなくてかまいません。
(add-hook '*texinfo-mode-hook*
#'(lambda ()
;; ここに各自の設定を記述
)
)
外部コマンドが設定されている変数です。スペースで区切りオプションも同時に指定することができます。実行する外部コマンドにパスが通っていない時はフルパスで指定する必要があります。
(setf *texinfo-makeinfo-command* "makeinfo")
(setf *texinfo-makeinfo-option* nil)
(setf *texinfo-makeinfo-html-option* "--html")
(setf *texinfo-info-view-command* 2)
1 のとき info.l、2 のとき info2.l を用い Info ファイルを閲覧。
(setf *texinfo-tex-command* "ptex -src-specials")
(setf *texinfo-texindex-command* "texindex")
(setf *texinfo-dvi-view-command* "dviout -1")
(setf *texinfo-dvi2pdf-command* "dvipdfmx")
(setf *texinfo-output-buffer* "*output*")
(setf *texinfo-output-window-height* -5)
(setf *texinfo-output-buffer-flags* (+ *window-flag-ruler*
*window-flag-half-width-space*
)
)
@end を要するコマンドリスト。
(setf *texinfo-begin-completion-list*
'(
"cartouche" "copying"
"display" "deffn" "defmac" "defspec" "defun" "defopt" "deftypefn" "deftypefun" "defvar" "defvr" "detailmenu" "documentdescription"
"enumerate" "example"
"flushleft" "flushright" "format"
"ifinfo" "ifnotinfo" "ifnotplaintext" "ifnottex" "iftex" "ignore" "itemize"
"lisp"
"menu" "multitable"
"quotation"
"smalldisplay" "smallexample" "smalllisp" "smalllisp"
"table" "titlepage"
"verbatim"
)
)
(setf *texinfo-completion-list*
(append
'(
"-"
"abbr" "acronym" "appendix" "appendixsec" "appendixsection" "appendixsubsec" "appendixsubsubsec" "author"
"bullet" "bye"
"c" "chapheading" "chapter" "cindex" "code" "columnfractions" "command" "comment" "contents" "copyright"
"dfn" "dots"
"end" "enddots" "exampleindent" "exdent"
"file" "findex" "firstparagraphindent" "footnote" "footnotestyle"
"heading" "headings" "headitem" "hyphenation"
"image" "include" "inforef" "insertcopying" "item" "itemx"
"kbd" "key" "kindex"
"majorheading" "math" "minus"
"node" "noindent"
"option"
"page" "paragraphindent" "point" "printindex" "pxref"
"ref" "result"
"samp" "section" "setchapternewpage" "setfilename" "settitle" "strong" "subheading" "subsection" "subsubheading" "subsubsection" "subtitle"
"tab" "TeX" "tie" "title" "top"
"unnumbered" "unnumberedsec" "unnumberedsubsec" "unnumberedsubsubsec"
"var" "verb" "verbatiminclude" "vindex"
"w"
"xref"
"asis" "cp" "distinct" "double" "doubleafter" "fn" "insert" "ky" "none" "odd" "on" "off" "pg" "separate" "single" "singleafter" "tp" "vr"
)
*texinfo-begin-completion-list*
)
)
(setf *texinfo-structure-flags* (+ *window-flag-newline*
*window-flag-full-width-space*
*window-flag-vscroll-bar*
*window-flag-half-width-space*)
)
カレントバッファの構造表示で、表示させるコマンドを正規表現で指定します。
デフォルトではメニューや章、節などの見出しコマンド、コメント、インクルード等の Texinfo コマンドが構造表示されるよう設定されています。
(setf *texinfo-structure-regexp*
(compile-regexp "^@\\(chapter\\|unnumbered\\|appendix\\|majorheading\\|chapheading\\|section\\|unnumberedsec\\|appendixsec\\|appendixsection\\|heading\\|subsection\\|unnumberedsubsec\\|appendixsubsec\\|subheading\\|subsubsection\\|unnumberedsubsubsec\\|appendixsubsubsec\\|subsubheading\\|c\\|comment\\|include\\)[ \t]+.*$\\|^@\\(ignore\\|menu\\)$"
)
)
デフォルトでは、Texinfo コマンド @itemize, @enumerate, @table, @ftable, @vtable と、その環境中の @item, @itemx が構造表示されるよう設定されています。
(setf *texinfo-structure-item-regexp*
(compile-regexp
"^@\\(itemize\\|end itemize\\|enumerate\\|end enumerate\\|end table\\|end ftable\\|end vtable\\|end multitable\\|itemx?\\|headitem\\)$\\|^@\\(table\\|ftable\\|vtable\\|multitable\\|itemx?\\|headitem\\)[ \t]+.*$")
)
(define-key *texinfo-mode-map* #\TAB 'texinfo-do-completion)
(define-key *texinfo-mode-map* #\F9 'texinfo-jump)
(define-key *texinfo-mode-map* #\S-F9 'texinfo-rejump)
(define-key *texinfo-mode-map* #\C-] 'texinfo-goto-matched-environment)
(define-key *texinfo-mode-map* #\{ 'texinfo-insert-brace)
(define-key *texinfo-mode-map* #\C-{ 'texinfo-previous-node)
(define-key *texinfo-mode-map* #\C-} 'texinfo-next-node)
(define-key *texinfo-mode-map* '(#\C-c #\C-c) 'texinfo-insert-modifier)
(define-key *texinfo-mode-map* '(#\C-c #\m #\i) 'texinfo-makeinfo)
(define-key *texinfo-mode-map* '(#\C-c #\m #\h) 'texinfo-makeinfo-html)
(define-key *texinfo-mode-map* '(#\C-c #\m #\p) 'texinfo-make-pdf)
(define-key *texinfo-mode-map* '(#\C-c #\m #\t) 'texinfo-makeinfo-text)
(define-key *texinfo-mode-map* '(#\C-c #\C-s) 'texinfo-show-structure)
(define-key *texinfo-mode-map* '(#\C-c #\s) 'texinfo-show-structure-item)
(define-key *texinfo-mode-map* '(#\C-c #\t #\i) 'texinfo-texindex)
(define-key *texinfo-mode-map* '(#\C-c #\t #\t) 'texinfo-tex-typeset)
(define-key *texinfo-mode-map* '(#\C-c #\v #\d) 'texinfo-view-dvi)
(define-key *texinfo-mode-map* '(#\C-c #\v #\h) 'texinfo-view-html)
(define-key *texinfo-mode-map* '(#\C-c #\v #\i) 'texinfo-view-info)
(define-key *texinfo-mode-map* '(#\C-c #\v #\p) 'texinfo-view-pdf)
(define-key *texinfo-mode-map* '(#\C-c #\v #\t) 'texinfo-view-text)
(define-key *texinfo-structure-mode-map* #\RET 'texinfo-structure-goto)
(define-key *texinfo-structure-mode-map* #\TAB 'texinfo-structure-view)
(define-key *texinfo-structure-mode-map* #\SPC 'texinfo-structure-jump)
(define-key *texinfo-structure-mode-map* #\n 'next-virtual-line)
(define-key *texinfo-structure-mode-map* #\N 'texinfo-structure-next-menu)
(define-key *texinfo-structure-mode-map* #\p 'previous-virtual-line)
(define-key *texinfo-structure-mode-map* #\P 'texinfo-structure-previous-menu)
(define-key *texinfo-structure-mode-map* #\q 'texinfo-close-structure)
(define-key *texinfo-structure-mode-map* #\u 'texinfo-structure-up-menu)
(define-key *texinfo-structure-mode-map* #\v 'texinfo-structure-next-page)
(define-key *texinfo-structure-mode-map* #\z 'texinfo-structure-previous-page)
Texinfo コマンドを正規表現で指定し、色付けします。デフォルトで以下のように設定されています。
(setf *texinfo-regexp-keyword-list*
(compile-regexp-keyword-list
'(
("^@\\(node\\|anchor\\)[ \t]+[^,\n]*" nil 2)
("^@\\(chapter\\|unnumbered\\|appendix\\|majorheading\\|chapheading\\)[ \t]+" nil 16)
("^@\\(section\\|unnumberedsec\\|appendixsec\\|appendixsection\\|heading\\)[ \t]+" nil 6)
("^@\\(subsection\\|unnumberedsubsec\\|appendixsubsec\\|subheading\\)[ \t]+" nil 13)
("^@\\(subsubsection\\|unnumberedsubsubsec\\|appendixsubsubsec\\|subsubheading\\)[ \t]+" nil 3)
("@\\(c\\|comment\\)[ \t]+.*$" nil :comment)
("^@ignore" nil :comment)
("^@end ignore$" nil :comment)
("@[@{}][^@{} \n]*" nil (:color 0))
("@[a-zA-Z]*\\|{\\|}" nil 0)
)
)
)
以下に指定形式を簡単に説明します。
(setf *cftp-regexp-keyword-list*
(compile-regexp-keyword-list
'(
("regexp1" case-fold color)
...
("regexpN" case-fold color)
)
)
)
色付けするコマンドの正規表現。
大文字小文字を区別するか。‘nil’ で区別するようになります。
設定する色を指定します。いくつかの指定方法があります。
キーワード 1 〜 3 の色となります。
キーワード 1 〜 3 の色で、対象文字列が反転します。
キーワード 1 〜 3 の色で、対象文字列のある行が反転します。
0 〜 8 の数字を指定時と同じ色で太字となります。
:string
‘文字列’の色。
:comment
‘コメント’の色。
:tag
‘タグ’の色。
(:color fg [bg [atr])
fg に文字色としたい 0 〜 15 の数字、bg に背景色としたい 0 〜 15 の数字、atr には太字 :bold, 下線 :underline, 取り消し線 :strike-out, 行全体 :line を指定します。角括弧 ‘[ 〜 ]’ は省略可能を意味します。
*texinfo-mode-hook*
Texinfo-mode フック変数。
*texinfo-structure-mode-hook*
構造表示モードフック変数。
See 構造表示モード.