3cdcd5e73fdedb7b4897966afcb2ed28cc056d09
[profile] / dot / lisp-init.lisp
1 ;;; -*-lisp-*-
2
3 (cl:defpackage #:mdw-hacks
4 (:use #:cl))
5 (cl:defparameter mdw-hacks::*previous-package* cl:*package*)
6 (cl:in-package #:mdw-hacks)
7
8 ;; Shut up.
9 (setf *load-verbose* nil
10 *compile-verbose* nil)
11
12 #+cmu
13 (setf ext:*gc-verbose* nil
14 ext:*require-verbose* nil)
15
16 ;; Obtain ASDF from somewhere.
17 (require "asdf")
18
19 ;; Get CMU CL to quit on EOF.
20 #+cmu
21 (setf ext:*batch-mode* t)
22
23 ;; Tell SBCL where to find its source source.
24 #+sbcl
25 (sb-ext:set-sbcl-source-location #p"/usr/share/sbcl-source/")
26
27 ;; Tell some Lisps about my home directory.
28 #+(and unix (or sbcl clisp))
29 (let* ((homestring (or #+sbcl (sb-ext:posix-getenv "HOME")
30 #+clisp (ext:getenv "HOME")
31 #+cmu (unix:unix-getenv "HOME")
32 "/home/mdw"))
33 (home (pathname (concatenate 'string homestring "/"))))
34 (setf (logical-pathname-translations "HOME")
35 `(("HOME:**;*.*.*" ,(merge-pathnames "**/*.*" home nil)))
36 (logical-pathname-translations "CL")
37 '(("CL:SOURCE;**;*.*.*" #p"/usr/share/common-lisp/source/**/*.*")
38 ("CL:SYSTEMS;**;*.*.*" #p"/usr/share/common-lisp/systems/**/*.*"))))
39
40 ;; Various fixings.
41 #+clisp
42 (setf custom:*parse-namestring-ansi* t)
43
44 ;; Shebang.
45 (set-dispatch-macro-character
46 #\# #\!
47 (lambda (stream char arg)
48 (declare (ignore char arg))
49 (values (read-line stream))))
50
51 ;; Start up swank.
52 (export 'crank-swank)
53 (defun crank-swank (&rest args)
54 (let ((swank (find-package "SWANK")))
55 (unless swank
56 (load "/usr/share/common-lisp/source/slime/swank-loader.lisp")
57 (funcall (find-symbol "INIT" (find-package "SWANK-LOADER")))
58 (setf swank (find-package "SWANK")))
59 (set (find-symbol "*GLOBAL-DEBUGGER*" swank) nil)
60 (apply (find-symbol "CREATE-SERVER" swank) args)))
61
62 ;; Treat warnings as, err, warnings.
63 #+asdf
64 (setf asdf:*compile-file-failure-behaviour* :warn)
65
66 ;; Done.
67 (pushnew :mdw *features*)
68 ;;#+(and cmu mp) (mp::startup-idle-and-top-level-loops)
69 (setf *package* *previous-package*)