2バイト文字コメント対応camldebug.el for 最近のOCaml
ついでに
http://www.h2.dion.ne.jp/~pana/camldebug.html
のパッチをダウンロードして、内容を理解せず字面だけパターンマッチして、最近のOCaml(位置の表示が文字数ではなく行番号+文字数になった?)に対応させてみました。まだ1文字か2文字ぐらいずれてるかもしれませんが。
> diff /usr/local/src/ocaml-3.09.1/emacs/camldebug.el ~/elisp/camldebug.el 310c310 < (camldebug-goto-position (int-to-string (1- (point)))) --- > (camldebug-goto-position (int-to-string (1- (camldebug-position-bytes (point))))) 669,670c669,670 < (setq spos (+ (point-min) schar)) < (setq epos (+ (point-min) echar)) --- > (setq spos (camldebug-byte-to-position schar)) > (setq epos (camldebug-byte-to-position echar)) 730c730 < (if insource (1- (point)) (nth 1 frame))))) --- > (if insource (1- (camldebug-position-bytes (point))) (nth 1 frame))))) 782a783,789 > (defun camldebug-position-bytes (pos) > (/ (+ (position-bytes pos) pos) 2)) > > (defun camldebug-byte-to-position (byte) > (let* ((pos (min (point-max) byte))) > (while (>= (camldebug-position-bytes pos) byte) (setq pos (1- pos))) > pos))