On Wed, Nov 11, 2009 at 6:06 PM, Stefan Monnier
<address@hidden> wrote:
> Unfortunately this doesn't work either because load-file-name might
> sometimes be nil. For example
Of course in the case of M-C-x or eval-buffer, it will be nil.
If you care about that case, refine it to
(load (expand-file-name <foo> (if load-file-name
(file-name-directory load-file-name))))
I don't think this is quite right yet.
When load-file-name is nil, this uses the name of default directory of current buffer. But that's not the same as the directory of the file containing the load-relative function.
For example, I could have eval'd a buffer that did a load-relative of a file in a different directory. Even without this, I can change the default directory using the cd function. And changing the default directory never changes the file location of the file issuing load-relative.
Any other thoughts?
-- Stefan