Automator -> AppleScript -> iTerm -> emacs

Update 2017-02-10: forget all that nonsense. I have seen the light. With proper configuration, the GUI version of emacs is quite satisfactory, and it offers some advantages that cannot be had when running it in a shell.

brew cask install emacs-mac

Do it, you know you want to.


Hi there. You are tech person. You love Mac. Mac can be customized. You love text. Everything is text. Emacs is text editor. Emacs is text. Everything is text. Emacs is terminal application! Your Mac has terminal emulator called Terminal. Other terminal emulators are available. iTerm2 is terminal emulator that is nice. You use iTerm2. You use Emacs. You don’t use Vim. You don’t use Emacs with GUI. GUI is not text. Everything is text except GUI. iTerm2 can be customized. OK, GUI can be customized, but GUI is not text. All text must be edited in Emacs in iTerm2 on Mac!

OK, yes. Double-click file in Finder to open in Emacs. No! No GUI! Problem. Solution? AppleScript. Automator. A-like this:

on run {input, parameters}
if input is not {} then
set the_path to POSIX path of input
tell application "iTerm"
activate
create window with default profile
end tell
tell application "System Events"
keystroke "emacs " & the_path & "; exit"
key code 36
end tell
else
tell application "iTerm"
activate
create window with default profile
tell application "System Events"
keystroke "emacs"
key code 36
end tell
end tell
end if
return input
end run

Great! Save as application! Call it “Emacs in iTerm” or something else fancy! Apply fancy icon! Put it in Applications folder! Find file; Cmd-I; open with; change all!

Double-click file in Finder to open file in Emacs in iTerm2. Double-click fancy application to open Emacs in iTerm. Magic. Hooray!