X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/41ef088456675919e4b56a41f964d50a81a781dc..b7974385f6c7b5836e0fdb022ed22df55464a7ec:/packages/company/company-capf.el diff --git a/packages/company/company-capf.el b/packages/company/company-capf.el index e27ae7a46..b63002569 100644 --- a/packages/company/company-capf.el +++ b/packages/company/company-capf.el @@ -28,7 +28,20 @@ (require 'company) (require 'cl-lib) +(defvar company--capf-cache nil) + (defun company--capf-data () + (let ((cache company--capf-cache)) + (if (and (equal (current-buffer) (car cache)) + (equal (point) (car (setq cache (cdr cache)))) + (equal (buffer-chars-modified-tick) (car (setq cache (cdr cache))))) + (cadr cache) + (let ((data (company--capf-data-real))) + (setq company--capf-cache + (list (current-buffer) (point) (buffer-chars-modified-tick) data)) + data)))) + +(defun company--capf-data-real () (cl-letf* (((default-value 'completion-at-point-functions) ;; Ignore tags-completion-at-point-function because it subverts ;; company-etags in the default value of company-backends, where