anthyの入力モードに応じてカーソルの色を変える

anthyの入力モードでよく混乱するので、色を変えてみた。

(defvar anthy-cursor-color-alist
  '(("hiragana" . "red")
    ("katakana" . "green")
    ("alphabet" . "yellow")
    ("walphabet" . "green")
    ("hankaku_kana" . "green")
    )
  "モード名とカーソル色の対応表")
(defun anthy-adjust-cursor-color ()
  (if anthy-minor-mode
      (let (
	    (c (assoc anthy-current-rkmap anthy-cursor-color-alist))
	    )
	(if c (set-cursor-color (cdr c))))
    (set-cursor-color "white")
    ))
(mapcar
 (lambda (f)
   (eval
    `(defadvice ,f (after adjust-cursor-color activate)
       (anthy-adjust-cursor-color))))
 '(anthy-update-mode-line
   anthy-mode-off
   bury-buffer
   kill-buffer
   other-window
   pop-to-buffer
   switch-to-buffer
   ))