-
Notifications
You must be signed in to change notification settings - Fork 2
/
company-inf-ruby.el
45 lines (35 loc) · 1.6 KB
/
company-inf-ruby.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; company-inf-ruby.el --- company-mode completion back-end for inf-ruby
;; Copyright (C) 2013-2014 Dmitry Gutov
;; Author: Dmitry Gutov <dgutov@yandex.ru>
;; Version: 0.3
;; URL: https://github.com/company-mode/company-inf-ruby
;; Package-Requires: ((company "0.6.10") (inf-ruby "2.2.7") (emacs "24.1"))
;; This file is NOT part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Uses inf-ruby's built-in completion mechanism.
;;
;;; Code:
(require 'company)
(eval-when-compile (require 'inf-ruby))
(defun company-inf-ruby (command &optional arg &rest ignored)
"`company-mode' completion back-end for `inf-ruby-mode'."
(interactive (list 'interactive))
(pcase command
(`interactive (company-begin-backend 'company-inf-ruby))
(`prefix (and (eq major-mode 'inf-ruby-mode)
(inf-ruby-completion-expr-at-point)))
(`candidates (and inf-ruby-at-top-level-prompt-p
(inf-ruby-completions arg)))))
(provide 'company-inf-ruby)
;;; company-inf-ruby.el ends here