LoginSignup
1
1

More than 5 years have passed since last update.

anythingから、ローカルにあるrubygemsのソースを開く

Last updated at Posted at 2012-05-04

すでに誰か作ってるかもしれんけど、

(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*"
  ))

M-x anything-local-gems で、インストールされているgemの一覧が出るので、選ぶと、それのソース開きます。

ffap + devel-whichあればそんなに必要ないか…

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1