1 ;;; company-abbrev.el --- company-mode completion backend for abbrev
3 ;; Copyright (C) 2009-2011, 2013-2015, 2021 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 <https://www.gnu.org/licenses/>.
32 (defun company-abbrev-insert (match)
33 "Replace MATCH with the expanded abbrev."
37 (defun company-abbrev (command &optional arg &rest ignored)
38 "`company-mode' completion backend for abbrev."
39 (interactive (list 'interactive))
41 (interactive (company-begin-backend 'company-abbrev
42 'company-abbrev-insert))
43 (prefix (company-grab-symbol))
45 (delete "" (all-completions arg global-abbrev-table))
46 (delete "" (all-completions arg local-abbrev-table))))
48 (meta (abbrev-expansion arg))
49 (post-completion (expand-abbrev))))
51 (provide 'company-abbrev)
52 ;;; company-abbrev.el ends here