[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: |
Hongyi Zhao |
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 23:31:06 +0800 |
On Thu, Jun 10, 2021 at 11:24 PM Óscar Fuentes <ofv@wanadoo.es> wrote:
>
> 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?
Yes.
>
> 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"))
I tried you above code, it still doesn't work with the following info:
file-name-as-directory: Wrong type argument: stringp, nil [2 times]
Mark set
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
- Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Hongyi Zhao, 2021/06/10
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Óscar Fuentes, 2021/06/10
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself.,
Hongyi Zhao <=
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Óscar Fuentes, 2021/06/10
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Hongyi Zhao, 2021/06/10
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Óscar Fuentes, 2021/06/10
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Hongyi Zhao, 2021/06/10
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Óscar Fuentes, 2021/06/11
- Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Hongyi Zhao, 2021/06/11
Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself., Eli Zaretskii, 2021/06/10