1 ;;; company-ispell.el --- A company-mode completion back-end using ispell
3 ;; Copyright (C) 2009-2011 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/>.
30 (eval-when-compile (require 'cl))
32 (defcustom company-ispell-dictionary nil
33 "*Dictionary to use for `company-ispell'.
34 If nil, use `ispell-complete-word-dict'."
36 :type '(choice (const :tag "default (nil)" nil)
37 (file :tag "dictionary" t)))
39 (defvar company-ispell-available 'unknown)
41 (defun company-ispell-available ()
42 (when (eq company-ispell-available 'unknown)
45 (lookup-words "WHATEVER")
46 (setq company-ispell-available t))
48 (message "Company: ispell-look-command not found")
49 (setq company-ispell-available nil))))
50 company-ispell-available)
53 (defun company-ispell (command &optional arg &rest ignored)
54 "A `company-mode' completion back-end using ispell."
55 (interactive (list 'interactive))
57 (interactive (company-begin-backend 'company-ispell))
58 (prefix (when (company-ispell-available)
60 (candidates (lookup-words arg (or company-ispell-dictionary
61 ispell-complete-word-dict)))
65 (provide 'company-ispell)
66 ;;; company-ispell.el ends here