From 8f4b1d97dc7124d4768e3dae4047e52d8d9cfa71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 20 Nov 2019 22:55:29 +0000 Subject: [PATCH] Resolve compilation warnings * eglot.el (company-tooltip-align-annotations): Forward declare. (eglot--cached-server): Renamed from eglot--cached-current-server. (eglot--managed-mode, eglot-current-server) (eglot--current-server-or-lose) (eglot--maybe-activate-editing-mode): use it. (eglot-completion-at-point): Don't use insertTextFormat. --- lisp/progmodes/eglot.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index a327655a0ea..90f2c684745 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -71,7 +71,8 @@ (require 'filenotify) (require 'ert) (require 'array) -(defvar company-backends) ; forward-declare, but don't require company yet +(defvar company-backends) ; forward-declare, but don't require company +(defvar company-tooltip-align-annotations) @@ -1222,6 +1223,9 @@ For example, to keep your Company customization use (push (cons ',symbol (symbol-value ',symbol)) eglot--saved-bindings) (setq-local ,symbol ,binding))) +(defvar-local eglot--cached-server nil + "A cached reference to the current EGLOT server.") + (define-minor-mode eglot--managed-mode "Mode for source buffers managed by some EGLOT project." nil nil eglot-mode-map @@ -1251,7 +1255,7 @@ For example, to keep your Company customization use #'eglot-imenu)) (flymake-mode 1) (eldoc-mode 1) - (cl-pushnew (current-buffer) (eglot--managed-buffers eglot--cached-current-server))) + (cl-pushnew (current-buffer) (eglot--managed-buffers eglot--cached-server))) (t (remove-hook 'after-change-functions 'eglot--after-change t) (remove-hook 'before-change-functions 'eglot--before-change t) @@ -1270,8 +1274,8 @@ For example, to keep your Company customization use do (set (make-local-variable var) saved-binding)) (remove-function (local 'imenu-create-index-function) #'eglot-imenu) (setq eglot--current-flymake-report-fn nil) - (let ((server eglot--cached-current-server)) - (setq eglot--cached-current-server nil) + (let ((server eglot--cached-server)) + (setq eglot--cached-server nil) (when server (setf (eglot--managed-buffers server) (delq (current-buffer) (eglot--managed-buffers server))) @@ -1284,16 +1288,13 @@ For example, to keep your Company customization use "Turn off `eglot--managed-mode' unconditionally." (eglot--managed-mode -1)) -(defvar-local eglot--cached-current-server nil - "A cached reference to the current EGLOT server.") - (defun eglot-current-server () "Return logical EGLOT server for current buffer, nil if none." - eglot--cached-current-server) + eglot--cached-server) (defun eglot--current-server-or-lose () "Return current logical EGLOT server connection or error." - (or eglot--cached-current-server + (or eglot--cached-server (jsonrpc-error "No current JSON-RPC connection"))) (defvar-local eglot--unreported-diagnostics nil @@ -1313,8 +1314,8 @@ If it is activated, also signal textDocument/didOpen." ;; `revert-buffer-preserve-modes' is nil. (when (and buffer-file-name (or - eglot--cached-current-server - (setq eglot--cached-current-server + eglot--cached-server + (setq eglot--cached-server (cl-find major-mode (gethash (or (project-current) `(transient . ,default-directory)) @@ -2026,7 +2027,7 @@ is not active." (funcall proxies))))) :annotation-function (lambda (proxy) - (eglot--dbind ((CompletionItem) detail kind insertTextFormat) + (eglot--dbind ((CompletionItem) detail kind) (get-text-property 0 'eglot--lsp-item proxy) (let* ((detail (and (stringp detail) (not (string= detail "")) -- 2.39.2