;;; -*- guile-scheme -*-
;;; guile init for unknown_lamer

;;; this file only assumes a few things:
;;; 1. The current unstable version of Guile is installed
;;; 2. My core libraries have been installed in your Guile site dir
;;; It contains some conditions if I want to use a non-core thing
;;; I still reccommend that you install everything from my Scheme
;;; page for full functionality.

;;; make guile use GNU readline for better interactive mode
(use-modules (ice-9 readline))
(activate-readline)

;;; my custom functions

;; returns my lib dir
;; takes 1 optional arg, file that will be appended to dir
;; dir includes the last slash
;; assumes $HOME is in the environment, which is always true
;; on POSIX systems
; (define cke-lib-dir 
;   (lambda arg
;     (let ((homedir (getenv "HOME")))
;     (define cke_lib_dir (string-append homedir "/.cke_guile"))
;     (if (not (null? arg)) 
; 	(string-append  cke_lib_dir "/" (car arg))
; 	cke_lib_dir
; 	)
;     )))

;;; my custom macros

;; report: to make Oleg's code work
(define-macro report: 
  (let ((temp (gensym))) 
    (lambda (temp) `(display ,temp))))

;; bye (its more fun than quit!)
(define-macro bye
  (lambda () `(quit)))

;;; modify Guile Configuration variables
; (append! %load-path `(,(cke-lib-dir)))

;;; set up a few variables
(define oleg ; oleg is true if oleg's lib is installed
  (if (catch #t
	(lambda () (opendir (string-append
			     (%package-data-dir)"/site/oleg")))
	(lambda args #f))
    #t
    #f))

;;; load libs I use often
(use-modules (defstruct))
(if oleg (use-modules (oleg myenv)))