diff options
| author | João Távora | 2018-12-13 00:09:01 +0000 |
|---|---|---|
| committer | João Távora | 2018-12-13 00:10:50 +0000 |
| commit | 7407f89fe71c87be45f35cf3d4f8bc0550cf8384 (patch) | |
| tree | 04fa54a23db490655da374bcd079a8b53519068f | |
| parent | fcccd52ab086f94fe56900cf15fbdc0ea11b428b (diff) | |
| download | emacs-7407f89fe71c87be45f35cf3d4f8bc0550cf8384.tar.gz emacs-7407f89fe71c87be45f35cf3d4f8bc0550cf8384.zip | |
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.
| -rw-r--r-- | lisp/progmodes/flymake.el | 21 |
1 files 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 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> | 5 | ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> |
| 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> | 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> |
| 7 | ;; Version: 1.0.2 | 7 | ;; Version: 1.0.3 |
| 8 | ;; Package-Requires: ((emacs "26.1")) | 8 | ;; Package-Requires: ((emacs "26.1")) |
| 9 | ;; Keywords: c languages tools | 9 | ;; Keywords: c languages tools |
| 10 | 10 | ||
| @@ -293,7 +293,7 @@ generated it." | |||
| 293 | 293 | ||
| 294 | (cl-defstruct (flymake--diag | 294 | (cl-defstruct (flymake--diag |
| 295 | (:constructor flymake--diag-make)) | 295 | (:constructor flymake--diag-make)) |
| 296 | buffer beg end type text backend data overlay) | 296 | buffer beg end type text backend data overlay-properties overlay) |
| 297 | 297 | ||
| 298 | ;;;###autoload | 298 | ;;;###autoload |
| 299 | (defun flymake-make-diagnostic (buffer | 299 | (defun flymake-make-diagnostic (buffer |
| @@ -301,13 +301,20 @@ generated it." | |||
| 301 | end | 301 | end |
| 302 | type | 302 | type |
| 303 | text | 303 | text |
| 304 | &optional data) | 304 | &optional data |
| 305 | overlay-properties) | ||
| 305 | "Make a Flymake diagnostic for BUFFER's region from BEG to END. | 306 | "Make a Flymake diagnostic for BUFFER's region from BEG to END. |
| 306 | TYPE is a key to symbol and TEXT is a description of the problem | 307 | TYPE is a key to symbol and TEXT is a description of the problem |
| 307 | detected in this region. DATA is any object that the caller | 308 | detected in this region. DATA is any object that the caller |
| 308 | wishes to attach to the created diagnostic for later retrieval." | 309 | wishes to attach to the created diagnostic for later retrieval. |
| 310 | |||
| 311 | OVERLAY-PROPERTIES is an an alist of properties attached to the | ||
| 312 | created diagnostic, overriding the default properties and any | ||
| 313 | properties of `flymake-overlay-control' of the diagnostic's | ||
| 314 | type." | ||
| 309 | (flymake--diag-make :buffer buffer :beg beg :end end | 315 | (flymake--diag-make :buffer buffer :beg beg :end end |
| 310 | :type type :text text :data data)) | 316 | :type type :text text :data data |
| 317 | :overlay-properties overlay-properties)) | ||
| 311 | 318 | ||
| 312 | ;;;###autoload | 319 | ;;;###autoload |
| 313 | (defun flymake-diagnostics (&optional beg end) | 320 | (defun flymake-diagnostics (&optional beg end) |
| @@ -600,7 +607,9 @@ associated `flymake-category' return DEFAULT." | |||
| 600 | ;; properties. | 607 | ;; properties. |
| 601 | (cl-loop | 608 | (cl-loop |
| 602 | for (ov-prop . value) in | 609 | for (ov-prop . value) in |
| 603 | (append (reverse ; ensure ealier props override later ones | 610 | (append (reverse |
| 611 | (flymake--diag-overlay-properties diagnostic)) | ||
| 612 | (reverse ; ensure ealier props override later ones | ||
| 604 | (flymake--lookup-type-property type 'flymake-overlay-control)) | 613 | (flymake--lookup-type-property type 'flymake-overlay-control)) |
| 605 | (alist-get type flymake-diagnostic-types-alist)) | 614 | (alist-get type flymake-diagnostic-types-alist)) |
| 606 | do (overlay-put ov ov-prop value)) | 615 | do (overlay-put ov ov-prop value)) |