diff options
Diffstat (limited to 'lisp/progmodes/flymake.el')
-rw-r--r-- | lisp/progmodes/flymake.el | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 1ed733b7e37..b286208fff9 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,9 +4,12 @@ ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> ;; Maintainer: João Távora <joaotavora@gmail.com> -;; Version: 1.0.8 -;; Package-Requires: ((emacs "26.1")) +;; Version: 1.0.9 ;; Keywords: c languages tools +;; Package-Requires: ((emacs "26.1") (eldoc "1.1.0")) + +;; This is a GNU ELPA :core package. Avoid functionality that is not +;; compatible with the version of Emacs recorded above. ;; This file is part of GNU Emacs. @@ -223,10 +226,10 @@ Specifically, start it when the saved buffer is actually displayed." (defcustom flymake-suppress-zero-counters :warning "Control appearance of zero-valued diagnostic counters in mode line. -If set to t, supress all zero counters. If set to a severity +If set to t, suppress all zero counters. If set to a severity symbol like `:warning' (the default) suppress zero counters less severe than that severity, according to `warning-numeric-level'. -If set to nil, don't supress any zero counters." +If set to nil, don't suppress any zero counters." :type 'symbol) (when (fboundp 'define-fringe-bitmap) @@ -629,7 +632,7 @@ associated `flymake-category' return DEFAULT." for (ov-prop . value) in (append (reverse (flymake--diag-overlay-properties diagnostic)) - (reverse ; ensure ealier props override later ones + (reverse ; ensure earlier props override later ones (flymake--lookup-type-property type 'flymake-overlay-control)) (alist-get type flymake-diagnostic-types-alist)) do (overlay-put ov ov-prop value)) @@ -999,8 +1002,9 @@ special *Flymake log* buffer." :group 'flymake :lighter (add-hook 'after-change-functions 'flymake-after-change-function nil t) (add-hook 'after-save-hook 'flymake-after-save-hook nil t) (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t) + (add-hook 'eldoc-documentation-functions 'flymake-eldoc-function t t) - ;; If Flymake happened to be alrady already ON, we must cleanup + ;; If Flymake happened to be already already ON, we must cleanup ;; existing diagnostic overlays, lest we forget them by blindly ;; reinitializing `flymake--backend-state' in the next line. ;; See https://github.com/joaotavora/eglot/issues/223. @@ -1016,6 +1020,7 @@ special *Flymake log* buffer." :group 'flymake :lighter (remove-hook 'after-save-hook 'flymake-after-save-hook t) (remove-hook 'kill-buffer-hook 'flymake-kill-buffer-hook t) ;;+(remove-hook 'find-file-hook (function flymake-find-file-hook) t) + (remove-hook 'eldoc-documentation-functions 'flymake-eldoc-function t) (mapc #'delete-overlay (flymake--overlays)) @@ -1083,6 +1088,14 @@ START and STOP and LEN are as in `after-change-functions'." (flymake-mode) (flymake-log :warning "Turned on in `flymake-find-file-hook'"))) +(defun flymake-eldoc-function (report-doc &rest _) + "Document diagnostics at point. +Intended for `eldoc-documentation-functions' (which see)." + (let ((diags (flymake-diagnostics (point)))) + (when diags + (funcall report-doc + (mapconcat #'flymake-diagnostic-text diags "\n"))))) + (defun flymake-goto-next-error (&optional n filter interactive) "Go to Nth next Flymake diagnostic that matches FILTER. Interactively, always move to the next diagnostic. With a prefix |