]> code.delx.au - gnu-emacs-elpa/commitdiff
Added dabbrev back-end.
authorNikolaj Schumacher <git@nschum.de>
Sun, 15 Mar 2009 19:09:51 +0000 (20:09 +0100)
committerNikolaj Schumacher <git@nschum.de>
Fri, 20 Mar 2009 09:20:40 +0000 (10:20 +0100)
company-dabbrev.el [new file with mode: 0644]
company.el

diff --git a/company-dabbrev.el b/company-dabbrev.el
new file mode 100644 (file)
index 0000000..0571260
--- /dev/null
@@ -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
index 41cc343d5c39b1bbaee7d77d156363f4cfe8a418..a43fcba9a83937cb9f116c0a6796bf19ee8070bc 100644 (file)
@@ -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)))