@kyanny's blog

My thoughts, my life. Views/opinions are my own.

eshell でエスケープシーケンスをまともに表示させる設定

EmacsWiki ばんざい。

http://www.emacswiki.org/emacs-ja/EshellColor

    (require 'ansi-color)
    (require 'eshell)
    (defun eshell-handle-ansi-color ()
      (ansi-color-apply-on-region eshell-last-output-start
                                  eshell-last-output-end))
    (add-to-list 'eshell-output-filter-functions 'eshell-handle-ansi-color)

Term::ReadLine を使ったスクリプトだとか、 colordiff の結果だとかが、化け化けになっていて、そういうときだけしぶしぶふつうの bash を使っていたけど、これでもうそんなのとはおさらば。

たびたび eshell イイヨーとこのブログに書いてますが、本当にいいと思う。僕は zsh をばりばりにカスタマイズして使ったことがないので(ちょっと使ったことはある)、そういう環境と比べて生産性が優れているかどうかはなんともいえないですが、僕は eshell じゃなかったら三倍くらい仕事がやりづらいだろうなあと思う。 zsh の強力な補完機能と、 eshell の(っていうか emacs の)強力な編集機能、僕なら後者です。なんか適当なスクリプトを書いて、どこかからとってきたデータの体裁をちょっと整えて、メールに貼り付けて送る。これ全部 emacs の中でできる、マウスでコピーアンドペーストとか一切しなくていい、っていうのは、慣れたから別に有り難いと思わないけど、もしこれができなかったらストレスを感じるだろうなぁと思う。

追記

In order for eshell to understand these commands, you have to add an output filter. You can do this with CVS Emacs (as of 2008-09-28) by customizing eshell-output-filter-functions or by adding the following to your .emacs:

ということで、 Mac OSX Leopard に標準付属の emacs では起動時にエラーが出てしまうなぁ。