From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Emacs script that works on all platforms Date: Fri, 21 May 2010 15:24:51 +0200 Message-ID: <87aartjskc.fsf@thinkpad.tsdh.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1274448884 20927 80.91.229.12 (21 May 2010 13:34:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 21 May 2010 13:34:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 21 15:34:43 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 1OFSN8-0003gi-KF for geh-help-gnu-emacs@m.gmane.org; Fri, 21 May 2010 15:34:42 +0200 Original-Received: from localhost ([127.0.0.1]:37263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFSN5-0006xe-TD for geh-help-gnu-emacs@m.gmane.org; Fri, 21 May 2010 09:34:39 -0400 Original-Received: from [140.186.70.92] (port=49756 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFSLQ-0006fP-FV for help-gnu-emacs@gnu.org; Fri, 21 May 2010 09:32:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFSLJ-0006Fv-Gb for help-gnu-emacs@gnu.org; Fri, 21 May 2010 09:32:54 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:46124) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFSLI-0006Eq-ER for help-gnu-emacs@gnu.org; Fri, 21 May 2010 09:32:49 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OFSDj-0005sM-AH for help-gnu-emacs@gnu.org; Fri, 21 May 2010 15:24:59 +0200 Original-Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 May 2010 15:24:59 +0200 Original-Received: from tassilo by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 May 2010 15:24:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 47 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: tsdh.uni-koblenz.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:YYuoiqHU6H2SGUH2nD5dbCfQcXA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:73710 Archived-At: 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 > > 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. "env cmd" uses the cmd it finds first when checking the directories in your $PATH. For example I have: --8<---------------cut here---------------start------------->8--- % echo $PATH /home/horn/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.3:/usr/games/bin --8<---------------cut here---------------end--------------->8--- Now I make a symlink to `less' that I call `emacs' inside /home/horn/bin: --8<---------------cut here---------------start------------->8--- % cd ~/bin % ln -s /usr/bin/less emacs % zsh # start a new shell % emacs Missing filename ("less --help" for help) --8<---------------cut here---------------end--------------->8--- So as you can see, when calling `emacs' it finds the emacs-symlink to less first, cause that resides in a directory that comes before /usr/bin in PATH. HTH, Tassilo