ログ日記

作業ログと日記とメモ

yasnippetを入れてみる

http://5am.jp/lifehack/texter/#download
ここのブコメから。

wget http://yasnippet.googlecode.com/files/yasnippet-0.6.1c.tar.bz2
tar xvjf yasnippet-0.6.1c.tar.bz2
mv yasnippet-0.6.1c ~/.emacs.d/plugins/
;;;;
;; yasnippet
(add-to-list 'load-path
             "~/.emacs.d/plugins/yasnippet-0.6.1c")

(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")


エラーが出た。

File error: Opening directory, そのようなファイルやディレクトリはありません, \
.emacs.d/plugins/yasnippet-0.6.1c/snippets/text-mode/dummy/

バージョンが23だからかな。

% emacs --version
GNU Emacs 23.0.60.1
Copyright (C) 2008 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

こうするといいらしい。

Try this dirty workaround 

(let ((emacs-major-version 22))
  (unintern 'locate-dominating-file)
  (unintern 'locate-dominating-stop-dir-regexp)
  (require 'yasnippet))

instead of

  (require 'yasnippet)
Google Code Archive - Long-term storage for Google Code Project Hosting.


PHPモードを入れる。

wget wget http://apgwoz.com/hacks/yasnippet-php-mode.tar.gz
tar xvzf yasnippet-php-mode.tar.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: 処理中にエラーが起きましたが、最後まで処理してからエラー終了させました

えー…。
気を取り直して。

tar xvf yasnippet-php-mode.tar.gz
cp -a yasnippet-php-mode/php-mode ~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/text-mode/


使ってみると、めためた重い…。
あとarrayでタブを押したら長いリストが表示されるけど、リストが多すぎて正直打った方が早そう。
if でタブを押すと候補が二個出る。C言語と干渉してる?使わなさそうなmodeディレクトリを全部消してみたが、起動速度は遅いまま。php-modeディレクトリも消すと若干早くなる。やっぱりphp-modeディレクトリにファイルがありすぎるのが問題か。
一度待避させておいて

mkdir php-mode
cd php-mode
for foo in class funct function if ifelse while switch; do cp moved_path/$foo .; done

などとして必要なものだけ持ってきた。


で、ここでfunctとfunctionの内容が同じだと気付いた。もうどうせならfでいいんじゃなかろうか…。
というわけで cp funct f した。
あとpubでpublic functionとかもやりたいな。ここで入れたのは明らかにオーバースペックだから最小限のものを自分で作ろうかね…。