├── README.md └── company-inf-ruby.el /README.md: -------------------------------------------------------------------------------- 1 | [company-mode](http://company-mode.github.io/) completion back-end for `inf-ruby` buffers. 2 | 3 | NOTE: Now that `inf-ruby` 2.4.0 supports `completion-at-point`, this backend is deprecated. 4 | 5 | You don't need to install anything extra, `company-capf` will work with `inf-ruby`. 6 | 7 | Installation 8 | === 9 | 10 | Install this from [Marmalade](http://marmalade-repo.org/). 11 | 12 | Then, in addition to the usual `company-mode` setup, add this to your init file: 13 | 14 | ``` 15 | (eval-after-load 'company 16 | '(add-to-list 'company-backends 'company-inf-ruby)) 17 | ``` 18 | -------------------------------------------------------------------------------- /company-inf-ruby.el: -------------------------------------------------------------------------------- 1 | ;;; company-inf-ruby.el --- company-mode completion back-end for inf-ruby 2 | 3 | ;; Copyright (C) 2013-2014 Dmitry Gutov 4 | 5 | ;; Author: Dmitry Gutov 6 | ;; Version: 0.3 7 | ;; URL: https://github.com/company-mode/company-inf-ruby 8 | ;; Package-Requires: ((company "0.6.10") (inf-ruby "2.2.7") (emacs "24.1")) 9 | 10 | ;; This file is NOT part of GNU Emacs. 11 | 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify 13 | ;; it under the terms of the GNU General Public License as published by 14 | ;; the Free Software Foundation, either version 3 of the License, or 15 | ;; (at your option) any later version. 16 | 17 | ;; GNU Emacs is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | ;; GNU General Public License for more details. 21 | 22 | ;; You should have received a copy of the GNU General Public License 23 | ;; along with GNU Emacs. If not, see . 24 | 25 | ;;; Commentary: 26 | ;; 27 | ;; Uses inf-ruby's built-in completion mechanism. 28 | ;; 29 | 30 | ;;; Code: 31 | (require 'company) 32 | (eval-when-compile (require 'inf-ruby)) 33 | 34 | (defun company-inf-ruby (command &optional arg &rest ignored) 35 | "`company-mode' completion back-end for `inf-ruby-mode'." 36 | (interactive (list 'interactive)) 37 | (pcase command 38 | (`interactive (company-begin-backend 'company-inf-ruby)) 39 | (`prefix (and (eq major-mode 'inf-ruby-mode) 40 | (inf-ruby-completion-expr-at-point))) 41 | (`candidates (and inf-ruby-at-top-level-prompt-p 42 | (inf-ruby-completions arg))))) 43 | 44 | (provide 'company-inf-ruby) 45 | ;;; company-inf-ruby.el ends here 46 | --------------------------------------------------------------------------------