]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Flymake lighter tool-tip from generating errors
authorRobert A. Burks <rburksdev@gmail.com>
Fri, 16 Feb 2024 23:17:52 +0000 (18:17 -0500)
committerEshel Yaron <me@eshelyaron.com>
Wed, 28 Feb 2024 17:49:50 +0000 (18:49 +0100)
Flymake tool-tip was generating errors on mouse over of
mode-line lighter on inactive windows and on the minor mode
indicator in the describe-mode Help page.
* lisp/progmodes/flymake.el (flymake--mode-line-title):
'help-echo' now uses buffer local state and makes null
check.  (Bug#69248)

Copyright-paperwork-exempt: yes
(cherry picked from commit 2b7dc7fef814753f1c6d4c352fe69bb6e167cd07)

lisp/progmodes/flymake.el

index 5974f07655604dcfb45d0214b4ebd13efb924567..db00cc59c0ec60929de7de908111b3319d8e59f8 100644 (file)
@@ -1569,13 +1569,19 @@ correctly.")
     ,flymake-mode-line-lighter
     mouse-face mode-line-highlight
     help-echo
-    ,(lambda (&rest _)
-       (concat
-        (format "%s known backends\n" (hash-table-count flymake--state))
-        (format "%s running\n" (length (flymake-running-backends)))
-        (format "%s disabled\n" (length (flymake-disabled-backends)))
-        "mouse-1: Display minor mode menu\n"
-        "mouse-2: Show help for minor mode"))
+    ,(lambda (w &rest _)
+       (with-current-buffer (window-buffer w)
+         ;; Mouse can activate tool-tip without window being active.
+         ;; `flymake--state' is buffer local and is null when line
+         ;; lighter appears in *Help* `describe-mode'.
+         (concat
+          (unless (null flymake--state)
+            (concat
+             (format "%s known backends\n"  (hash-table-count flymake--state))
+             (format "%s running\n" (length (flymake-running-backends)))
+             (format "%s disabled\n" (length (flymake-disabled-backends)))))
+          "mouse-1: Display minor mode menu\n"
+          "mouse-2: Show help for minor mode")))
     keymap
     ,(let ((map (make-sparse-keymap)))
        (define-key map [mode-line down-mouse-1]