Created
April 4, 2010 05:57
-
-
Save yaotti/355152 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;; open the current (file's) directory in Terminal.app | |
(defun mac-open-terminal () | |
(interactive) | |
(let ((dir "")) | |
(cond | |
((and (local-variable-p 'dired-directory) dired-directory) | |
(setq dir dired-directory)) | |
((stringp (buffer-file-name)) | |
(setq dir (file-name-directory (buffer-file-name)))) | |
) | |
(do-applescript | |
(format " | |
tell app \"Terminal\" | |
do script with command \"cd %s\" in window 1 | |
activate | |
end tell" dir)) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment