Klimi's new dotfiles with stow.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

57 satır
2.0 KiB

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