差分というかバッファの部分比較
compare-windowsってのが結構便利だけど。色とか付かないし、そもそも、調べないと使い方すら分からなさそうな雰囲気なので適当に何とかしてみた方が良いのかなぁと。pukiwiki-modeで差分を考える前に思った。適当に作ってみたcompare-windowsシツコク確認しまくるバージョン
(defvar *compare-windows-diff-color* '(:bold t :underline t :foreground 0 :background 15)) (defun compare-windows-- () "執拗に聞きまくるcompare-window" (interactive) (when (< (count-windows nil) 2) (message "素早く比較したい場合は予めWindowを分割してください。") (let ((curbuf (selected-buffer)) buf) (setq buf (buffer-selector)) ;read-file-nameでもいいかもしれない。 (when buf (split-window-vertically) (other-window) (set-buffer buf) (refresh-screen) (when (yes-no-or-cancel-p "~Aの比較開始行を指定しますか?" buf) (message "物理行で指定してください") (goto-line-dialog) (refresh-screen) (while (not (yes-no-or-cancel-p "ここから比較開始で良いですか?")) (goto-line-dialog) (refresh-screen)))) )) (compare-windows) (unless (eobp) (save-excursion (apply #'set-text-attribute (point) (and (goto-eol) (point)) 'diff-point *compare-windows-diff-color*) (sit-for 5) (delete-text-attributes 'diff-point)) ))
自分の便利のために作ってみた。あんまり執拗じゃない感じの。
(defvar *compare-windows-diff-color* '(:bold t :underline t :foreground 0 :background 15)) (defun compare-windows++ () "画面が分割されてない時は分割する.色も少し付ける。" (interactive) (when (< (count-windows nil) 2) (let ((curbuf (selected-buffer)) buf) (setq buf (buffer-selector)) ;read-file-nameでもいいかもしれない。 (when buf (split-window-vertically) (other-window) (set-buffer buf))) (return-from compare-windows++)) (compare-windows) (unless (eobp) (save-excursion (apply #'set-text-attribute (point) (and (goto-eol) (point)) 'diff-point *compare-windows-diff-color*) (sit-for 5) (delete-text-attributes 'diff-point)) ))
で、思ったのは、一時バッファあたりに比較した部分の内容をコピーとかしてやらないと、同一のバッファとかを比較したら色付けとかが変になってしまうとか。直ぐに色が消えるようにするのが、少し手間が掛かるとか。そんな感じ。pukiwikiの場合は別に殆ど一時バッファなので、特に問題ないかもしれないが。