]> code.delx.au - gnu-emacs-elpa/commitdiff
Added support for yaooddmuse-mode.
authorNikolaj Schumacher <git@nschum.de>
Fri, 20 Mar 2009 08:30:18 +0000 (09:30 +0100)
committerNikolaj Schumacher <git@nschum.de>
Fri, 20 Mar 2009 12:01:36 +0000 (13:01 +0100)
company-oddmuse.el

index 936cf88db7369ec029d25dcd6b4bca0821e9b389..0cdc93cc6d72f721be95af35d615ad209f98eafd 100644 (file)
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 (require 'company)
-(require 'oddmuse)
+(eval-when 'compile (require 'yaooddmuse nil t))
+(eval-when 'compile (require 'oddmuse nil t))
 (eval-when-compile (require 'cl))
 
 (defvar company-oddmuse-link-regexp
   "\\(\\<[A-Z][[:alnum:]]*\\>\\)\\|\\[\\[\\([[:alnum:]]+\\>\\|\\)")
 
+(defun company-oddmuse-get-page-table ()
+  (case major-mode
+    ('yaoddmuse-mode (with-no-warnings
+                       (yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
+    ('oddmuse-mode (with-no-warnings
+                     (oddmuse-make-completion-table oddmuse-wiki)))))
+
 (defun company-oddmuse (command &optional arg &rest ignored)
   "A `company-mode' completion back-end for `oddmuse-mode'."
   (case command
     ('prefix (let ((case-fold-search nil))
-               (and (eq major-mode 'oddmuse-mode)
+               (and (memq major-mode '(oddmuse-mode yaoddmuse-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)))
-    ))
+    ('candidates (all-completions arg (company-oddmuse-get-page-table)))))
 
 (provide 'company-oddmuse)
 ;;; company-oddmuse.el ends here