[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Load file and return evaluation result (instead of t)?
From: |
Michael Heerdegen |
Subject: |
Re: Load file and return evaluation result (instead of t)? |
Date: |
Fri, 11 Oct 2013 00:30:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Thorsten Jolitz <tjolitz@gmail.com> writes:
> ,----------------------------------------------
> | load returns t if the file loads successfully
> `----------------------------------------------
>
> but I would rather like to write a (big) Elisp expression into a file,
> load the file, and get the expression's return value instead of just
> 't'.
You could find the file, use `read' to get the expression, and `eval'
it. That's probably the canonical way.
Or you could, instead of just saving an expression to a file, save a
sexp that evals the expression and stores it to a global variable. Then
after loading the file, this variable is bound to the result of the
evaluated expression.
Regards,
Michael.