SICPのための環境設定

SICP(http://mitpress.mit.edu/sicp/)を読み進めるためのEmacs設定のメモ。

CentOS7で進めていますが、他LinuxBSD等でも大丈夫なはずです。

原文 Welcome to the SICP Web Site

和訳 計算機プログラムの構造と解釈 第二版

1.Gaucheのインストール

CentOSGaucheをインストールします。

mkdir tmp

cd tmp/

wget http://prdownloads.sourceforge.net/gauche/Gauche-0.9.4.tgz

tar zxvf Gauche-0.9.4.tgz

cd Gauche-0.9.4/

./configure && make && make install

無事インストールを終え、

gosh

とタイプしてGaucheインタプリタが起動したら成功です。

2.Emacsの設定

O'Reilly Japan - プログラミングGauche

上記の本に記載されている方法を丸コピします。

~/.emacs.d/init.elを作成し、以下のように記述します。

;~/.emacs.d/init.el
(modify-coding-system-alist 'process "gosh" '(utf-8 . utf-8))
(setq scheme-program-name "gosh -i")
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t)
(defun scheme-other-window()
  "Run scheme on other window"
  (interactive)
  (switch-to-buffer-other-window
    (get-buffer-create "*scheme*"))
  (run-scheme scheme-program-name))

(define-key global-map
  "\C-cs" 'scheme-other-window)

設定が済んだら、

emacs test.scm

などとタイプし、Emacsを起動します。

Gaucheの起動 C-c s
バッファの移動 C-c o
S式の評価 C-x e

以上