Hey,
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
>
>"env cmd" uses the cmd it finds first when checking the directories in
> 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.
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