Skip to content

Instantly share code, notes, and snippets.

@tctony
Created February 24, 2018 09:15
Show Gist options
  • Select an option

  • Save tctony/5c2aebdd92d95fe5523a75ff95931175 to your computer and use it in GitHub Desktop.

Select an option

Save tctony/5c2aebdd92d95fe5523a75ff95931175 to your computer and use it in GitHub Desktop.
xcode_open_file_in_emacs
tell application "Xcode"
set last_word_in_main_window to (word -1 of (get name of window 1))
if (last_word_in_main_window is "Edited") then
display dialog "Please save the current document and try again"
-- eventually we could automatically save the document when this becomes annoying
else
set current_document to document 1 whose name ends with last_word_in_main_window
set current_document_path to path of current_document
-- display dialog current_document_path
do shell script "/usr/local/bin/emacsclient -c " & quoted form of the POSIX path of the current_document_path
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment