[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trouble using (current-filename)
From: |
Andy Wingo |
Subject: |
Re: Trouble using (current-filename) |
Date: |
Wed, 15 Feb 2012 23:23:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Hi Mark :)
On Tue 14 Feb 2012 19:57, Mark H Weaver <address@hidden> writes:
> scheme@(guile-user)> my-filename
> $1 = #f
I get this result regardless of whether or not the (identity 1 2 3) is
there, at least with master; but perhaps that is to be expected, given
what you say:
> The same thing happens if I remove that line, or if I try with
> stable-2.0.
>
> What am I doing wrong?
Nothing, of course :) But, when I annotate current-filename to be like
this:
(define-syntax current-filename
(lambda (x)
"A macro that expands to the current filename: the filename that
the (current-filename) form appears in. Expands to #f if this
information is unavailable."
(false-if-exception
(pk 'canonicalized (canonicalize-path (pk 'filename (assq-ref
(syntax-source x) 'filename)))))))
I see that:
scheme@(guile-user)> ,use (current-filename-fail)
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /tmp/current-filename-fail.scm
;;; (filename "current-filename-fail.scm")
;;; compiled
/home/wingo/src/guile-master/cache/guile/ccache/2.2-LE-8-3.0/tmp/current-filename-fail.scm.go
scheme@(guile-user)> my-filename
$1 = #f
So we see that the canonicalize-path call failed, as indeed it would.
Not sure what the right thing is here. It seems to depend on whether
the file is relative to the path or the current working directory. You
have any thoughts here?
Andy
--
http://wingolog.org/
- Trouble using (current-filename), Mark H Weaver, 2012/02/14
- Re: Trouble using (current-filename),
Andy Wingo <=
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/16
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/16
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/17
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/18
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/19
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/19
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/19
- Re: Trouble using (current-filename), Andy Wingo, 2012/02/19
- Re: Trouble using (current-filename), Noah Lavine, 2012/02/19
- Re: Trouble using (current-filename), Ludovic Courtès, 2012/02/20