slynk-retro.lisp (1505B)
1 (defpackage :slynk-retro 2 (:use :cl :slynk :slynk-api)) 3 4 (in-package :slynk-retro) 5 6 (defun ensure-slynk-package-nicknames (&rest ignored) 7 "Nickname all SLYNK-* package to SWANK-*" 8 (declare (ignore ignored)) 9 (loop for package in (list-all-packages) 10 for package-name = (package-name package) 11 when (search "SLYNK" package-name :test #'char-equal) 12 do (rename-package package 13 package-name 14 (remove-duplicates 15 (cons 16 (format nil "SWANK~a" 17 (subseq package-name 5)) 18 (package-nicknames package)) 19 :test #'string-equal)))) 20 21 (defun load-swankrcs-maybe () 22 (find-if (lambda (homedir-file) 23 (load (merge-pathnames (user-homedir-pathname) 24 homedir-file) 25 :if-does-not-exist nil)) 26 (list (make-pathname :name ".swank" :type "lisp") 27 (make-pathname :name ".swankrc")))) 28 29 (setq slynk-rpc:*translating-swank-to-slynk* nil) 30 (push #'ensure-slynk-package-nicknames 31 slynk-api:*slynk-require-hook*) 32 33 (ensure-slynk-package-nicknames) 34 ;;; Take this chance to load ~/.swank.lisp and ~/.swankrc if no 35 ;;; ~/.slynk.lisp or ~/.slynkrc have already been loaded. 36 ;;; 37 (unless slynk-api:*loaded-user-init-file* 38 (setq slynk-api:*loaded-user-init-file* 39 (load-swankrcs-maybe))) 40 41 (provide :slynk/retro) 42 43