On Wed, Nov 11, 2009 at 3:17 PM, Stefan Monnier
<address@hidden> wrote:
> This is loading relative to the directory I started at, /tmp/proj/subdir,
> not relative to the directory that of the file that issued the load,
> /tmp/proj/test1.el.
You can do
(load (expand-file-name <relativename> (file-name-directory load-file-name)))
Unfortunately this doesn't work either because load-file-name might sometimes be nil. For example
where in test1.el I had:
(load-file "test3.el")
Using the above suggestion, if you change that to
(load (expand-file-name "test3.el" (file-name-directory load-file-name)))
And then M-x eval-current buffer inside "test1.el", you'll get an error in (file-name-directory load-file-name) because load-file-name is nil. That's why in some cases I needed to use symbol-file of a defined symbol and even failing that "./".
But until now we haven't needed to use such a scheme.
A long time ago I asked why none of the POSIX shells had a debugger. Invariably someone gave an answer that shells are so simple, and an interactive shell is so cool, and "set -x" tracing so awesome that you don't need a debugger. A long time ago I asked why all the media players like xine, mplayer, and vlc rolled their own code with respect to CD handling rather than use a common library; invariably the response I got was that things were better that way. And I seem to recall a lot of consternation over the issue of whether distributed emacs lisp code could span more than one directory.
I don't want to get into get into a discussion of how one writes and organizes code, or does program development. The Emacs community is content and I am an outsider here. Please carry on with the great work you have been doing.
For my own personal reasons I'd like to understand how close I can get to having something analogous to __FILE__ and require_relative that Ruby has. Thank you for your helping me figure this out and your tolerance of my peculiar style of program development.
Stefan