From 91fe6fdde4e140ba7ac0de608c1b0bfbf54bd34b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 18 Apr 2025 19:45:54 +0100 Subject: [PATCH] Eglot: use richer diagnostic-making capability of Flymake 1.4.0 * lisp/progmodes/eglot.el (Package-Requires): Require Flymake 1.4.0. (eglot-handle-notification): Tweak. (cherry picked from commit 7ac6b33560a0449eb4b69664790f97124bfc2933) --- lisp/progmodes/eglot.el | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 685b67d4c27..a6aea329f59 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.3") (eldoc "1.14.0") (external-completion "0.1") (flymake "1.2.1") (jsonrpc "1.0.24") (project "0.9.8") (seq "2.23") (xref "1.6.2")) +;; Package-Requires: ((emacs "26.3") (eldoc "1.14.0") (external-completion "0.1") (flymake "1.4.0") (jsonrpc "1.0.24") (project "0.9.8") (seq "2.23") (xref "1.6.2")) ;; This is a GNU ELPA :core package. Avoid adding functionality ;; that is not available in the version of Emacs recorded above or any @@ -2720,8 +2720,6 @@ expensive cached value of `file-truename'.") ((<= sev 1) 'eglot-error) ((= sev 2) 'eglot-warning) (t 'eglot-note))) - (mess (source code message) - (concat source (and code (format " [%s]" code)) ": " message)) (find-it (abspath) ;; `find-buffer-visiting' would be natural, but calls the ;; potentially slow `file-truename' (bug#70036). @@ -2742,14 +2740,14 @@ expensive cached value of `file-truename'.") for diag-spec across diagnostics collect (eglot--dbind ((Diagnostic) range code message severity source tags) diag-spec - (setq message (mess source code message)) (pcase-let ((`(,beg . ,end) (eglot--diag-range-region range))) (eglot--make-diag (current-buffer) beg end (eglot--diag-type severity) - message `((eglot-lsp-diag . ,diag-spec) - (eglot--doc-version . ,version)) + (list source code message) + `((eglot-lsp-diag . ,diag-spec) + (eglot--doc-version . ,version)) (when-let ((faces (cl-loop for tag across tags when (alist-get tag eglot--tag-faces) @@ -2768,12 +2766,12 @@ expensive cached value of `file-truename'.") (cl-loop for diag-spec across diagnostics collect (eglot--dbind ((Diagnostic) code range message severity source) diag-spec - (setq message (mess source code message)) (let* ((start (plist-get range :start)) (line (1+ (plist-get start :line))) (char (1+ (plist-get start :character)))) (eglot--make-diag - path (cons line char) nil (eglot--diag-type severity) message))) + path (cons line char) nil (eglot--diag-type severity) + (list source code message)))) into diags finally (setq flymake-list-only-diagnostics -- 2.39.5