help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refer to the directory of the currently being loaded elisp script fr


From: Óscar Fuentes
Subject: Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself.
Date: Thu, 10 Jun 2021 17:24:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> I'm writing an elisp script which will load another file in the same
> directory as this elisp script itself. The currently used command is
> as follows:
>
> (load-file (expand-file-name
> "~/Public/repo/github.com/DvdMgr/screen2latex.el.git/auth.el.gpg"))
>
> I want to construct the loaded file's path with the directory of the
> elisp script itself, and I tried with the following but failed to do
> the trick:
>
> (load-file (concat (file-name-directory load-file-name) "/auth.el.gpg"))
>
> Any hints/comments/suggestions for this problem?

How do you know that it failed? Do you know for sure that the problem is
related to the line of code shown above? Is auth.el.gpg a valid Elisp
file?

BTW, the correct method for concatenating a directory and a file name is

(load-file
  (concat
    (file-name-as-directory (file-name-directory load-file-name))
    "auth.el.gpg"))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]