From c709b66dcbed8f8a9e40b3c2a9d1e5249160f780 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 4 Sep 2026 14:26:20 +0100 Subject: [PATCH] flymake-show-buffer-diagnostics: Fix interactive form * lisp/progmodes/flymake.el (flymake-show-buffer-diagnostics): Return just one diagnostic when last-command-event was not a mouse event (bug#81786). --- lisp/progmodes/flymake.el | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 0f05c121815..fff42696761 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -2104,24 +2104,26 @@ diagnostics at point. This function doesn't move point" (interactive - (if (mouse-event-p last-command-event) - (with-selected-window (posn-window (event-end last-command-event)) - (with-current-buffer (window-buffer) - (let* ((event-point (posn-point (event-end last-command-event))) - (diags - (or - (flymake-diagnostics event-point) - (let (event-lbp event-lep) - (save-excursion - (goto-char event-point) - (setq event-lbp (line-beginning-position) - event-lep (line-end-position))) - (flymake-diagnostics event-lbp event-lep)))) - (diag (car diags))) - (unless diag - (error "No diagnostics here")) - (list diag)))) - (flymake-diagnostics (point)))) + (let* ((diags + (if (mouse-event-p last-command-event) + (with-selected-window + (posn-window (event-end last-command-event)) + (with-current-buffer (window-buffer) + (let ((event-point (posn-point + (event-end last-command-event)))) + (or (flymake-diagnostics event-point) + (let (event-lbp event-lep) + (save-excursion + (goto-char event-point) + (setq event-lbp (line-beginning-position) + event-lep (line-end-position))) + (flymake-diagnostics event-lbp + event-lep)))))) + (flymake-diagnostics (point)))) + (diag (car diags))) + (unless diag + (error "No diagnostics here")) + (list diag))) (unless flymake-mode (user-error "Flymake mode is not enabled in the current buffer")) (let* ((name (flymake--diagnostics-buffer-name))