From 55caaa4a05781354d6bb81005f7f25dad99d7933 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 14 Jan 2014 06:45:32 +0200 Subject: [PATCH] Replace company-elisp with company-capf --- NEWS.md | 2 ++ company-capf.el | 11 ++++++++--- company.el | 8 +++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index ae1124c24..fe9ddf784 100644 --- 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`. diff --git a/company-capf.el b/company-capf.el index 6dcd87b95..0d6856239 100644 --- a/company-capf.el +++ b/company-capf.el @@ -25,10 +25,15 @@ ;;; 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) diff --git a/company.el b/company.el index 0d3bb3834..5f9d6e121 100644 --- a/company.el +++ b/company.el @@ -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) -- 2.39.2