]> code.delx.au - gnu-emacs-elpa/blob - company-abbrev.el
Tag company-dabbrev-ignore-buffers with package-version
[gnu-emacs-elpa] / company-abbrev.el
1 ;;; company-abbrev.el --- company-mode completion backend for abbrev
2
3 ;; Copyright (C) 2009-2011, 2015 Free Software Foundation, Inc.
4
5 ;; Author: Nikolaj Schumacher
6
7 ;; This file is part of GNU Emacs.
8
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.
13
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.
18
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/>.
21
22
23 ;;; Commentary:
24 ;;
25
26 ;;; Code:
27
28 (require 'company)
29 (require 'cl-lib)
30 (require 'abbrev)
31
32 (defun company-abbrev-insert (match)
33 "Replace MATCH with the expanded abbrev."
34 (expand-abbrev))
35
36 ;;;###autoload
37 (defun company-abbrev (command &optional arg &rest ignored)
38 "`company-mode' completion backend for abbrev."
39 (interactive (list 'interactive))
40 (cl-case command
41 (interactive (company-begin-backend 'company-abbrev
42 'company-abbrev-insert))
43 (prefix (company-grab-symbol))
44 (candidates (nconc
45 (delete "" (all-completions arg global-abbrev-table))
46 (delete "" (all-completions arg local-abbrev-table))))
47 (meta (abbrev-expansion arg))))
48
49 (provide 'company-abbrev)
50 ;;; company-abbrev.el ends here