emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 22/28: company--capf-data: use caching


From: Dmitry Gutov
Subject: [elpa] 22/28: company--capf-data: use caching
Date: Wed, 27 Aug 2014 01:26:32 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit d6e4cc24161fd727cc2256da038afa55c492d4a3
Author: Dmitry Gutov <address@hidden>
Date:   Sun Aug 24 20:51:52 2014 +0400

    company--capf-data: use caching
    
    #170
---
 company-capf.el |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index e27ae7a..b630025 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]