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

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

[elpa] externals/company e6fa6c0 40/46: Add connection-local caching for


From: Dmitry Gutov
Subject: [elpa] externals/company e6fa6c0 40/46: Add connection-local caching for gtags executable.
Date: Wed, 30 Dec 2020 18:33:11 -0500 (EST)

branch: externals/company
commit e6fa6c0c66d2c9575950183845f326cc6833438b
Author: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Commit: Jimmy Aguilar Mena <kratsbinovish@gmail.com>

    Add connection-local caching for gtags executable.
---
 company-gtags.el | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/company-gtags.el b/company-gtags.el
index 164c7df..86038a3 100644
--- a/company-gtags.el
+++ b/company-gtags.el
@@ -69,7 +69,22 @@ completion."
     company-gtags--executable)
    ((and (version<= "27" emacs-version)           ;; can search remotely to set
          (file-remote-p default-directory))
-    (setq-local company-gtags--executable (executable-find "global" t)))
+
+    (with-connection-local-variables
+     (if (boundp 'company-gtags--executable-connection)
+         (setq-local company-gtags--executable     ;; use if defined as 
connection-local
+                     company-gtags--executable-connection)
+
+       ;; Else search and set as connection local for next uses.
+       (setq-local company-gtags--executable (executable-find "global" t))
+       (let* ((host (file-remote-p default-directory 'host))
+              (symvars (intern (concat host "-vars")))) ;; profile name
+
+         (connection-local-set-profile-variables
+          symvars
+          `((company-gtags--executable-connection . 
,company-gtags--executable)))
+
+         (connection-local-set-profiles `(:machine ,host) symvars)))))
    (t                                     ;; use default value (searched 
locally)
     (setq-local company-gtags--executable company-gtags-executable))))
 



reply via email to

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