]> code.delx.au - gnu-emacs-elpa/commitdiff
Replace company-elisp with company-capf
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 14 Jan 2014 04:45:32 +0000 (06:45 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 14 Jan 2014 04:50:53 +0000 (06:50 +0200)
NEWS.md
company-capf.el
company.el

diff --git a/NEWS.md b/NEWS.md
index ae1124c24b9fd896be9fc84620f66334092f1c73..fe9ddf784803a51d04401746bf88a523692cb172 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## Next
 
+* Starting with Emacs version 24.4, `company-capf` is included in
+  `company-backends` and replaces `company-elisp`.
 * `company-capf` supports completion tables that return non-default boundaries.
 * `company-elisp` is enabled in `inferior-emacs-lisp-mode`.
 
index 6dcd87b95dacf70f23465ff0e75cb756f223bb18..0d685623996b3c1122c10c6a25619b7289975698 100644 (file)
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defun company--capf-data ()
-  (let ((data (run-hook-wrapped 'completion-at-point-functions
-                                ;; Ignore misbehaving functions.
-                                #'completion--capf-wrapper 'optimist)))
+  ;; Ignore tags-completion-at-point-function because it subverts company-etags
+  ;; in the default value of company-backends, where the latter comes later.
+  (letf* (((default-value 'completion-at-point-functions) nil)
+          (data (run-hook-wrapped 'completion-at-point-functions
+                                  ;; Ignore misbehaving functions.
+                                  #'completion--capf-wrapper 'optimist)))
     (when (consp data) data)))
 
 (defun company-capf (command &optional arg &rest _args)
index 0d3bb38343c735eff50dc7f760842a98b7d429ed..5f9d6e1218790fb65bef280517cf819fa63de102 100644 (file)
@@ -243,9 +243,15 @@ If this many lines are not available, prefer to display the tooltip above."
                         (assq backend company-safe-backends))
                 (return t))))))
 
-(defcustom company-backends '(company-elisp company-nxml company-css
+(defvar company--include-capf (version< "24.3.50" emacs-version))
+
+(defcustom company-backends `(,@(unless company--include-capf
+                                  (list 'company-elisp))
+                              company-nxml company-css
                               company-eclim company-semantic company-clang
                               company-xcode company-ropemacs company-cmake
+                              ,@(when company--include-capf
+                                  (list 'company-capf))
                               (company-gtags company-etags company-dabbrev-code
                                company-keywords)
                               company-oddmuse company-files company-dabbrev)