From f706000c89019e646cf55a417b3b87035ed32794 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 3 May 2018 15:46:27 +0100 Subject: [PATCH] Fix flymake diagnostic positions It's better not to use flymake-diag-region here. * eglot.el (eglot--textDocument/publishDiagnostics): Calculate position by hand. --- lisp/progmodes/eglot.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 86c0a4c05fa..bb0427aca73 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -637,10 +637,13 @@ running. INTERACTIVE is t if called interactively." (with-current-buffer buffer (cl-flet ((pos-at (pos-plist) - (car (flymake-diag-region - (current-buffer) - (plist-get pos-plist :line) - (plist-get pos-plist :character))))) + (save-excursion + (goto-char (point-min)) + (forward-line (plist-get pos-plist :line)) + (forward-char + (min (plist-get pos-plist :character) + (- (line-end-position) + (line-beginning-position))))))) (cl-loop for diag-spec across diagnostics collect (cl-destructuring-bind (&key range severity _code _source message) -- 2.39.2