]> code.delx.au - gnu-emacs-elpa/commitdiff
Added OddMuse back-end.
authorNikolaj Schumacher <git@nschum.de>
Sun, 15 Mar 2009 16:02:19 +0000 (17:02 +0100)
committerNikolaj Schumacher <git@nschum.de>
Fri, 20 Mar 2009 08:46:06 +0000 (09:46 +0100)
company-oddmuse.el [new file with mode: 0644]
company.el

diff --git a/company-oddmuse.el b/company-oddmuse.el
new file mode 100644 (file)
index 0000000..cf41e7b
--- /dev/null
@@ -0,0 +1,20 @@
+(require 'company)
+(require 'oddmuse)
+(eval-when-compile (require 'cl))
+
+(defvar company-oddmuse-link-regexp
+  "\\(\\<[A-Z][[:alnum:]]*\\>\\)\\|\\[\\[\\([[:alnum:]]+\\>\\|\\)")
+
+(defun company-oddmuse (command &optional arg &rest ignored)
+  (case command
+    ('prefix (let ((case-fold-search nil))
+               (and (eq major-mode 'oddmuse-mode)
+                    (looking-back company-oddmuse-link-regexp (point-at-bol))
+                    (or (match-string 1)
+                        (match-string 2)))))
+    ('candidates (all-completions arg
+                                  (oddmuse-make-completion-table oddmuse-wiki)))
+    ))
+
+(provide 'company-oddmuse)
+;;; company-oddmuse.el ends here
index b2a4582adbfd8bb30ae63ee34eba079ca1a8bac2..73f475196f7c7952a87ad51015cb91cc98f1beb6 100644 (file)
@@ -94,7 +94,7 @@
                          (function :tag "custom function" nil))))
 
 (defcustom company-backends '(company-elisp company-nxml company-css
-                              company-semantic company-ispell)
+                              company-semantic company-oddmuse company-ispell)
   "*"
   :group 'company
   :type '(repeat (function :tag "function" nil)))