[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: add-relative-load-path ? - scm_add_load_path too?
From: |
Ian Hulin |
Subject: |
Re: add-relative-load-path ? - scm_add_load_path too? |
Date: |
Mon, 30 Jan 2012 20:20:16 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111229 Thunderbird/9.0 |
Hi Andy, Ludo,
I've just seen the add-load-path scheme function in the new git
documentation.
Please, please, pretty please can we have a scm_add_load_path API
equivalent callable from C/C++? The LilyPond initialization code
currently does disgusting things like faking
(eval (set! %load-path cons ( <blah> %load-path ) ) )
a call such as
(scm_add_load_path (scm_from_locale_string ("<blah") );
would look far more civilized, and I'd be able to take out the
current hack, complete with the comments containing shudders of disgust.
Cheers,
Ian Hulin
On 08/01/12 15:14, Andy Wingo wrote:
> Hi all,
>
> In the following thread:
>
> http://thread.gmane.org/gmane.lisp.guile.user/8298/focus=8403
>
> there was a concern that it's difficult to set up the load path
> for simple one-off scripts.
>
> I had a proposal that we add something like this:
>
> (define-syntax add-relative-load-path (lambda (x) (syntax-case x
> () ((_ path) (string? (syntax->datum #'path)) (let* ((src
> (syntax-source #'x)) (current-file (or (and src (assq-ref src
> 'filename)) (error "Could not determine current file name")))
> (vicinity (dirname (canonicalize-path current-file))) (path-elt
> (in-vicinity vicinity (syntax->datum #'path)))) #`(eval-when
> (compile load eval) (set! %load-path (cons #,path-elt
> %load-path))))))))
>
> Then in your script you would (add-relative-load-path ".").
>
> Maybe we need an `add-to-load-path' form that handles the
> eval-when, actually, so it would be
>
> (add-to-load-path (dirname (current-source-filename)))
>
> or something like that. (We'd have to define
> current-source-filename as well, in terms of
> current-source-location.)
>
> What do folks think? Is it work it?
>
> Andy
- Re: add-relative-load-path ?, (continued)
- Re: add-relative-load-path ?, Neil Jerram, 2012/01/21
- Re: add-relative-load-path ?, Andy Wingo, 2012/01/23
- Re: add-relative-load-path ?, Ludovic Courtès, 2012/01/23
- Re: add-relative-load-path ?, Andy Wingo, 2012/01/23
- Re: add-relative-load-path ?, Neil Jerram, 2012/01/23
- Re: add-relative-load-path ?, Ludovic Courtès, 2012/01/25
- Re: add-relative-load-path ?, Andy Wingo, 2012/01/25
- Re: add-relative-load-path ?, Ludovic Courtès, 2012/01/25
- Re: add-relative-load-path ?, Andy Wingo, 2012/01/25
- Re: add-relative-load-path ?, Neil Jerram, 2012/01/23
Re: add-relative-load-path ? - scm_add_load_path too?,
Ian Hulin <=