]> code.delx.au - gnu-emacs-elpa/blob - company-oddmuse.el
Added back-end file headers.
[gnu-emacs-elpa] / company-oddmuse.el
1 ;;; company-oddmuse.el --- a company-mode completion back-end for oddmuse-mode
2 ;;
3 ;; Copyright (C) 2009 Nikolaj Schumacher
4 ;;
5 ;; This file is part of company.
6 ;;
7 ;; This program is free software; you can redistribute it and/or
8 ;; modify it under the terms of the GNU General Public License
9 ;; as published by the Free Software Foundation; either version 2
10 ;; of the License, or (at your option) any later version.
11 ;;
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
16 ;;
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 (require 'company)
21 (require 'oddmuse)
22 (eval-when-compile (require 'cl))
23
24 (defvar company-oddmuse-link-regexp
25 "\\(\\<[A-Z][[:alnum:]]*\\>\\)\\|\\[\\[\\([[:alnum:]]+\\>\\|\\)")
26
27 (defun company-oddmuse (command &optional arg &rest ignored)
28 (case command
29 ('prefix (let ((case-fold-search nil))
30 (and (eq major-mode 'oddmuse-mode)
31 (looking-back company-oddmuse-link-regexp (point-at-bol))
32 (or (match-string 1)
33 (match-string 2)))))
34 ('candidates (all-completions arg
35 (oddmuse-make-completion-table oddmuse-wiki)))
36 ))
37
38 (provide 'company-oddmuse)
39 ;;; company-oddmuse.el ends here