0

This way -- creating an executable script named ~/bin/emacs with the following contents -- is recommended on the Emacs Wiki:

#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

However, when running emacs ., Emacs did not start in the current directory.

How can this be done?

David J.
  • 31,569
  • 22
  • 122
  • 174
  • This is similar to http://stackoverflow.com/a/26565655/109618, but it adds a requirement that Emacs.app be started in the background. – David J. Oct 25 '14 at 18:20

1 Answers1

0

This works for me:

#!/bin/sh
$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@") &
David J.
  • 31,569
  • 22
  • 122
  • 174
  • `$(…)` means bash substitutes the output of the command inside the parentheses; in this case bash would try to execute that substitution, but since Emacs doesn't print anything, nothing gets executed. I'm not sure why this works as advertised, but it does. (The shebang line should perhaps specify `/bin/bash`, since the base Bourne shell doesn't support `$(…)`. – echristopherson Oct 25 '14 at 19:00
  • Any suggestions on how to figure out what might be happening with `&` that prevents the naive solution from working? – David J. Oct 25 '14 at 19:03