From d4dbefa465df2b92c31b666d881f0eb01d9ec9ec Mon Sep 17 00:00:00 2001 From: Nikolaj Schumacher Date: Sun, 15 Mar 2009 20:09:51 +0100 Subject: [PATCH] Added dabbrev back-end. --- company-dabbrev.el | 22 ++++++++++++++++++++++ company.el | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 company-dabbrev.el diff --git a/company-dabbrev.el b/company-dabbrev.el new file mode 100644 index 000000000..0571260a9 --- /dev/null +++ b/company-dabbrev.el @@ -0,0 +1,22 @@ +(require 'company) +(require 'dabbrev) +(eval-when-compile (require 'cl)) + +(defun company-grab-dabbrev-prefix () + (save-excursion + (when (looking-at "\\>") + (let ((end (point))) + (dabbrev--reset-global-variables) + (dabbrev--goto-start-of-abbrev) + (buffer-substring-no-properties (point) end))))) + +(defun company-dabbrev (command &optional arg &rest ignored) + (case command + ('prefix (company-grab-dabbrev-prefix)) + ('candidates (let ((dabbrev-check-other-buffers)) + (dabbrev--reset-global-variables) + (dabbrev--find-all-expansions arg t))) + ('ignore-case t))) + +(provide 'company-dabbrev) +;;; company-dabbrev.el ends here diff --git a/company.el b/company.el index 41cc343d5..a43fcba9a 100644 --- a/company.el +++ b/company.el @@ -99,7 +99,8 @@ (function :tag "custom function" nil)))) (defcustom company-backends '(company-elisp company-nxml company-css - company-semantic company-oddmuse company-ispell) + company-semantic company-oddmuse + company-dabbrev) "*" :group 'company :type '(repeat (function :tag "function" nil))) -- 2.39.2