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