[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Load file and return evaluation result (instead of t)?
From: |
Kevin Rodgers |
Subject: |
Re: Load file and return evaluation result (instead of t)? |
Date: |
Tue, 15 Oct 2013 07:51:06 -0600 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 |
On 10/9/13 1:25 PM, Thorsten Jolitz wrote:
Hi List,
the manual says
,----------------------------------------------
| 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'.
Something like
,------------------------------
| (eval-buffer (find-file ...))
`------------------------------
does not do the job either.
(eval (read (find-file-noselect "/my/file.el")))
Did I overlook the simple and canonical way to do this?
This is mainly to avoid that shell commands like
,-------------------------------------------------------------
| $ emacsclient -s my-server -e "( ... elisp expressions ...)"
`-------------------------------------------------------------
become too long, and thus replace them with something like:
,-------------------------------------------------------------
| $ emacsclient -s my-server -e "(load-file \"/my/file.el\")"
`-------------------------------------------------------------
where /my/file.el contains those elisp expressions.
Of course, (eval-buffer (find-file-noselect "/my/file.el")) works in this
context as well, because the result of the -e EXPRESSION is discarded anyway.
Which leads back to emacsclient -l "/my/file.el"
--
Kevin Rodgers
Denver, Colorado, USA