From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Load file and return evaluation result (instead of t)? Date: Tue, 15 Oct 2013 07:51:06 -0600 Message-ID: References: <87a9iimeky.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1381845085 4840 80.91.229.3 (15 Oct 2013 13:51:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Oct 2013 13:51:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 15 15:51:29 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VW51z-0003wb-S9 for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Oct 2013 15:51:27 +0200 Original-Received: from localhost ([::1]:41935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW51z-0008Tj-Hy for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Oct 2013 09:51:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW51d-0008H0-5r for help-gnu-emacs@gnu.org; Tue, 15 Oct 2013 09:51:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VW51V-0003pG-RU for help-gnu-emacs@gnu.org; Tue, 15 Oct 2013 09:51:05 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VW51V-0003p6-Km for help-gnu-emacs@gnu.org; Tue, 15 Oct 2013 09:50:57 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VW51T-0003ce-JO for help-gnu-emacs@gnu.org; Tue, 15 Oct 2013 15:50:55 +0200 Original-Received: from 97-122-176-111.hlrn.qwest.net ([97.122.176.111]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Oct 2013 15:50:55 +0200 Original-Received: from kevin.d.rodgers by 97-122-176-111.hlrn.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Oct 2013 15:50:55 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 47 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 97-122-176-111.hlrn.qwest.net 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 In-Reply-To: <87a9iimeky.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94023 Archived-At: 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