anything.elが動かないよ。

Table of Contents

emacsを初めたしかじろうです。こんにちは。anything.elを使うとcoolらしいのでインストールに励んでみました。

スペック

参考

anything導入のeverything ~3分で使えるanything.el~ - (rubikitch loves (Emacs Ruby CUI Books))

install-elisp.elのインストール

まっ更なemacsなので、elispをインストールする環境を構築なう。

.emacsを新規作成

(setq load-path (cons "~/.emacs.d/elisp" load-path))
(require 'install-elisp)
(setq install-elisp-repository-directory "~/.emacs.d/elisp/")

auto-install.elのインストール

anythingのインストールはauto-install.elがあったほうがいいらしいのでインストール。*1

M-x install-elisp-from-emacswiki RET(enter) auto-install.el 

.emacsを修正。

(setq load-path (cons "~/.emacs.d/elisp" load-path))
(require 'install-elisp)
(setq install-elisp-repository-directory "~/.emacs.d/elisp/")
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/auto-install/")
(auto-install-update-emacswiki-package-name t)
(auto-install-compatibility-setup)

anythingのインストール

M-x auto-install-batch RET(enter) anything RET(enter)

いっぱいダウンロードされるので、ctrl+C ctrl+C を押してぎゅんぎゅんインストールしていく。

(require 'anything-startup)

って書かなくても基本的なanythingは動くらしい。emacsを起動したらエラーも無く動いた。これで一応簡易なインストールはでけた。*2

anything-startupを起動できない

(require 'anything-startup)

って書くと、anythingが本気を出すらしい。anything-for-file とかがを使うにはこれを書かないとだめっぽい。ので書く。

最終的な.emacsはこんな感じ。

(setq load-path (cons "~/.emacs.d/elisp" load-path))
(require 'install-elisp)
(setq install-elisp-repository-directory "~/.emacs.d/elisp/")
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/elisp/")
(auto-install-update-emacswiki-package-name t)
(auto-install-compatibility-setup)
(require 'anything-startup)

これでemacsを起動すると、

An error has occurred while loading `/Users/shikajiro/.emacs':

Symbol's value as variable is void: eshell-read-aliases-list

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `–debug-init' option to view a complete error backtrace.

って表示されちゃう。お構いなしにanything-for-filesを実行すると

M-x anything-for-files
mapcar: Symbol's value as variable is void: anything-c-source-ffap-line

となり、実行されてません。

くまった。 (´(ェ)`)

追記

id:podhmoさんのコメントより

ファイルが存在しても、load-pathに入っていないのかもしれません。

とのご指摘がありましたので、調べてみました。

  • (describe-variable 'anything-c-source-ffap-line) のかっこの終端でC-x C-eをしてみる。
(defvar anything-c-source-ffap-line
'((name . "File/Lineno at point")
(init . (lambda () (require 'ffap)))
(candidates . anything-c-ffap-line-candidates)
(type . file)))
;; (anything 'anything-c-source-ffap-line) 

emacslistpまだ読めないけど、これは定義されてるぽいですね。

ふむぅ。(´(ェ)`)

追記2 できました

id:podhmoさんからのアイデアを色々やっているうちに解決しました。

うまくいった理由

carbon emacsでauto-installした。

だめだった理由

コンソール版のemacsでauto-installしていた。

インストールするemacsで結果が違うとは夢にも思わず・・・。これでemacsライフを満喫できます。


 *     +    巛 ヽ
            〒 !   +    。     +    。     *     。
      +    。  |  |
   *     +   / /   イヤッッホォォォオオォオウ!
       ∧_∧ / /
      (´∀` / / +    。     +    。   *     。
      ,-     f
      / ュヘ    | *     +    。     +   。 +
     〈_} )   |
        /    ! +    。     +    +     *
       ./  ,ヘ  |
 ガタン ||| j  / |  | |||
――――――――――――

id:podhmoさん、ありがとうございました。

*1:RETってenterキーのことらしいです。

*2:ここまで紆余曲折あって3時間はかかった。

----- COMMENT: AUTHOR: podhmo URL: http://d.hatena.ne.jp/podhmo/ DATE: 12/25/2010 13:33:31 違うかもしれないけれど、確認のため。
ファイルが存在しても、load-pathに入っていないのかもしれません。

(describe-variable 'anything-c-source-ffap-line)

のかっこの終端でC-x C-eをした場合にただしく表示されてますか?

また、load-pathに"~/.emacs.d/elisp"は追加されてますか?以下のS式を実行してnilが返ってくるのならload-pathに追加されていないのかもしれません。

(progn (require 'cl)
(remove-if-not (lambda (x) (string-match "~/.emacs.d/elisp" x)) load-path))


...でも、anythingが動くということはload-pathの設定は有効な気がします。


ところで、eshell-read-aliases-listはこちらの環境にはないシンボルです。
もしかしたら、anythingの設定を読み込む途中の段階でエラーが起きて途中までしか読み込まれていないのかもしれません。 ----- COMMENT: AUTHOR: re_shikajiro URL: http://d.hatena.ne.jp/re_shikajiro/ DATE: 12/25/2010 12:28:32 podhmoさんありがとうございます^^
追記1に調べてみた結果を書いてみました。anything-config.elは古くないっぽいですね・・・。 ----- COMMENT: AUTHOR: podhmo URL: http://d.hatena.ne.jp/podhmo/ DATE: 12/25/2010 11:52:24 はじめまして

anything-c-source-ffap-lineはanything-config.elで定義されています。
もしかしたら、anything-config.elがないか古いのではないでしょうか? ----- COMMENT: AUTHOR: re_shikajiro URL: http://d.hatena.ne.jp/re_shikajiro/ DATE: 12/25/2010 00:55:03 (require 'anything-startup) って特に必要がないのかな。