csharp-modeを追加する

Mac OSX(Leopard)上のCarbon版Emacsにcsharp-modeを追加してみました。
以下のような手順でした。

パッケージの取得

パッケージは今回, 沖ソフトウェア株式会社さんのサイト内におかれているもの(http://www.okisoft.co.jp/esc/cygwin-11/csharp-mode.el)を使いました。

パッケージの配置

ダウンロードしたファイル(sharp-mode.el)をsite_lispディレクトリに配置。(うちの環境では/Applications/Emacs.app/Contents/Resources/site-lispです)。

.emacs.elの変更

ホームディレクトーにパッケージを使うための設定を追加しました。今回設定した内容は、以下のとおりです。

(require 'csharp-mode)
(add-hook 'csharp-mode-hook (lambda ()
                              (setq c-basic-offset 4
                                    tab-width 4
                                    indent-tabs-mode nil)))
(autoload 'csharp-mode "csharp-mode" "C# editing mode." t)
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))

;; Set Default Compiler Command
(setq-default compile-command "mcs ")
;(setq-default compile-command "csc ") ;Meadow用
;; Set Key
(global-set-key "\C-x\c" 'compile)
不足マクロの追加

以上の設定のあとemacsを起動すると「c-paren-re」がないというようなエラーが出ました。
http://home.c2i.net/kwhitefoot/CsharpNotes.htmlに以下の内容をcsharp-mode.elに追加しろと書いてあったので、そのとおり追加しました。

;;;c-paren-re and c-identifier-re were helper macros that
;;;got removed from cc-mode, as noted in the changelog
;;;for 2002-09-10.
;;;If you add these to csharp-mode.el, things seem to
;;;work ok.

;;; Helpers for building regexps.
(defmacro c-paren-re (re)
`(concat "\\(" ,re "\\)"))
(defmacro c-identifier-re (re)
`(concat "\\[^_]"))

これで、再起動するとOKでした。