RodrigoZepeda / d3lisp

A d3js interface for creating plots in LISP
https://rodrigozepeda.github.io/d3lisp/index.html
MIT License
3 stars 0 forks source link

Use default path other than *default-pathname-defaults* #12

Closed Symbolics closed 5 years ago

Symbolics commented 5 years ago

Use a default path of the form d3-default-pathname or, perhaps better, use logical pathnames setup in d3-init so that the same pathname will work across various machines and operating systems.

Symbolics commented 5 years ago

Here's an implementation to consider:

(defvar *d3-directory* "s:/src/d3/" "Base directory for D3.")
(defun d3-directory () "Return the base directory for D3." *d3-directory*)

(defun setup-d3-translations ()
  (setf (logical-pathname-translations "d3")
    `(("html;**;*.*.*" "d3:html;**;*.*")
      ("js;**;*.*.*" "d3:javascript;**;*.*")
      ("t;**;*.*.*" "d3:tutorials;**;*.*")
      ("data;*.*.*" ,(merge-pathnames "*.*" (user-homedir-pathname)))
      ("**;*.*.*" ,(merge-pathnames "**/*.*" (d3-directory))))))

Then you could, for example, refer to pathnames with #P"d3:js;my-javascript-file.js"

The code as above is pretty close. I'm happy to fix up, document and contribute once we get past the initial refactoring (i.e. #6, #7 and #9)