From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs script that works on all platforms
Date: Fri, 21 May 2010 15:24:51 +0200 [thread overview]
Message-ID: <87aartjskc.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: AANLkTiltJUeJWZNyRQlzrcbPLLLFZDfRUu4Vbbz2ercr@mail.gmail.com
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 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
next prev parent reply other threads:[~2010-05-21 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-20 19:01 Emacs script that works on all platforms Johan Andersson
2010-05-21 13:24 ` Tassilo Horn [this message]
2010-05-27 12:51 ` Johan Andersson
[not found] ` <mailman.0.1274964713.14889.help-gnu-emacs@gnu.org>
2010-05-27 14:12 ` Pascal J. Bourguignon
[not found] <mailman.15.1274382091.29716.help-gnu-emacs@gnu.org>
2010-05-20 20:40 ` Frédéric Perrin
[not found] ` <3c0b258e-32ae-4ab8-b936-3d304f3e4771@34g2000prs.googlegroups.com>
2010-05-22 12:31 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87aartjskc.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).