Guest User

Untitled

a guest
Feb 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. (defun tell-terminal (commands)
  2. "Use osascript to tell Terminal.app to do stuff"
  3. (interactive)
  4. (shell-command
  5. (concat
  6. "osascript"
  7. (mapconcat
  8. '(lambda (command) (concat " -e 'tell application \"Terminal\" "
  9. command "'"))
  10. commands ""))))
  11.  
  12. (defun terminal-there (dir)
  13. "Open Terminal.app and change working directory."
  14. (interactive)
  15. (tell-terminal (list
  16. (concat "to do script \"cd " dir "\"")
  17. "to activate")))
  18.  
  19. (defun terminal-here ()
  20. "Open Terminal.app in `default-directory'."
  21. (interactive)
  22. (terminal-there default-directory))
  23.  
  24. (global-set-key "\C-c\C-t" 'terminal-here)
Add Comment
Please, Sign In to add comment