addref > info-modoki-mode
xyzzy-lisp 書いてるときは引数とか忘れたら F1 で info-modoki-mode 見てて、それだと reference に入ってないものが見れないんで自分で追加する方法。
必要なもの
全部 netinstaller からインストールできる。
- info-modoki-mode: 見るために
- addref: 追加するために
- xy-reference: 追加したのを見れるようにするために
- reference.xml(xy-reference で取得できるみたいなので、いらないかも。)
info-modoki-mode で見る設定
.xyzzy とかに。シンボルにカーソル置いて F1 で見れるようになる。
(require "info-modoki-mode") (define-key ed::*lisp-mode-map* #\F1 'imm-refer-selection) (define-key ed::*lisp-interaction-mode-map* #\F1 'imm-refer-selection)
info-modoki-mode は ${XYZZY}/etc/reference.txt にあるリファレンスを使う。
addref でリファレンス追加
reference.xml 形式の xml を作るもの。
addref を読み込んでおいて M-x addref する。ミニバッファで色々聞いてくるので答えていく。
MEMO: #\SPC で補完しようとしてくれちゃってスペースを入力できない。complete+ の影響?C-q SPC で入力できる。
質問が終わったらウィンドウ分割して info-modoki-mode のような画面になるので、説明を書く。C-x C-s すると保存される。
保存先は user::*addref-file* でデフォルトは ${XYZZY}/etc/addref.xml。
xy-reference で変換
reference.xml 形式の xml を info-modoki-mode で使える reference.txt などに変換するもの。
addref で作った xml を変換するのにちょっと修正が必要。${XYZZY}/site-lisp/xy-reference.l の201行目あたり。addref の xml がファイルの先頭から "
addref で保存するときに先頭に空行でも入れておけば問題ない。ただ addref が新規に追加するときは先頭に追加するので使い方だけで対応しようとすると新規に追加する度にファイルの先頭に空行を入れることになる。
とりあえず xy-reference.l を変更しておいた。200行目あたり。
(defun parse-1file (file outputstream) (let ((c 0) (tmp t) title (reg (compile-regexp "\n+<chapter>"))) (save-excursion (set-buffer (create-new-buffer " xyref")) (setup-temp-buffer (selected-buffer)) (insert-file-contents file) (goto-char (point-min)) ;; ↓↓追加↓↓ (insert #\LFD) ;; ↑↑追加↑↑ (perform-replace "]+>\n?" "" nil t nil t) (goto-char (point-min)) #|以下略|# ...)))
んで *scratch* とかから使う。
;; 読み込む (progn (let ((*standard-output* (make-string-output-stream))) (byte-compile-file (find-load-path "xy-reference"))) (require "xy-reference")) => t ;; addref のファイルも一緒に変換する (pushnew *addref-file* xy-reference::*user-files* :test #'path-equal) => ("F:/bin/xyzzy-0.2.2.235/etc/addref.xml") ;; xml から txt に変換する (progn ;; キャッシュしてるんで削除 (setf xy-reference::*index-result* nil) (xy-reference:2txt)) => nil
info-modoki-mode で見れるように
再起動すりゃ見れるけど。
(delete-buffer *imm-buffer*) => t