(add-to-list 'load-path "/home/kidd/programmingStuff/slime/slime/")
(add-to-list 'load-path "/home/kidd/.emacs.d/")
(add-to-list 'load-path "/home/kidd/programmingStuff/slime/slime/contrib/")


(autoload 'paredit-mode "paredit"
  "Minor mode for pseudo-structurally editing Lisp code." t)
(add-hook 'emacs-lisp-mode-hook       (lambda () (paredit-mode +1)))
(add-hook 'lisp-mode-hook             (lambda () (paredit-mode +1)))
(add-hook 'lisp-interaction-mode-hook (lambda () (paredit-mode +1)))

;(load (expand-file-name "~/.quicklisp/slime-helper.el"))
(require 'slime)
(setq inferior-lisp-program "sbcl")
(slime-setup '(slime-fancy slime-asdf slime-banner))
(setq slime-net-coding-system 'utf-8-unix)
(setq slime-autodoc-use-multiline-p t)

(defun slime-repl-quickload ()
  (interactive)
  (let* ((completings
          (slime-repl-shortcut-eval
           `(cl:mapcar 'ql-dist:system-file-name (ql:system-list))))
         (system (completing-read "System: " completings)))
    (slime-repl-shortcut-eval-async
     `(cl:progn
       (ql:quickload ,system)
       (cl:format t "; System ~a loaded.~%" ,system)))))

(defslime-repl-shortcut slime-quickload ("quickload")
  (:handler 'slime-repl-quickload)
  (:one-liner "Quickload a Lisp system."))

;; Esto permite a SBCL cargar sus módulos contrib desde imágenes (cores)
;; extraoficiales.
;;(setenv "SBCL_HOME" "/usr/lib/sbcl/")

;; Loop indentation
(setq lisp-simple-loop-indentation 2
      lisp-loop-keyword-indentation 6
      lisp-loop-forms-indentation 9)

(defun run-clisp ()
  (interactive)
  (slime "clisp"))

(defun run-sbcl ()
  (interactive)
  (slime "sbcl"))

(defun run-sbcl-gtk ()
  (interactive)
  (let ((core (expand-file-name "~/.sbcl/core/sbcl+gtk.core")))
    (slime (concat "sbcl --core " core))))

;;;; Paredit
(require 'paredit)
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)
(add-hook 'scheme-mode-hook 'enable-paredit-mode)
(add-hook 'lisp-mode-hook 'enable-paredit-mode)