;;; myrurema.el --- myrurema for emacs ;; Copyright (C) 2010 Narihiro Nakamura ;; Author: Narihiro Nakamura ;; Version: 0.1 ;; Keywords: ruby ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; How use: ;; (1) myruremaをインストールしましょう。 ;; http://github.com/yhara/myrurema/blame/master/README.mkd ;; ;; (2) .emacs に以下を記述。 ;; ;; (require 'myrurema) ;; ;; (3) 以下のコマンドでruremaをemacsから引けます。 ;; M-x rurema ;; M-x rurema:at-point - カーソル位置の適当な文字列をもとにruremaを引く ;; ;; (4) 便利なkeyに割り当ててください。 ;; ;; (defun ruby-mode-hooks-myrurema () ;; (define-key ruby-mode-map (kbd "") 'rurema) ;; (define-key ruby-mode-map [f1] 'rurema:at-point) ;; ) ;; (add-hook 'ruby-mode-hook 'ruby-mode-hooks-myrurema) (defvar rurema:command "rurema" "rurema command" ) (defun rurema:at-point (&optional item) (interactive) (setq item (if item item (thing-at-point 'sexp))) (rurema:search item) ) (defun rurema (&optional item) (interactive) (setq item (read-string "Search symbol: " (if item item (thing-at-point 'sexp)))) (rurema:search item) ) (defun rurema:search (&optional item) (if item (let ((buf (buffer-name))) (unless (string= buf "*rurema*") (switch-to-buffer-other-window "*rurema*")) (setq buffer-read-only nil) (kill-region (point-min) (point-max)) (message (concat "Please wait...")) (call-process rurema:command nil "*rurema*" t item) (local-set-key [return] 'rurema:search-at-buffer) (ansi-color-apply-on-region (point-min) (point-max)) (setq buffer-read-only t) (goto-char (point-min))))) (defun rurema:search-at-buffer (&optional item) (interactive) (setq item (thing-at-point 'whitespace)) (rurema item) ) (provide 'myrurema)