From: Nikolaj Schumacher Date: Fri, 20 Mar 2009 08:30:18 +0000 (+0100) Subject: Added support for yaooddmuse-mode. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/7732d9ea39d1f524d343531bc970ab47694cfcdf Added support for yaooddmuse-mode. --- diff --git a/company-oddmuse.el b/company-oddmuse.el index 936cf88db..0cdc93cc6 100644 --- a/company-oddmuse.el +++ b/company-oddmuse.el @@ -18,23 +18,29 @@ ;; along with this program. If not, see . (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