slime の履歴を anything で呼び出す
candidate-transformer というのを知らなかったので以下のページが参考になりました
参考 2009-10-16 - 武蔵の日記
これを .emacs.el に貼付け
(defun anything-slime () (interactive) (anything (list anything-slime-history anything-c-source-recentf anything-c-source-buffers+))) ;; ソースは少なめが使いやすいと思う (defvar anything-slime-history '((name . "Slime History") (candidates . (lambda () (with-temp-buffer (insert-file-contents "~/.slime-history.eld") (delete-dups (read (current-buffer)))))) (candidate-transformer . (lambda (candidates) (mapcar '(lambda (s) (cons s s)) candidates))) (action . (("Insert" . insert)))))
あとは anything-slime を適当にキーバインドすればOK
slime の履歴ファイルは上の ~/.slime-history.eld でいいと思うけれども違ったら適宜修正のこと
自分はキーバインドをメジャーモードで分岐して使っている
(global-set-key (kbd "C-;") (lambda () (interactive) (case major-mode ((slime-repl-mode lisp-mode) (call-interactively 'anything-slime)) ((eshell-mode) (call-interactively 'anything-eshell)) (otherwise (call-interactively 'anything)))))
以前の eshell の履歴に関する記事 eshell で使う anything.el のソース - TIPS
追記
履歴は slime 終了時に保存されるので1コマンドごとに保存するには以下のアドバイスをしておく
(defadvice slime-repl-return (after slime-repl-return-after-advice) (slime-repl-save-history)) (ad-activate 'slime-repl-return)
履歴のサイズも設定しておくといいと思う
(setq slime-repl-history-size 1000)