EmacsからiTermにコマンドを送る - $shibayu36->blog;のGuake Terminal
版です。
execute-on-guake
でコマンドを送り、toggle-guake
でGuake Terminal
の表示をトグルします。
(defun execute-on-guake (command)
"Execute `command' on Guake Terminal."
(interactive "MCommand: ")
(start-process-shell-command "guake" nil (format "guake -e '%s'" command)))
(defun toggle-guake ()
"Toggle visibility of Guake Terminal."
(interactive)
(start-process-shell-command "guake" nil "guake -t"))
Guake Terminal
が起動していないと一回のコマンドではうまく行かないので、Guake Terminal
をスタートアップ時に起動させておくといいと思います。
現在Emacs
で開いているファイルのディレクトリに移動するのは、cd-on-guake
でできます。
(defun cd-on-guake ()
"Move to current directory in Guake Terminal, then show Guake Terminal."
(interactive)
(execute-on-guake (format "cd %s" default-directory))
(toggle-guake))