EmacsからiTermに対してコマンドが送りたい時がある。例えば 現在Emacsで開いているファイルのディレクトリにiTermで移動したい 現在Emacsで編集中のテストをiTermで実行したい など。 そういう時には以下の様なユーティリティを定義しておくと便利。AppleScriptを利用して、iTermにコマンドを送る。 (defun execute-on-iterm (command) (interactive "MCommand: ") (do-applescript (format "tell application \"iTerm\" activate tell current session of current terminal write text \"%s\" end tell end tell" command))) これを利用して「現在Emacsで開いているファイ