SLIMEとSBCLがSLIMEインストールメモ - もうカツ丼でいいよなのやり方で入っている。
init.el(.emacs)に以下の記述を追加してある。
;;; SLIME {{{2 ;; M-x my-slime: 分割したウィンドウでslime起動 ;; C-c C-r: 選択範囲をslime-replへ送って評価 (add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime") (require 'slime-autoloads) (setq slime-lisp-implementations `((sbcl ("/opt/local/bin/sbcl")) (abcl ("/opt/local/bin/abcl")) (clisp ("/opt/local/bin/clisp")))) (add-hook 'lisp-mode-hook (lambda () (global-set-key "\C-cH" 'hyperspec-lookup) (cond ((not (featurep 'slime)) (require 'slime) (normal-mode))))) (eval-after-load "slime" '(slime-setup '(slime-fancy slime-banner))) (global-set-key "\C-cs" 'slime-selector) (defun my-slime (&optional command coding-system) "Run slime and split window." (interactive) (if (< (count-windows) 2) (split-window-horizontally) ) (other-window 1) (slime command coding-system) (other-window 1) ) (defun slime-repl-send-region (start end) "Send region to slime-repl." (interactive "r") (let ((buf-name (buffer-name (current-buffer))) (sbcl-buf (get-buffer "*slime-repl sbcl*"))) (cond (sbcl-buf (copy-region-as-kill start end) (switch-to-buffer-other-window sbcl-buf) (yank) (slime-repl-send-input "\n") (switch-to-buffer-other-window buf-name)) (t (message "Not exist *slime-repl sbcl* buffer!"))) )) (global-set-key "\C-c\C-r" 'slime-repl-send-region)
コメントに書いてあるけど、M-x my-slimeするとウィンドウが左右に分割された上、右側でインタプリタが動く。
リージョン選択後にC-cC-rすると選択範囲がインタプリタに送られて実行される。今Lisp勉強しててメモの途中にコード書いて確認する場合が多いため、グローバルマップにコマンド割り当てている。コピペする場合はそのへん適当にアレしてください。
あとelispとかよく分からないまま雰囲気で書いており力技感ぱないなのでそのへんも適当にアレしてください。
SLIMEは何のためにどうやって使うものか今ひとつ把握してないのだけれども、あれだけコマンドがあるのにインタプリタに送って実行させて確認してというコマンドが見当たらないということは、もしかしてこういう使い方をするものではないのだろうか。