emacs 24 で csh スクリプトモードのインデントがおかしくなる件

emacscshシェルスクリプトを編集しようとしたところ、改行のたびに余計なインデントが追加されてしまう現象が発生。
どうもemacs 24でsh-modeの仕様が変わったこと、csh-modeがちゃんと整備されていないことの二点が原因の模様。

まず
https://github.com/kaushalmodi/.emacs.d.git
をクローンして、中の csh-mode.el を load-path にあるディレクトリにコピー。
そして、.emacs に以下のフックを追加。

(add-hook 'sh-set-shell-hook
(lambda ()
(when (string-match ".*csh$" (symbol-name sh-shell))
(message "csh mode")
(require 'csh-mode)
(setq-local indent-line-function 'csh-indent-line)
(setq-local indent-region-function 'csh-indent-region))))


でなんとかまともに編集できるようになった。

参考
http://emacs.stackexchange.com/questions/6051/fixing-forced-indentation-in-shell-script-mode-for-tcsh