[email protected] writes:
> On 2026-03-10, at 10:24, [email protected] wrote:
>
>> [email protected] writes:
>>
>>>
>>> I need to execute Elisp from some file with `emacsclient --eval'.
>>> Should I say `emacsclient --eval "(load-file ...)"', `emacsclient
>>> --eval "(load ...)"' or something else?
>>>
>>
>> (info "(elisp) How Programs Do Loading")
>>
>> -- Command: load-file filename
>> This command loads the file FILENAME. If FILENAME is a relative
>> file name, then the current default directory is assumed. This
>> command does not use ‘load-path’, and does not append suffixes.
>> However, it does look for compressed versions (if Auto Compression
>> Mode is enabled). Use this command if you wish to specify
>> precisely the file name to load.
>>
>> So, you will decide whether to use ‘load’ versus ‘load-file’
>> depending on how well you know the file’s name and where it
>> is located. (‘load’ also provides additional parameters for
>> other conditions.)
>>
>> Roughly:
>> load-file -> load this specific file in this location
>> load -> load a file after finding where it is and which
>> form is available
>
> Thanks. I've seen this part of the manual (obviously), but it left me
> unsure about which one should I use, or whether there is a third one,
> a lower-level function used by both of these.
>
> Thanks anyway,
Using it with emacsclient, you probably want to use
‘load-file’, for example
emacsclient -e '(load-file "./my-elisp.el")'
You can issue that command from any directory regardless of
the setting of ‘load-path’.
On the other hand, if you have a library/package that you
want to load into a running Emacs, that package would be in
a directory that is listed in ‘load-path’, and so Emacs will
find it and add the "best" filename extension:
emacsclient -e '(load "my-elisp-pkg")'
--
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.