Created
April 19, 2010 12:34
-
-
Save patrickdet/370992 to your computer and use it in GitHub Desktop.
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
41a42 | |
> ;;;###autoload | |
44a46,48 | |
> (defun string-join (separator strings) | |
> "Join all STRINGS using SEPARATOR." | |
> (mapconcat 'identity strings separator)) | |
55a60 | |
> ;;;###autoload | |
57,59c62,64 | |
< (if (boundp 'aquamacs-version) | |
< (peepopen-bind-aquamacs-keys) | |
< (peepopen-bind-carbon-keys))) | |
--- | |
> (cond ((featurep 'aquamacs) (peepopen-bind-aquamacs-keys)) | |
> ((featurep 'mac-carbon) (peepopen-bind-carbon-keys)) | |
> ((featurep 'ns) (peepopen-bind-ns-keys)))) | |
68,70c73,74 | |
< (defun string-join (separator strings) | |
< "Join all STRINGS using SEPARATOR." | |
< (mapconcat 'identity strings separator)) | |
--- | |
> (defun peepopen-bind-ns-keys () | |
> (define-key *textmate-mode-map* [(super t)] 'peepopen-goto-file-gui)) | |
72c76,77 | |
< (peepopen-bind-keys) | |
--- | |
> ;;;###autoload | |
> (add-hook 'textmate-mode-hook 'peepopen-bind-keys) |
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
;; peepopen.el --- Graphical file chooser for Emacs on Mac OS X. | |
;; Copyright (C) 2010 Topfunky Corporation <http://peepcode.com> | |
;; Licensed under the same terms as Emacs. | |
;; Version: 0.1.0 | |
;; Keywords: textmate osx mac | |
;; Created: 8 April 2010 | |
;; Author: Geoffrey Grosenbach <boss@topfunky.com> | |
;; This file is NOT part of GNU Emacs. | |
;; Licensed under the same terms as Emacs. | |
;;; Commentary: | |
;; A sensible fuzzy file chooser with a beautiful Mac OS X GUI. | |
;; | |
;; This minimal enhancement to textmate-mode calls the external | |
;; PeepOpen.app when you hit Command-T (or equivalent). | |
;; ⌘T - Go to File | |
;;; Installation: | |
;; This plugin assumes that you've already loaded Chris Wanstrath's | |
;; textmate.el in your emacs configuration. Load this file afterward. | |
;; | |
;; Copy this file to ~/.emacs.d/vendor/peepopen.el (or use the menu | |
;; item in the PeepOpen application). | |
;; $ cd ~/.emacs.d/vendor | |
;; $ git clone git://github.com/defunkt/textmate.el.git | |
;; (add-to-list 'load-path "~/.emacs.d/vendor/textmate.el") | |
;; (require 'textmate) | |
;; (textmate-mode) | |
;; (add-to-list 'load-path "~/.emacs.d/vendor/") | |
;; (require 'peepopen) | |
;;;###autoload | |
(defun peepopen-goto-file-gui () | |
"Uses external GUI app to quickly jump to a file in the project." | |
(interactive) | |
(defun string-join (separator strings) | |
"Join all STRINGS using SEPARATOR." | |
(mapconcat 'identity strings separator)) | |
(let ((root (textmate-project-root))) | |
(when (null root) | |
(error | |
(concat | |
"Can't find a suitable project root (" | |
(string-join " " *textmate-project-roots* ) | |
")"))) | |
(shell-command-to-string | |
(format "open -a PeepOpen '%s'" | |
(expand-file-name root))))) | |
;;;###autoload | |
(defun peepopen-bind-keys () | |
(cond ((featurep 'aquamacs) (peepopen-bind-aquamacs-keys)) | |
((featurep 'mac-carbon) (peepopen-bind-carbon-keys)) | |
((featurep 'ns) (peepopen-bind-ns-keys)))) | |
(defun peepopen-bind-aquamacs-keys () | |
;; Need `osx-key-mode-map' to override | |
(define-key osx-key-mode-map (kbd "A-t") 'peepopen-goto-file-gui)) | |
(defun peepopen-bind-carbon-keys () | |
(define-key *textmate-mode-map* [(meta t)] 'peepopen-goto-file-gui)) | |
(defun peepopen-bind-ns-keys () | |
(define-key *textmate-mode-map* [(super t)] 'peepopen-goto-file-gui)) | |
;;;###autoload | |
(add-hook 'textmate-mode-hook 'peepopen-bind-keys) | |
(provide 'peepopen) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment