ambevar-dotfiles/.sbclrc

75 lines
3.0 KiB
Plaintext

;; -*- mode: common-lisp; -*-
;; WARNING: Changing the *print-case* may break some packages, e.g. Mito.
;; Also see https://www.cliki.net/Case%20sensitivity.
;; (setf *print-case* :downcase)
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames ".quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
;; Some OSes package Lisp compilers in a way that ASDF is not automatically loaded.
(require "asdf")
(when (ignore-errors (asdf:load-system "cffi"))
;; Warning: Trailing "/" matters!
(dolist (guix-profile
`(,(when (uiop:directory-exists-p "~/.guix-profile")
(format nil "~a/.guix-profile/lib/" (uiop:getenv "HOME")))
,@(mapcar (lambda (d)
(format nil "~a~a/lib/"
(namestring d)
(first (last (pathname-directory d)))))
(uiop:subdirectories "~/.guix-extra-profiles/"))))
(push guix-profile
(symbol-value (find-symbol (string '*foreign-library-directories*)
(find-package 'cffi))))))
;; Uncomment the following to increase the debug details.
;; It's often better to do this from the REPL.
;; (declaim (optimize (speed 0) (space 0) (debug 3)))
;; Uncomment to enable full type checks (should be the default).
;; (declaim (optimize (or (>= safety 2) (>= safety speed 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defpackage ambrevar
(:use :cl))
(in-package :ambrevar)
(export 'exported-symbols)
(declaim (ftype (function ((or symbol package))) exported-symbols))
(defun exported-symbols (package)
"List exported symbols of PACKAGE."
(let ((package (if (packagep package)
package
(find-package package)))
(symbols))
(do-external-symbols (s package symbols)
(when (eq (symbol-package s) package)
(push s symbols)))
symbols))
(export 'system-depends-on)
(declaim (ftype (function (string)) system-depends-on))
(defun system-depends-on (system)
"List SYSTEM dependencies, even if SYSTEM is an inferred system.
From: https://gitlab.common-lisp.net/asdf/asdf/issues/10#note_5018."
(let (depends)
(labels ((iter (openlist)
(if (null openlist) depends
;; Is this a subsystem of SYSTEM?
(let ((find (search system (first openlist))))
(if (and find (zerop find))
(iter (append (asdf:system-depends-on (asdf:find-system (first openlist))) (rest openlist)))
;; If not, it's a direct dependency: collect it.
(progn
(pushnew (first openlist) depends :test 'equalp)
(iter (rest openlist))))))))
(iter (list system)))))
(in-package :cl-user)