all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rocky Bernstein <rocky@gnu.org>
To: grischka <grishka@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: relative load-file
Date: Fri, 13 Nov 2009 00:59:37 -0500	[thread overview]
Message-ID: <6cd6de210911122159k7a0254dcgf74837e08f863db5@mail.gmail.com> (raw)
In-Reply-To: <4AFCED98.1080209@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]

On Fri, Nov 13, 2009 at 12:24 AM, grischka <grishka@gmx.de> wrote:

> > [...]
> > That is, one wants to load an Emacs Lisp file relative the file
>
> > that issues the load which is often in the same directory or a
> > nearby directory.
> >
> > This would be easy if there were a variable like __FILE__ that Ruby
> > provides.
>
> Why would you need __FILE__ if in emacs you can type much more easily
>   #$
> As in
>   (load (concat (file-name-directory #$) "extra-stuff"))
>

Never ascribe to willful intent that which can be easily explained by
ignorance :-)

I've just read up on this, and although it is appealing and another
heuristic that can be tried, it looks as though it too is sometimes gives
nil in cases where say (*car current-load-list)* works, just like *
load-file-name*. In fact I'd be curious to learn the differences between it
and *load-file-name.* Off hand, I'd guess that #$ persists after loading --
when it is set -- whereas *load-file-name* and the *car* don't, but
otherwise they are the same. Anyone know or care to comment?

Here is the test I tried. I put this in a file */tmp/foo.el:

*(message "++1 %s" #$)
(message "++2 %s" (car current-load-list))

When I eval-buffer I get:

++1 nil
++2 /tmp/foo.el

Of course if I* load-file* it, they both come out with the same file names.

Thanks for the idea and info!



> --- grischka
>
>

[-- Attachment #2: Type: text/html, Size: 2423 bytes --]

  reply	other threads:[~2009-11-13  5:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13  5:24 relative load-file grischka
2009-11-13  5:59 ` Rocky Bernstein [this message]
2009-11-13 14:26   ` Stefan Monnier
2009-11-13 15:06     ` Rocky Bernstein
  -- strict thread matches above, loose matches on Subject: below --
2009-11-11 17:01 Rocky Bernstein
2009-11-11 18:35 ` Tassilo Horn
2009-11-11 19:26   ` Rocky Bernstein
2009-11-11 19:54     ` Tassilo Horn
2009-11-11 20:17     ` Stefan Monnier
2009-11-11 21:21       ` Rocky Bernstein
2009-11-11 23:06         ` Stefan Monnier
2009-11-12  1:01           ` Rocky Bernstein
2009-11-12  1:20             ` Stefan Monnier
2009-11-12  2:09               ` Rocky Bernstein
2009-11-12  4:22                 ` Stefan Monnier
2009-11-12 13:01                   ` Rocky Bernstein
2009-11-12 13:52                     ` spedrosa
2009-11-12 14:11                       ` Andreas Schwab
2009-11-12 15:34                     ` Stefan Monnier
2009-11-13  4:34                       ` Rocky Bernstein
2009-11-13 14:22                         ` Stefan Monnier
2009-11-13 15:03                           ` Rocky Bernstein
2009-11-13 16:17                             ` Stefan Monnier
2009-11-13 16:39                               ` Rocky Bernstein
2009-11-14 11:24 ` Richard Stallman
2009-11-14 15:44   ` Rocky Bernstein
2009-11-15 21:59     ` M Jared Finder
2009-11-18  3:20       ` Stefan Monnier
2009-11-15 22:38     ` Richard Stallman
2009-11-15 23:50       ` Rocky Bernstein
2009-11-18 12:10         ` Richard Stallman
2009-11-18 13:39           ` Rocky Bernstein
2009-11-21 22:52             ` Richard Stallman
2009-11-22  4:45               ` Rocky Bernstein
2009-11-23  2:29                 ` Richard Stallman
2009-11-23 15:04                   ` Rocky Bernstein
2009-11-24 14:11                     ` Richard Stallman
2009-11-09 14:54 rocky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cd6de210911122159k7a0254dcgf74837e08f863db5@mail.gmail.com \
    --to=rocky@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=grishka@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.