Created
September 17, 2008 21:14
-
-
Save ivey/11310 to your computer and use it in GitHub Desktop.
emacs lisp function to open a Terminal.app window in default-directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun tell-terminal (commands) | |
"Use osascript to tell Terminal.app to do stuff" | |
(interactive) | |
(shell-command | |
(concat | |
"osascript" | |
(mapconcat | |
'(lambda (command) (concat " -e 'tell application \"Terminal\" " | |
command "'")) | |
commands "")))) | |
(defun terminal-there (dir) | |
"Open Terminal.app and change working directory." | |
(interactive) | |
(tell-terminal (list | |
(concat "to do script \"cd " dir "\"") | |
"to activate"))) | |
(defun terminal-here () | |
"Open Terminal.app in `default-directory'." | |
(interactive) | |
(terminal-there default-directory)) | |
(global-set-key "\C-c\C-t" 'terminal-here) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment