php-modeのインストール


$ wget http://sourceforge.net/projects/php-mode/files/php-mode/1.5.0/php-mode-1.5.0.tar.gz/download
$ tar xzvf php-mode-1.5.0.tar.gz
$ cp php-mode-1.5.0/php-mode.el ~/.emacs.d/plugins/
.emacsの記述

;; php-mode
(require 'php-mode)

php-mode.el内に以下のようなコメントがあるので、最新のphp-modeでもPHP5には対応してないようだ。


;;; Commentary:
;; PHP mode is a major mode for editing PHP 3 and 4 source code.

次に、php用のyasnippetを探したところ、http://d.hatena.ne.jp/n314/20091116/1258354156こんなのがあったの入れてみる。


$ git clone git://github.com/nishimura/minimal-yasnippet-php-mode.git
$ cp -R minimal-yasnippet-php-mode/php-mode/ ~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/text-mode/html-helper-mode/
これでphp-modeでhtmlタグとPHP構文の補完ができるようになる…と思ったのだが使っていると以下のような警告が出た。

Warning (php-indent):
Indentation fails badly with mixed HTML and PHP.
Look for an Emacs Lisp library that supports "multiple
major modes" like mumamo, mmm-mode or multi-mode.
警告が出るだけで使えるからいいやとも思ったけど、mmm-mode入れるのが正しいのかな。