From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johan Andersson Newsgroups: gmane.emacs.help Subject: Emacs script that works on all platforms Date: Thu, 20 May 2010 21:01:05 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001636b2bb877e903004870b332b X-Trace: dough.gmane.org 1274382933 7539 80.91.229.12 (20 May 2010 19:15:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 20 May 2010 19:15:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 20 21:15:31 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OFBDL-0007Dm-Ct for geh-help-gnu-emacs@m.gmane.org; Thu, 20 May 2010 21:15:27 +0200 Original-Received: from localhost ([127.0.0.1]:54398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFB0m-00061Z-M7 for geh-help-gnu-emacs@m.gmane.org; Thu, 20 May 2010 15:02:28 -0400 Original-Received: from [140.186.70.92] (port=52444 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFAzo-0005aI-Jb for help-gnu-emacs@gnu.org; Thu, 20 May 2010 15:01:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFAzn-0003Ja-82 for help-gnu-emacs@gnu.org; Thu, 20 May 2010 15:01:28 -0400 Original-Received: from mail-pz0-f176.google.com ([209.85.222.176]:48374) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFAzn-0003JO-2q for help-gnu-emacs@gnu.org; Thu, 20 May 2010 15:01:27 -0400 Original-Received: by pzk6 with SMTP id 6so70017pzk.1 for ; Thu, 20 May 2010 12:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=a+4LTQpnht2BarkkkRPd+F0+ppTSeFQZOt9sjU4lpuA=; b=AqdrA3cXYdIJzzjHHLAJE9jUBspnEC9lHr7I6cokP9s/nQsA2bhHr1YpDJq8uBD9H2 FNJFK61mo2dD2xdUHTPUAaiasJkKQSDtaMYI0yjHQye83/jC6jg3MDreaS4wzZyo/i/a IkGRFqU5Y3NspMmRfok0waqYHIhtEWk+OxDlo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=k8nCTtLGN7lfNjalhQqm1vw5Dl29W1d2UKWHCb38mzQOb0umIbX/VLdCB+wKYnL5lg I4hAg8tsQQgzlcWE3l3YjhkOLsE/OrvMRxBYL8zMAXzdFr7OU52jeRj6derVhonkjYw4 Sb7IhMpqV+5SobO7GIU+XB/WXFJ+qyl/Be1C0= Original-Received: by 10.142.55.18 with SMTP id d18mr318812wfa.170.1274382085164; Thu, 20 May 2010 12:01:25 -0700 (PDT) Original-Received: by 10.142.76.13 with HTTP; Thu, 20 May 2010 12:01:05 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73693 Archived-At: --001636b2bb877e903004870b332b Content-Type: text/plain; charset=ISO-8859-1 Hey, I have an Emacs script where the first line looks like this: #!/usr/bin/emacs --script However, on Mac OSX, Emacs is installed by default, but with an old version. I have also installed Emacs via Homebrew (compiled from source) and can run that with: /Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs So, to run the script with the Homebrew version, I could change the first line in my script to: #!/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --script That works, but I want this script to work on both GNU/Linux and Mac OSX (Both default and Homebrew version). I was thinking I could use env somehow, like this: #!/usr/bin/env emacs --script And then make emacs an alias or function that points to the correct binary depending on system. But it's still the default Emacs that is used. Any ideas how I could solve this? --001636b2bb877e903004870b332b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hey,


I have an Emacs script where the fir= st line looks like this:
#!/usr/bin/emacs --script

=
However, on Mac OSX, Emacs is installed by default, but with an = old version.

I have also installed Emacs via Homebrew (compiled from= source) and can run that with:
/Usr/local/Cellar/emacs/23.2/Emac= s.app/Contents/MacOS/Emacs

So, to run the script w= ith the Homebrew version, I could change the first line in my script to:
#!/Usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --script=

That works, but I want this script to work on bot= h GNU/Linux and Mac OSX (Both default and Homebrew version).

I was thinking I could use env somehow, like this:
#!/usr/bin/env emacs --script

And then make emacs= an alias or function that points to the correct binary depending on system= . But it's still the default Emacs that is used.


Any ideas how I could solve this?
--001636b2bb877e903004870b332b--