1 ;;; company-abbrev.el --- a company-mode completion back-end for abbrev
3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
5 ;; Author: Nikolaj Schumacher
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 (eval-when-compile (require 'cl))
28 (defun company-abbrev-insert (match)
29 "Replace MATCH with the expanded abbrev."
33 (defun company-abbrev (command &optional arg &rest ignored)
34 "A `company-mode' completion back-end for abbrev."
35 (interactive (list 'interactive))
37 ('interactive (company-begin-backend 'company-abbrev
38 'company-abbrev-insert))
39 ('prefix (company-grab-symbol))
41 (delete "" (all-completions arg global-abbrev-table))
42 (delete "" (all-completions arg local-abbrev-table))))
43 ('meta (abbrev-expansion arg))
46 (provide 'company-abbrev)
47 ;;; company-abbrev.el ends here