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: Re: Emacs script that works on all platforms Date: Thu, 27 May 2010 14:51:27 +0200 Message-ID: References: <87aartjskc.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0050450296257767a9048792dac9 X-Trace: dough.gmane.org 1274964873 18571 80.91.229.12 (27 May 2010 12:54:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 27 May 2010 12:54:33 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 27 14:54:29 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 1OHcbU-00042J-4d for geh-help-gnu-emacs@m.gmane.org; Thu, 27 May 2010 14:54:28 +0200 Original-Received: from localhost ([127.0.0.1]:41234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHcbT-0001V4-Om for geh-help-gnu-emacs@m.gmane.org; Thu, 27 May 2010 08:54:27 -0400 Original-Received: from [140.186.70.92] (port=43541 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHcYw-0007Rw-Dq for help-gnu-emacs@gnu.org; Thu, 27 May 2010 08:51:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHcYv-0000DH-2g for help-gnu-emacs@gnu.org; Thu, 27 May 2010 08:51:50 -0400 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:58069) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHcYu-0000D5-QM for help-gnu-emacs@gnu.org; Thu, 27 May 2010 08:51:49 -0400 Original-Received: by pwi6 with SMTP id 6so739685pwi.0 for ; Thu, 27 May 2010 05:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=BOUjGJ61pCdJf69gqETXaOnL1s1h/Uv4z5uTv4mKYwo=; b=D79KG1SeBxW+rko2eo6G9c8s36OxHR3lJc340muaILB0YkkNinYWWauUqgUdQVYCYx HfC0qVGe5gW3T/1LGWamHP5aKmUbJC16YQ4LMfZbkYonzez/0g5PssNCN5XAUHdRDWMH P+WSqShqVD2AahFeQyzHhjMao/7u46CafavYM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=uJPPBFIeY64iJd77fjKUSY74FV//GPv/PfbhQ+CJ97/zPkBDiikkKGdW29vIg98UBT /JeCfzwdLIjK7Xy9lp2z5yZ+5Lhx/wcHu6VeMgyruS0LS24Phh3sI1nbaxOTKPAnEFOw wKZzPc0DBjP/53PjlohFd4jc0h3Ubjpw8sM+A= Original-Received: by 10.142.55.20 with SMTP id d20mr7352906wfa.331.1274964707075; Thu, 27 May 2010 05:51:47 -0700 (PDT) Original-Received: by 10.142.76.13 with HTTP; Thu, 27 May 2010 05:51:27 -0700 (PDT) In-Reply-To: <87aartjskc.fsf@thinkpad.tsdh.de> 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:73774 Archived-At: --0050450296257767a9048792dac9 Content-Type: text/plain; charset=ISO-8859-1 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 > > > > 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 > > > --0050450296257767a9048792dac9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hey,

To bad you could not get aw= ay with an alias or function though... But it works, thanks for the tip! :)=

On Fri, May 21, 2010 at 3:24 PM, Tassi= lo Horn <tas= silo@member.fsf.org> wrote:
Johan Andersson <johan.rejeep@gmail.com> 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 ca= n 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 dir= ectories in
your $PATH. =A0For 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-g= nu/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 =A0 # 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



--0050450296257767a9048792dac9--