第17回慢性的CL勉強会@Lingr 8時だョ!全員集合 に参加。お題は 開発環境 で各人に開発環境の発表。他の人が具体的にどんなふうに環境を構築しているかわかって有意義かつ楽しかった。
で、せっかくなので自分のをここにまとめておく。
OS
OS は Debian sid(unstable) x86_64
処理系
処理系は SBCL で Debian パッケージ。Debian の場合は common-lisp-controller も一緒にインストールされ SBCL のコアに組み込まれる。common-lisp-contoller は "/var/cache/common-lisp-controller/[uid]/[処理系]/[ソースのパス]/" ディレクトリにコンパイル済ファイル(fasl)を配置してくれる。複数ユーザ、複数処理系でも大丈夫。
あと hyperspec, sbcl-src パッケージもインストールしている。
ライブラリ
ライブラリの取得は clbuild を使用。./clbuild update --all-projects のコマンド一発で130以上のライブラリが常に最新にできるところが便利。ちなみに clbuild は ./clbuild run climacs とかすると Climacs を起動してくれたりもする。clbuild にあらかじめないライブラリも設定ファイルに記述することで取得対象に含めることができる。
自作ライブラリは ~/letter/lisp/lib の下に配置して ~/.sbclrc から asdf:*central-registry* に登録している。ソース管理は darcs を使用。
~/.sbclrc は↓
;;;;; -*-lisp-*-
;;デバッグ用セッティング
(declaim (optimize (debug 3)))
;;(declaim (optimize (debug 0) (safety 0) (speed 3) (space 0)
;;                   (compilation-speed 0)))
(setf (logical-pathname-translations "ancient")
      `(("**;*.*" "/home/ancient/letter/lisp/**/*.*")))
;; ~/letter/lib 以下の asd を登録する。
(loop for path in (directory (translate-logical-pathname
                                       "ancient:lib;**;*.asd"))
      do (let ((pd (pathname-directory path)))
           (unless (member "_darcs" pd :test #'equal)
             (pushnew (make-pathname :directory pd)
                      asdf:*central-registry*
                      :test #'equal))))
;; clbuild
(pushnew (translate-logical-pathname "ancient:clbuild;systems;")
         asdf:*central-registry*)
(defun climacs ()
  "Climacs を起動する。"
  (load (merge-pathnames ".climacs.lisp" (user-homedir-pathname))))
(defun maxima ()
  "Maxima を起動する。"
  (let ((*default-pathname-defaults*
         (translate-logical-pathname "ancient:clbuild;source;maxima;src;")))
    (load "maxima-build.lisp")
    (maxima-load)
    (cl-user::run)))
;;; If the first user-processable command-line argument is a filename,
;;; disable the debugger, load the file handling shebang-line and quit.
(let ((script (and (second *posix-argv*)
                   (probe-file (second *posix-argv*)))))
  (when script
    ;; Handle shebang-line
    (set-dispatch-macro-character #\# #\!
                                  (lambda (stream char arg)
                                    (declare (ignore char arg))
                                    (read-line stream)))
    ;; Disable debugger
    (setf *invoke-debugger-hook*
          (lambda (condition hook)
            (declare (ignore hook))
            ;; Uncomment to get backtraces on errors
            ;; (sb-debug:backtrace 20)
            (format *error-output* "Error: ~A~%" condition)
            (quit)))
    (load script)
    (quit)))
エディタ
Emacs から SLIME を使用。SBCL のコアファイルはいじらず Emacs から M-x slime として開発。
~/.emacs の SLIME まわりの設定は↓
;;;;;SLIME
(setq common-lisp-hyperspec-root "file:/usr/share/doc/hyperspec/")
(add-path "~/letter/lisp/clbuild/source/slime")
(add-path "~/letter/lisp/clbuild/source/slime/contrib")
(setq slime-backend (expand-file-name
                     "~/letter/lisp/clbuild/source/slime/swank-loader.lisp"))
(setq slime-communication-style :fd-handler)
(setq slime-lisp-implementations
      `((sbcl ("sbcl") :coding-system utf-8-unix)
        (clisp ("clisp") :coding-system utf-8-unix)
        (acl ("/home/ancient/local/opt/acl81_express/alisp")
             :coding-system utf-8-unix)
        (cmucl ("lisp"))))
(require 'slime-autoloads)
(add-hook 'lisp-mode-hook
          (lambda ()
            (cond ((not (featurep 'slime))
                   (require 'slime)
                   (normal-mode)))))
(setq slime-truncate-lines nil)
(setq slime-enable-evaluate-in-emacs t)
(add-hook
 'slime-mode-hook
 (lambda ()
   (global-set-key [(control ?\;)] 'slime-selector)
   (slime-define-key [(control ?c) ?\;] 'slime-insert-balanced-comments)
   (slime-define-key [(control ?u) (control ?c) ?\;]
                     'slime-remove-balanced-comments)
   (slime-define-key [(control ?c) ?\;] 'slime-insert-balanced-comments)
   (slime-define-key "\C-m" 'newline-and-indent)
   (slime-define-key "\C-i" 'slime-indent-and-complete-symbol)))
(add-to-list 'auto-mode-alist '("\\.asd$" . common-lisp-mode))
(eval-after-load "slime"
  '(progn
    (slime-setup '(slime-asdf
                   slime-fancy
                   slime-indentation
                   slime-references
                   slime-tramp
                   slime-banner))
    (setq slime-complete-symbol*-fancy t)
    (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))
キーボード
Kinesis で Dvorak 配列。Qwerty での W と E のキーを ( と ) にしている。括弧を打つのにシフトキーを押さなくていいのは快適♪
で http://bc.tech.coop/blog/060131.html にあるのと同じようにタッチパッドをくっつけて、膝の上においてタイプしてる。