From: João Távora Date: Thu, 13 Dec 2018 00:09:01 +0000 (+0000) Subject: Allow per-diagnostic overlay properties in Flymake X-Git-Tag: emacs-27.0.90~4000^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7407f89fe71c87be45f35cf3d4f8bc0550cf8384;p=emacs.git 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. --- 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))