Skip to content

Instantly share code, notes, and snippets.

@gragusa
Forked from railwaycat/Emacs_starter.pl
Created January 11, 2016 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gragusa/c536f867cbe565078acb to your computer and use it in GitHub Desktop.
Save gragusa/c536f867cbe565078acb 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment