[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: relative load-file
From: |
Stefan Monnier |
Subject: |
Re: relative load-file |
Date: |
Wed, 11 Nov 2009 23:22:06 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
> Huh? If I knew a good solution to this short of changing the source code, I
> *wouldn't* be asking.
Here it is then:
(load (expand-file-name <foo> (file-name-directory
(or load-file-name buffer-file-name))))
> What strikes me wrong about going in the direction of using
> buffer-file-name or using buffers is that that we are introspecting
> about is the running code.
You can't make it work in all cases. It's simply not possible because
code exists outside of any notion of file, so "relative file name"
cannot always make sense.
So what strikes you as wrong is really a fundamental problem in what
you're requesting, rather than a problem in the solutions I proposed.
It's similar in a sense to the issue of a binary executable trying to
find associated files relative to its own location: in general the
executable cannot know its own location, so the best you can do is use
heuristics like look at $0 and search it in $PATH.
> First, none of the examples I have given do I find really corner case.
They work fine with the above code.
> These and many more have come up. (Recall that I have been using this mode
> of working, and I gather from prior remarks you haven't.)
This mode of working is not encouraged in Emacs. The main reason is
probably just historical accident, but the fact that it can't work
reliably in all cases would be a good reason to retroactively justify
that choice.
> Second, a reason one might try to encapsulate this in a library is to be
> able to handle as many of the corner cases as possible so run-of-the-mill
> users need not have to be concerned - they can use the feature and have
> confidence that it does the right thing.
That would make sense if the functionality was important, but I haven't
seen evidence that it is.
Stefan
- relative load-file, Rocky Bernstein, 2009/11/11
- Re: relative load-file, Tassilo Horn, 2009/11/11
- Re: relative load-file, Rocky Bernstein, 2009/11/11
- Re: relative load-file, Tassilo Horn, 2009/11/11
- Re: relative load-file, Stefan Monnier, 2009/11/11
- Re: relative load-file, Rocky Bernstein, 2009/11/11
- Re: relative load-file, Stefan Monnier, 2009/11/11
- Re: relative load-file, Rocky Bernstein, 2009/11/11
- Re: relative load-file, Stefan Monnier, 2009/11/11
- Re: relative load-file, Rocky Bernstein, 2009/11/11
- Re: relative load-file,
Stefan Monnier <=
- Re: relative load-file, Rocky Bernstein, 2009/11/12
- Re: relative load-file, address@hidden, 2009/11/12
- Re: relative load-file, Andreas Schwab, 2009/11/12
- Re: relative load-file, Stefan Monnier, 2009/11/12
- Re: relative load-file, Rocky Bernstein, 2009/11/12
- Re: relative load-file, Stefan Monnier, 2009/11/13
- Re: relative load-file, Rocky Bernstein, 2009/11/13
- Re: relative load-file, Stefan Monnier, 2009/11/13
- Re: relative load-file, Rocky Bernstein, 2009/11/13
Re: relative load-file, Richard Stallman, 2009/11/14