 
 (defun company-ycmd-get-candidates (prefix)
   "Candidates-command handler for the company backend."
-  (cons :async
-        (lambda (cb) (funcall cb (company-ycmd-candidates)))))
+  (cons :async 'company-ycmd-candidates))
 
 (defun company-ycmd-get-match (prefix)
   (point))

    (dolist (prop company-ycmd-completion-properties candidate)
      (put-text-property 0 1 prop (assoc-default prop src) candidate))))

(defun company-ycmd-candidates ()
  "Get list of completion candidate strings at point.

The returned strings have annotation, metadata, and other pieces
of information added as text-properties.
"
  (if (ycmd-running?)
      (mapcar
       'company-ycmd-construct-candidate
       (assoc-default
        'completions
        (with-local-quit
          (deferred:$
            (ycmd-get-completions)
            (deferred:sync! it)))))
    nil))

(defun company-ycmd-get-metadata (candidate)
  "Fetch the metadata text-property from a candidate string."

(require 'cc-cmds)
(require 'cl-lib)
(require 'company)
(require 'deferred)
(require 'ycmd)

(defconst company-ycmd-completion-properties
