From 7407f89fe71c87be45f35cf3d4f8bc0550cf8384 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 13 Dec 2018 00:09:01 +0000 Subject: [PATCH] Allow per-diagnostic overlay properties in Flymake * lisp/progmodes/flymake.el (Version): Bump to 1.0.3. (flymake--diag): Add new field overlay-properties. (flymake-make-diagnostic): New optional arg overlay-properties. (flymake--highlight-line): Use it. --- lisp/progmodes/flymake.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index ad8f50cd7a5..7b100da42b8 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.0.2 +;; Version: 1.0.3 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: c languages tools @@ -293,7 +293,7 @@ generated it." (cl-defstruct (flymake--diag (:constructor flymake--diag-make)) - buffer beg end type text backend data overlay) + buffer beg end type text backend data overlay-properties overlay) ;;;###autoload (defun flymake-make-diagnostic (buffer @@ -301,13 +301,20 @@ generated it." end type text - &optional data) + &optional data + overlay-properties) "Make a Flymake diagnostic for BUFFER's region from BEG to END. TYPE is a key to symbol and TEXT is a description of the problem detected in this region. DATA is any object that the caller -wishes to attach to the created diagnostic for later retrieval." +wishes to attach to the created diagnostic for later retrieval. + +OVERLAY-PROPERTIES is an an alist of properties attached to the +created diagnostic, overriding the default properties and any +properties of `flymake-overlay-control' of the diagnostic's +type." (flymake--diag-make :buffer buffer :beg beg :end end - :type type :text text :data data)) + :type type :text text :data data + :overlay-properties overlay-properties)) ;;;###autoload (defun flymake-diagnostics (&optional beg end) @@ -600,7 +607,9 @@ associated `flymake-category' return DEFAULT." ;; properties. (cl-loop for (ov-prop . value) in - (append (reverse ; ensure ealier props override later ones + (append (reverse + (flymake--diag-overlay-properties diagnostic)) + (reverse ; ensure ealier 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)) -- 2.39.2