Recently Written · git

coleslaw

Emacs mode for the "Coleslaw" site generator written in Common Lisp.

git clone https://github.com/equwal/coleslaw

Log | Files | Refs


commit 35c09f45bd0734fcc8350fa2afcb5340a33c4d5d
Javier Olaechea <pirata@gmail.com>
2016-09-23 23:50:32 -0500

Simplify the setting of COLESLAW-CONF:*BASEDIR*

No need to use a before method specializing in the LOAD-OP. Use uiop's
pathname-parent-directory-pathname instead

 coleslaw-conf.asd      | 12 ------------
 coleslaw.asd           | 13 +++++--------
 src/coleslaw-conf.lisp | 12 +++++-------
 3 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/coleslaw-conf.asd b/coleslaw-conf.asd
deleted file mode 100644
index c294d66..0000000
--- a/coleslaw-conf.asd
+++ /dev/null
@@ -1,12 +0,0 @@
-(in-package #:asdf-user)
-
-(defsystem #:coleslaw-conf
-  :name "coleslaw-conf"
-  :description "Configuration variable for Coleslaw, Flexible Lisp Blogware"
-  :version "0.9.7"
-  :license "BSD"
-  :author "Brit Butler <redline6561@gmail.com>"
-  :pathname "src/"
-  :depends-on ()
-  :serial t
-  :components ((:file "coleslaw-conf")))
diff --git a/coleslaw.asd b/coleslaw.asd
index 4dc4579..037c6ba 100644
--- a/coleslaw.asd
+++ b/coleslaw.asd
@@ -7,8 +7,7 @@
   :license "BSD"
   :author "Brit Butler <redline6561@gmail.com>"
   :pathname "src/"
-  :depends-on (:coleslaw-conf
-               :closure-template
+  :depends-on (:closure-template
                :3bmd
                :3bmd-ext-code-blocks
                :alexandria
@@ -17,9 +16,11 @@
                :cl-fad
                :cl-ppcre
                :closer-mop
-               :cl-unicode)
+               :cl-unicode
+               :uiop)
   :serial t
-  :components ((:file "packages")
+  :components ((:file "coleslaw-conf")
+               (:file "packages")
                (:file "util")
                (:file "config")
                (:file "themes")
@@ -30,7 +31,3 @@
                (:file "feeds")
                (:file "coleslaw"))
   :in-order-to ((test-op (test-op coleslaw-test))))
-
-(defmethod perform :before ((op load-op)
-                            (system (eql (find-system :coleslaw))))
-  (uiop:symbol-call "COLESLAW-CONF" 'set-basedir #.*load-truename*))
diff --git a/src/coleslaw-conf.lisp b/src/coleslaw-conf.lisp
index 6d363a9..b1436da 100644
--- a/src/coleslaw-conf.lisp
+++ b/src/coleslaw-conf.lisp
@@ -1,12 +1,10 @@
 (defpackage #:coleslaw-conf
   (:use #:cl)
-  (:export #:*basedir*
-           #:set-basedir))
+  (:import-from #:uiop/pathname
+                #:pathname-parent-directory-pathname)
+  (:export #:*basedir*))
 
 (in-package #:coleslaw-conf)
 
-(defvar *basedir*)
-
-(defun set-basedir (pathname)
-  (setf coleslaw-conf:*basedir*
-    (make-pathname :name nil :type nil :defaults pathname)))
+(defparameter *basedir* (pathname-parent-directory-pathname (make-pathname :name nil :type nil :defaults *load-truename*))
+  "A pathname pointing to Coleslaw's top level directory.")