Emacsの23と互換性のあるPHPモード(および他のCCモード由来モード)の製造
質問
私は、Emacs 23とのphp-mode.el の1.5.0を使用しています。私は私の.emacs
でこれを持っている場合:
(require 'php-mode)
Emacsは起動時に私は、このエラーメッセージが表示されます:
警告(初期化): `/Users/kdj/.emacsの読み込み中にエラーが発生しました
エラー: `C-LANG-defconstは」ファイルで使用する必要があります。
正常な動作を保証するためには、調査し、削除する必要があります あなたの初期化ファイルのエラーの原因。 Emacsは起動して `--debug-INIT」オプションは、完全なエラーバックトレースを表示します。
Emacsが起動した後、私は(require 'php-mode)
を評価した場合、私はすべてのエラーメッセージを得ることはありません。
私はあることを示しブログエントリを見つけこの問題は、Emacs 23に固有である(つまり、Emacsの22.xでエラーがない、である)が、それはどんな解決策を与えるものではありません。
これが重要かどうかは知りませんが、私は、Mac OS Xを使用している、と私は./configure --with-ns
を使用して、現在のCVSソースからのEmacsを構築します。
ここで何が起こっている、および/または私はそれを修正することができますか?
解決
私は同じ問題に遭遇しました。 CSHARPモードの実際のEmacs Lispファイルを掘り下げるとき、私は最終的に解決策を見つけます:
;; This code doesn't seem to work when you compile it, then
;; load/require in the Emacs file. You will get an error (error
;; "`c-lang-defconst' must be used in a file") which happens because
;; cc-mode doesn't think it is in a buffer while loading directly
;; from the init. However, if you call it based on a file extension,
;; it works properly. Interestingly enough, this doesn't happen if
;; you don't byte-compile cc-mode.
だから、あなたの.emacsに入れて迅速かつ汚い修正が延長に自動ロードにあり、そこに(require 'php-mode)
または(load "php-mode")
を入れません。さらに騒ぎがなければ、
(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))
私はこのことができます願っています!今、私はちょうど働いPHP / HTMLモード切替ものを取得する必要があります。私に幸運を祈ってます。