Created
May 3, 2012 07:50
-
-
Save hadashiA/2584114 to your computer and use it in GitHub Desktop.
anythingから、ローカルにあるrubygemsのソースを開く ref: http://qiita.com/items/7a832e99d18cc8e507fd
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
(defvar anything-c-sources-local-gem-file | |
'((name . "gems (local)") | |
(candidates-in-buffer) | |
(init . (lambda () | |
(unless (anything-candidate-buffer) | |
(call-process-shell-command | |
"gem list" nil (anything-candidate-buffer 'global) | |
)))) | |
(action . (lambda (gem-name) | |
(setq gem-name (replace-regexp-in-string "\s+(.+)$" "" gem-name)) | |
(with-temp-buffer | |
(call-process "gem" nil t nil "which" gem-name) | |
(let ((path (buffer-substring-no-properties (point-min) | |
(- (point-max) 1)))) | |
(if (file-exists-p path) | |
(find-file path) | |
(message "no such file or directory:\"%s\"" path)))) | |
)))) | |
(defun anything-local-gems () | |
(interactive) | |
(anything-other-buffer | |
'(anything-c-sources-local-gem-file) | |
"*anything local gems*" | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment