-
-
Save caldwell/5026535 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
/Applications/Emacs.app/Contents/MacOS/Emacs "$@" |
So you're saying that
cd ~/developer/project
emacs relative/path
tries to open ~/relative/path
?
I just tried the same thing and it was working for me. I'm not sure what could causing that. Perhaps something in your .emacs
file? Try with emacs -q
and see if you get the same behavior.
I suggest using
#!/bin/sh
open -a Emacs "$@"
instead because it also works when Emacs is already open (the one above makes a second Emacs app show up in my Dock). It also seems to be better than
#!/bin/sh
which osascript > /dev/null 2>&1 && osascript -e 'tell application "Emacs" to activate'
emacsclient -c "$@"
or similar emacsclient
stuff because it also works when Emacs is not running. The last one only opens Emacs but does not open the file when Emacs is not running.
@caldwell , could you update the Tips And Tricks to also mention that the script should be executable chmod +x emacs
else it won't work.
For everyone else, I've gone a different route that mimics the way other apps create references in the path:
(make sure to use a user account that can become superuser/admin)
sudo ln -s /Applications/Emacs.app/Contents/MacOS/Emacs /usr/local/bin/emacs
This way you don't have to worry about cli args as the original executable will take care of it.
@naxels Yeah, that's probably much easier. I've changed it.
This doesn't work with relative paths for me, i.e. When I call it with a relative path from somewhere not in my home directory emacs opens a buffer at
~/relative/path
not at~/developer/project/relative/path
. Am I doing something wrong?