branch: externals/company commit 13e2adaaefee0867d9456d14ba4396364c77b5eb Author: Jimmy Aguilar Mena <kratsbinov...@gmail.com> Commit: Jimmy Aguilar Mena <kratsbinov...@gmail.com>
Avoid calling executable-find for local buffers. * company-gtags.el (company-gtags-executable) : Restored to the original value. (company-gtags--executable-p) : Test if file is remote and emacs version before calling executable-find again. --- company-gtags.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/company-gtags.el b/company-gtags.el index ff84d29..164c7df 100644 --- a/company-gtags.el +++ b/company-gtags.el @@ -37,7 +37,8 @@ 'company-gtags-gnu-global-program-name 'company-gtags-executable "earlier") -(defcustom company-gtags-executable nil +(defcustom company-gtags-executable + (executable-find "global") "Location of GNU global executable." :type 'string) @@ -64,12 +65,13 @@ completion." (defun company-gtags--executable-p () (cond - (company-gtags-executable) - ((eq company-gtags--executable 'unknown) - (setq-local company-gtags--executable (if (version<= "27" emacs-version) - (executable-find "global" t) - (executable-find "global")))) - (t company-gtags--executable))) + ((not (eq company-gtags--executable 'unknown)) ;; the value is already cached + 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))) + (t ;; use default value (searched locally) + (setq-local company-gtags--executable company-gtags-executable)))) (defun company-gtags--fetch-tags (prefix) "Call global executable "