popwin.elで*Compile-Log*ウマウマ

id:m2ym さんがpopwin.elをリリースされました.
http://d.hatena.ne.jp/m2ym/20110120/1295524932


自分はauto-save-buffers.elを使って2秒ごとに自動保存をしつつ,emacs-lispの場合ならバイトコンパイルをしています.

(add-hook 'after-save-hook
          (function (lambda ()
                      (if (eq major-mode 'emacs-lisp-mode)
                          (save-excursion
                            (byte-compile-file buffer-file-name)
                            )))))

んで,ここで問題になるのが*Compile-Log*がwindowを半分うばいとってしまうのです.
単に保存時にバイトコンパイルする場合の最終確認としての*Compile-Log*はうざくないのですがauto-save-buffers常用なんで
・・・・.

ということで,今回リリースされたpopwin.elを使って*Compile-Log*をポップアップウィンドウにだしてもらいます.

auto-installを使って

(auto-install-from-url "https://github.com/m2ym/popwin-el/raw/master/popwin.el")

をさっくり評価し,インストール.
んで,設定

(require 'popwin)
(setq display-buffer-function 'popwin:display-buffer)
(push '("*Compile-Log*" :height 10 :noselect t) popwin:special-display-config)

これでウマウマです.
はじめはnoselectを入れてなかったんで,毎回フォーカスがポップアップウィンドウに写っていたのですが,ちゃんとドキュメントを読むとnoselect tでフォーカスが移らなくなりました.

色々とバッファ表示でイライラすることがあるかもしれないので,その都度設定していきます.

file-cache にファイルを追加

(require 'filecache)
(file-cache-add-file-list
 (list "~/.emacs")) ;; ファイルを追加

これやけばこんなことやらなくてもよかった。
るびきちさんから

とあったが、ディレクトリを補完したときにTAB入力したら掘って欲しいので
anything-filelist+ではなくて、anything-finf-fileの中身をコピーして

(defun my-anything-find-file ()
  "Replacement of `find-file'."
  (interactive)
  (let
      ((anything-map (anything-read-file-name-map))
       anything-read-file-name-follow-directory uses these variables
       (prompt "Find File: ")
       default-filename require-match predicate
       (additional-attrs '(;; because anything-c-skip-boring-files cannot
                           ;; handle (display . real) candidates
                           (candidate-transformer)
                           (type . file)))
       )
    (anything-other-buffer '(
;;                             anything-c-source-my-emacs-path
                             anything-c-source-file-cache
                             anything-c-source-ffap-line
                             anything-c-source-ffap-guesser
                             ;;anything-c-source-find-files
                             anything-c-source-files-in-current-dir
                             ;;anything-c-source-buffers+
                             anything-c-source-buffer-not-found
                             ;;anything-c-source-recentf
                             anything-c-source-bookmarks
                             anything-c-source-elisp-library-scan
                             anything-c-source-filelist
                             )
                           "*anything find-file*"))

これにすればTABで掘れる。
本当はちゃんと書ければいいだろうけど、コピペ野郎なんで・・・。

 ミニバッファにwindow-live-p,nil が出まくってたので

いつからか、emacsのミニバッファに

Wrong type argument: window-live-p, nil

って出てうっとおしい。


メッセージバッファみたら

error in process filter: anything-output-filter--post-process:Wrong type argument: window-live-p, nil

ともう一行出てた(失念)。

(setq debug-on-error t)

をスクラッチで評価して色々作業してたらどうやらC-xC-fを行ったときに起きているっぽい。C-xC-fを行ったらバックトレースが出てきた。


自分はanythingでC-xC-fのfind-fileをanything-find-fileにしてる。(anything-kryでかな)
そして、リストの末尾にるびきちさんのホームディレクトリ内でupdatedb/locateのソースを追加しているんだけど、
どうやらそれが悪さをしているみたい。


ということで、anything-filelist 〜すべてのファイルを瞬時に開く方法〜を参考にanything-filelistに変更。
これだと、リストに表示される順番も自分で決められる。優先順位はemacs関係、研究関係、その他で。


今の所、再発してないので良かったかな?

anything-find-file の先頭に良く使うファイルパスを追加 

(defvar anything-c-source-my-emacs-path
  '((name . "Emacs-Setting")
    (candidates . ("~/.emacs"))
    (action . find-file)
    (type .file)
    )
)

http://d.hatena.ne.jp/troter/20100220/1266683598
こちらのanything-find-file-additional-sources-at-first
の先頭にanything-c-source-my-emacs-pathを追加。
これだけのためにどんだけ時間かかったことやら。

ブログ再開

重い腰を上げてsimple-hatena-modeを導入したんで九ヶ月ぶりに投稿.
研究室入ったときに,一度導入しかけたんだけどそのときはなんでだか動かせなかったんだけどね.
ちゃんとネタになること,RubyEmacsに関してちゃんとかくべ.