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: Hongyi Zhao
Subject: Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself.
Date: Fri, 11 Jun 2021 07:55:08 +0800

On Thu, Jun 10, 2021 at 11:40 PM Óscar Fuentes <ofv@wanadoo.es> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> >> 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
>
> load-file-name is defined while the file is being loaded, after that it
> is nil. So if you tried with `C-x C-e' or some other interactive command
> it wont work.
>
> Once the code above is in the correct file, save it, start Emacs and
> report back what happens.

See my current usage on
<https://github.com/hongyi-zhao/screen2latex.el/blob/bd820184a29158c14de1afaf564f9e2898dd88ac/screen2latex.el#L45>
according to the instructions here.

After I start Emacs and tried with `M-x screenlatex RET', I will see
the following info in *Messages* buffer:

expand-file-name: Wrong type argument: stringp, nil

The expected behavior is that with the above command, the encrypted
token file, i.e., "auth.el.gpg" will be loaded and the decrypted text
will be inserted in the buffer. Finally, the screen capture action
will be triggered, as happens when I use the following absolute path
shown at 
<https://github.com/hongyi-zhao/screen2latex.el/blob/bd820184a29158c14de1afaf564f9e2898dd88ac/screen2latex.el#L43>:

(load-file (expand-file-name
"~/Public/repo/github.com/hongyi-zhao/screen2latex.el.git/auth.el.gpg"))

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



reply via email to

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