From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Emacs script that works on all platforms Date: Thu, 27 May 2010 16:12:58 +0200 Organization: Informatimago Message-ID: References: <87aartjskc.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291823392 32131 80.91.229.12 (8 Dec 2010 15:49:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 15:49:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 08 16:49:44 2010 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 1PQMH1-0007gC-NB for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 16:49:44 +0100 Original-Received: from localhost ([127.0.0.1]:48833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQMH1-0005bu-4v for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 10:49:43 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-X-Trace: individual.net e6uex9TCSfyW097fXWqW5AkPYsmGUBrKKdydGM0E3UKmvlp+Wr Cancel-Lock: sha1:NDBlNTdkMmM2NzAxZWEyNWVjZWJlNGMyYWM3NzY2N2FjYTU1OTZhYQ== sha1:p4haiyYn9bQmy4Z5sRgix9dkCJ8= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.1 (darwin) Original-Xref: usenet.stanford.edu gnu.emacs.help:178444 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:75561 Archived-At: Johan Andersson writes: > Hey, > > To bad you could not get away with an alias or function though... But it works, thanks for the tip! :) > > On Fri, May 21, 2010 at 3:24 PM, Tassilo Horn wrote: > > Johan Andersson writes: > > Hi Johan, > > > #!/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 > > > > [...] > > > > I was thinking I could use env somehow, like this: > > #!/usr/bin/env emacs --script Well, unfortunately, someimes, env is /bin/env sometimes it's in /usr/bin/env, so this doesn't really work either. (Of course, one of these system is broken, but that's the deal). So if you do a symlink to repair env, why not for emacs? > Now I make a symlink to `less' that I call `emacs' inside > /home/horn/bin: That's an acceptable solution for your own needs. I even do it "per project", installing project specific tool versions in a "opt" directory, and generating an env.sh shell commands file to set the PATH et al. for a specific project. When I switch from one project to another, I just have to source the env.sh from the opt directory of the new project, and I get all the tools and libraries in the versions needed by that project. But if you want to provide a script to other users on the same system or on another system, you need something else. Two options I find acceptable are either your script can work with various versions, or it should come with an "installation" procedure that will update the #! command. -- __Pascal Bourguignon__ http://www.informatimago.com