Skip to content

Instantly share code, notes, and snippets.

@railwaycat
Last active March 12, 2023 01:26
Show Gist options
  • Star 93 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save railwaycat/4043945 to your computer and use it in GitHub Desktop.
Save railwaycat/4043945 to your computer and use it in GitHub Desktop.
Start Emacs.app from CLI
#!/usr/bin/perl
# Emacs starter for Emacs mac port
# Thanks to Aquamacs Project and David Reitter
my $args = "";
my $tmpfiles = "";
for my $f (@ARGV) {
$args .= '"'.$f.'" ';
$tmpfiles .= '"'.$f.'" ' if (! -e $f);
}
system("touch $args") if ($tmpfiles);
system("open -a /Applications/Emacs.app $args");
# delay deletion because AE drag&drop doesn't work with non-existing documents
system("(sleep 3; rm $tmpfiles) &") if ($tmpfiles);
exit;
@duhd1993
Copy link

duhd1993 commented Dec 10, 2020

Hi @mwolson, thanks for the update. I believe your starter script works for Nextstep port (although I haven't verify that by myself), but it not works for Mac port. Because Emacs Mac port lacks multi-tty support, which means, emacsclient from mac port can only able to create tty frames but not GUI frames.

@railwaycat This seems outdated. I'm able to open GUI emacs from emacsclient now. Could you update instructions for this? However, the Emacs server in GUI app won't run in the background. C-x C-x the last window closes the app and also the server. This behavior is different from the official Emacs build. Their Emacs.app can run without any window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment