2013年3月9日土曜日

PHP開発用emacs設定

php-mode, flymake


geben

ステップ実行に頼らずに生活できるようになりたいけど。
/etc/php.d/xdebug.ini
zend_extension=/usr/lib/php/modules/xdebug.so
xdebug.remote_enable=yes
xdebug.remote_autostart=no
xdebug.remote_host=localhost
xdebug.remote_port=9000

phpファイルにxdebug_break()
リクエストにXDEBUG_SESSION_STARTをつける


ctags

M-.
(defun run-refresh-tag()
(interactive)
(shell-command "cd /path/to/source; ctags -e -R --php-kinds=cfd &"))

yasnippet-php-mode

標準ライブラリの関数の引数の順序がいつもわからなくなるので助かる。

その他



;; 開いてるファイルをphpunitする
(defun run-php-unit()
(interactive)
(shell-command (concat "phpunit " (buffer-file-name) " &")))

;; 選択したリージョンをevalする

(defun php-eval-region ()
(interactive)
(shell-command-on-region (region-beginning) (region-end) "php ~/.emacs.d/php-eval-region/eval.php"))


~/.emacs.d/php-eval-region/eval.php
<?php
$region = file_get_contents('php://stdin');
if (strlen($region) > 0) {
  ob_start();
  eval('$_tmp_ = ' . $region . ';');
  $output = ob_get_contents();
  ob_end_clean();
  if (strlen($output) > 0) {
   print($output . "\n");
  }
  print_r($_tmp_);
}


まだ、これくらいしか設定してない。

0 件のコメント:

コメントを投稿