+(defun company-capf (command &optional arg &rest args)
+ "Adapter for Company completion to use `completion-at-point-functions'."
+ (interactive (list 'interactive))
+ (case command
+ (interactive (company-begin-backend 'company-capf))
+ (prefix
+ (let ((res (run-hook-wrapped 'completion-at-point-functions
+ ;; Ignore misbehaving functions.
+ #'completion--capf-wrapper 'optimist)))
+ (when (consp res)
+ (if (> (nth 1 res) (point))
+ 'stop
+ (buffer-substring-no-properties (nth 0 res) (point))))))
+ (candidates
+ (let ((res (run-hook-wrapped 'completion-at-point-functions
+ ;; Ignore misbehaving functions.
+ #'completion--capf-wrapper 'optimist)))
+ (when (consp res)
+ (all-completions arg (nth 2 res)
+ (plist-get (nthcdr 3 res) :predicate)))))))
+
+(defcustom company-backends '(;; company-capf ;FIXME: Untested!
+ company-elisp company-nxml company-css