PHPを使うWebアプリケーション開発用にインストールしたEmacs Lispメモです。
- PHP mode for Emacs
- HTML helper mode beta
- javascript.el
- A CSS editing mode for Emacs
- EmacsWiki: Smarty Mode
elファイルは、/usr/local/share/emacs/22.1/site-lispに置きました。
php-mode
ダウンロード:SourceForge.net: PHP mode for Emacs
バージョン:1.4.0
1.4.0は、Emacs バージョン22.1がサポート対象のようです(SourceForge.net: PHP mode 1.4.0 released)。
.emacs設定
php-mode1.2.0では、タブ幅の設定などは、php-mode-user-hookで動作していました。
php-mode1.4.0は、php-mode-hookで動作するようです。
(add-hook 'php-mode-hook 'turn-on-font-lock)
(autoload 'php-mode "php-mode" "PHP mode" t)
(defcustom php-file-patterns (list "\\.php[s34]?\\'" "\\.phtml\\'" "\\.inc\\'")
"*List of file patterns for which to automatically invoke php-mode."
:type '(repeat (regexp :tag "Pattern"))
:group 'php)
(let ((php-file-patterns-temp php-file-patterns))
(while php-file-patterns-temp
(add-to-list 'auto-mode-alist
(cons (car php-file-patterns-temp) 'php-mode))
(setq php-file-patterns-temp (cdr php-file-patterns-temp))))
(add-hook 'php-mode-hook '(lambda ()
(setq c-basic-offset 2)
(setq c-tab-width 2)
(setq c-argdecl-indent 0)
(setq c-auto-newline nil)
(setq c-continued-statement-offset 0)
(setq c-indent-level 2)
(setq c-label-offset -2)
(setq c-tab-always-indent t)
(setq indent-tabs-mode t)
(setq tab-width 2)
(setq-default tab-width 2)
) t)
参考リンク
html-helper-mode
.emacs設定
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq auto-mode-alist (cons '("\\.\\(html\\|htm\\|tpl\\|ctp\\)$" . html-helper-mode) auto-mode-alist))
(add-hook 'html-helper-mode-hook '(lambda ()
(setq c-basic-offset 2)
(setq c-tab-width 2)
(setq c-argdecl-indent 0)
(setq c-auto-newline nil)
(setq c-continued-statement-offset 0)
(setq c-indent-level 2)
(setq c-label-offset -2)
(setq c-tab-always-indent t)
(setq indent-tabs-mode t)
(setq tab-width 2)
(setq-default tab-width 2)
) t)
参考リンク
javascript-mode
javascript.elは、javascript.el - Yet Another Hackadelicの記事でダウンロード先が紹介されています。
.emacs設定
(add-to-list 'auto-mode-alist (cons "\\.\\(js\\|as\\|json\\|jsn\\)\\'" 'javascript-mode))
(autoload 'javascript-mode "javascript" nil t)
(setq js-indent-level 2)
css-mode
ダウンロード:A CSS editing mode for Emacs
バージョン:0.10
.emacs設定
(autoload 'css-mode "css-mode" "CSS mode" t)
(setq auto-mode-alist
(cons '("\\.css\\'" . css-mode) auto-mode-alist))
(setq cssm-indent-function #'cssm-c-style-indenter)
smarty-mode
ダウンロード:EmacsWiki: Smarty Mode
.emacs設定
(add-to-list 'auto-mode-alist (cons "\\.tpl\\'" 'smarty-mode))
(autoload 'smarty-mode "smarty-mode" "Smarty Mode" t)