From d6e4cc24161fd727cc2256da038afa55c492d4a3 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 24 Aug 2014 20:51:52 +0400 Subject: [PATCH] company--capf-data: use caching #170 --- company-capf.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/company-capf.el b/company-capf.el index e27ae7a46..b63002569 100644 --- a/company-capf.el +++ b/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 -- 2.39.2