[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wed, 09 Mar 2022 20:22:33 +0100
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Andreas Röhler wrote:
>>> (if (file-readable-p "../test.el")
>>> (load "../test.el" nil t))
>> (defun load-if-exists (file)
>> (if (file-exists-p file)
>> (load-file file)
>> (message "The file %s does not exist." file) ))
> Didn't use load-file, as assumed designed for
> interactive use.
No, don't assume that ... on the contrary assume everything
works both ways, or at least the interactive -> Lisp way ...
Sometimes the docstring and/or byte compiler will tell you
otherwise, should be rare as that is a sign of whatever
badness so it needs to be stated, i.e. an explicit
exception to general fluidularity ...
> When looking into its definition, it's expand-file-name
> which does it:
> (load (expand-file-name "../test.el") nil t)
Indeed, gets the absolute path.
> Thanks all!
underground experts united