Skip to content

Instantly share code, notes, and snippets.

@ryseto
Last active December 11, 2015 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryseto/4589945 to your computer and use it in GitHub Desktop.
Save ryseto/4589945 to your computer and use it in GitHub Desktop.
Emacs で編集中のファイルが入っているフォルダ(ディレクトリ)を Finder/Terminal で開く。 ショートカットは ⌘-Shift-Option-F と ⌘-Shift-Option-T。
;;; Finder でフォルダを開く
;; ショートカット: ⌘-option-shift-F
;; (ショートカットは USキーボードで確認)
(define-key global-map [?\s-Ï] 'MyTool-open-folder-in-finder)
(defun MyTool-open-folder-in-finder ()
"open -a Finder.app CURRENT-DIRECTORY"
(interactive)
(process-query-on-exit-flag
(start-process-shell-command "open folder in Finder" nil "open .")))
;;; Terminal でフォルダを開く
;; ショートカット: ⌘-option-shift-T
;; (ショートカットは USキーボードで確認)
(define-key global-map [?\s-ˇ] 'MyTool-open-Terminal)
(defun MyTool-open-Terminal()
"open -a Terminal.app CURRENT-DIRECTORY"
(interactive)
(let* ((cmd "open -a Terminal.app"))
(process-kill-without-query
(start-process-shell-command
"Open directory" nil cmd default-directory))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment