]> code.delx.au - gnu-emacs-elpa/blob - company-oddmuse.el
Added documentation strings.
[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 "A `company-mode' completion back-end for `oddmuse-mode'."
29 (case command
30 ('prefix (let ((case-fold-search nil))
31 (and (eq major-mode 'oddmuse-mode)
32 (looking-back company-oddmuse-link-regexp (point-at-bol))
33 (or (match-string 1)
34 (match-string 2)))))
35 ('candidates (all-completions arg
36 (oddmuse-make-completion-table oddmuse-wiki)))
37 ))
38
39 (provide 'company-oddmuse)
40 ;;; company-oddmuse.el ends here