PAST ARTICLE · Apple
OS X Lion の Emacs Lisp の設定

OS X Lion の Emacs Lisp の設定メモです。PHPの開発環境を作るときに、開発がより便利になるもで、PHP mode for Emacs、Smarty Mode、js2-mode、css-mode の設定です。
PHP mode for Emacs
(http://sourceforge.net/projects/php-mode/files/php-mode/1.5.0/) から PHP mode for Emacs をダウンロードします。ダウンロードしたファルを解凍して、/usr/share/emacs/site-lisp/ 以下へ php-mode.el をコピーします。
$ cd ~/Downloads/
$ tar xvzf php-mode-1.5.0.tar.gz
x php-mode-1.5.0/
x php-mode-1.5.0/fdl.texi
x php-mode-1.5.0/Makefile
x php-mode-1.5.0/ChangeLog
x php-mode-1.5.0/php-mode.el
x php-mode-1.5.0/php-mode.texi
$ cd php-mode-1.5.0
$ cp php-mode.el /usr/share/emacs/site-lisp/次に、php-mode.el をバイトコンパイルします。emacs を開き、M-x byte-compile-file で Enter を押して、/usr/share/emacs/site-lisp/php-mode.el を指定します。
最後に、~/.emacs に設定を追加します。
$ emacs ~/.emacs
;; php-mode
(load-library "php-mode")
(require 'php-mode)
(add-hook 'php-mode-hook '(lambda ()
(setq c-basic-offset 4)
(setq c-tab-width 4)
(setq c-indent-level 4)
(setq tab-width 4)
(setq indent-tabs-mode t)
(setq-default tab-width 4)
))Smarty Mode
(http://deboutv.free.fr/lisp/smarty/download.php) から Smarty Mode をダウンロードします。ダウンロードしたファイルを解凍して /usr/share/emacs/site-lisp/ 以下へ、smarty-mode.el、smaty-mode.elc をコピーします。
$ cd ~/Downloads/
$ tar xvzf smarty-0.0.5.tar.gz
x smarty/
x smarty/smarty-mode.el
x smarty/docs/
x smarty/docs/smarty-mode-fr.html
x smarty/docs/smarty-mode-fr/
x smarty/docs/smarty-mode-fr/smarty-mode-fr.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_1.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_2.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_3.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_4.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_5.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_6.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_7.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_8.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_9.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_10.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_11.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_toc.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_ovr.html
x smarty/docs/smarty-mode-fr/smarty-mode-fr_abt.html
x smarty/docs/smarty-mode-en.html
x smarty/docs/smarty-mode-en/
x smarty/docs/smarty-mode-en/smarty-mode-en.html
x smarty/docs/smarty-mode-en/smarty-mode-en_1.html
x smarty/docs/smarty-mode-en/smarty-mode-en_2.html
x smarty/docs/smarty-mode-en/smarty-mode-en_3.html
x smarty/docs/smarty-mode-en/smarty-mode-en_4.html
x smarty/docs/smarty-mode-en/smarty-mode-en_5.html
x smarty/docs/smarty-mode-en/smarty-mode-en_6.html
x smarty/docs/smarty-mode-en/smarty-mode-en_7.html
x smarty/docs/smarty-mode-en/smarty-mode-en_8.html
x smarty/docs/smarty-mode-en/smarty-mode-en_9.html
x smarty/docs/smarty-mode-en/smarty-mode-en_10.html
x smarty/docs/smarty-mode-en/smarty-mode-en_11.html
x smarty/docs/smarty-mode-en/smarty-mode-en_toc.html
x smarty/docs/smarty-mode-en/smarty-mode-en_ovr.html
x smarty/docs/smarty-mode-en/smarty-mode-en_abt.html
x smarty/docs/smarty-mode-en.pdf
x smarty/docs/smarty-mode-fr.pdf
x smarty/smarty-mode.elc
$ cd smarty
$ cp smarty-mode.el* /usr/share/emacs/site-lisp/最後に、~/.emacs に設定を追加します。
$ emacs ~/.emacs
;; smarty-mode
(autoload 'smarty-mode "smarty-mode")
(setq auto-mode-alist
(cons '("\\.tpl\\'" . smarty-mode) auto-mode-alist))js2-mode
(http://code.google.com/p/js2-mode/downloads/list) から js2-mode をダウンロードします。ダウンロードしたファイルを /usr/share/emacs/site-lisp/ 以下へコピーします。
$ cd ~/Downloads/
$ cp js2-*.el /usr/share/emacs/site-lisp/js2.el次に、js2.el をバイトコンパイルします。emacs を開き、M-x byte-compile-file で Enter を押して、/usr/share/emacs/site-lisp/js2.el を指定します。
最後に、~/.emacs に設定を追加します。
$ emacs ~/.emacs
;; js2-mode
(autoload 'js2-mode "js2")
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))css-mode
(http://www.garshol.priv.no/download/software/css-mode/) から css-mode をダウンロードします。ダウンロードしたファイルを /usr/share/emacs/site-lisp/ 以下へコピーします。
$ cd ~/Downloads/
$ cp css-mode.el /usr/share/emacs/site-lisp/次に、css-mode.el をバイトコンパイルします。emacs を開き、M-x byte-compile-file で Enter を押して、/usr/share/emacs/site-lisp/css-mode.el を指定します。
最後に、~/.emacs に設定を追加します。
$ emacs ~/.emacs
;; css-mode
(autoload 'css-mode "css-mode")
(setq auto-mode-alist
(cons '("\\.css\\'" . css-mode) auto-mode-alist))
(setq cssm-indent-function #'cssm-c-style-indenter)以上、4つ追加しました。参考になればと思います。他にもたくさんいいものがあるかと思うので教えて頂ければと思います。
【追記5/13】github にソースを追加しましたので、必要な方はどうぞ〜 (https://github.com/Sugitaku/dotfiles/blob/master/.emacs)