diff options
| author | João Távora | 2018-06-15 12:17:37 +0100 |
|---|---|---|
| committer | João Távora | 2018-06-15 14:59:42 +0100 |
| commit | 3e7dff88928b568f8d4126c7fe2251662d140be6 (patch) | |
| tree | cc16b002a6bf1b4515e6f92f7ac9b2e8a62d2f67 /doc/misc | |
| parent | aeb6b2e31fea5d3fa78e2f8a0895dc86f6b4a7a6 (diff) | |
| download | emacs-3e7dff88928b568f8d4126c7fe2251662d140be6.tar.gz emacs-3e7dff88928b568f8d4126c7fe2251662d140be6.zip | |
Flymake and backends exchange hints abouts changed regions
* lisp/progmodes/flymake.el (flymake--delete-own-overlays): Accept
BEG and END. Rename from flymake-delete-own-overlays.
(flymake-diagnostic-functions): Describe :region, :recent-changes
in docstring.
(flymake--handle-report): Accept REGION.
(flymake--run-backend): Accept optional ARGS to pass to backend
fn.
(flymake--recent-changes): New buffer-local variable.
(flymake-start): Call flymake--run-backend with recent changes.
(flymake-mode): Initialize flymake--recent-changes. Call
flymake--delete-own-overlays.
(flymake-after-change-function): Collect recent changes.
* doc/misc/flymake.texi (Backend functions): Describe
:recent-changes and :region.
* etc/NEWS (Flymake): Mention improvements in backend communication.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/flymake.texi | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 502d408f2b8..1e7a5e82c61 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi | |||
| @@ -437,18 +437,35 @@ calling convention: one for calls made by Flymake into the backend via | |||
| 437 | the backend function, the other in the reverse direction via a | 437 | the backend function, the other in the reverse direction via a |
| 438 | callback. To be usable, backends must adhere to both. | 438 | callback. To be usable, backends must adhere to both. |
| 439 | 439 | ||
| 440 | Backend functions must accept an arbitrary number of arguments: | 440 | The first argument passed to a backend function is always |
| 441 | @var{report-fn}, a callback function detailed below. Beyond it, | ||
| 442 | functions must be prepared to accept (and possibly ignore) an | ||
| 443 | arbitrary number of keyword-value pairs of the form | ||
| 444 | @w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}. | ||
| 445 | |||
| 446 | Currently, Flymake may pass the following keywords and values to the | ||
| 447 | backend function: | ||
| 441 | 448 | ||
| 442 | @itemize | 449 | @itemize |
| 443 | @item | ||
| 444 | the first argument is always @var{report-fn}, a callback function | ||
| 445 | detailed below; | ||
| 446 | 450 | ||
| 447 | @item | 451 | @item @code{:recent-changes} |
| 448 | the remaining arguments are keyword-value pairs of the form | 452 | The value is a list recent changes since the last time the backend |
| 449 | @w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}. | 453 | function was called for the buffer. If the list is empty, this |
| 450 | Currently, Flymake provides no such arguments, but backend functions | 454 | indicates that no changes have been recorded. If it is the first time |
| 451 | must be prepared to accept (and possibly ignore) any number of them. | 455 | that this backend function is called for this activation of |
| 456 | @code{flymake-mode}, then this argument isn't provided at all | ||
| 457 | (i.e. it's not merely nil). | ||
| 458 | |||
| 459 | Each element is in the form (@var{beg} @var{end} @var{text}) where | ||
| 460 | @var{beg} and @var{end} are buffer positions, and @var{text} is a | ||
| 461 | string containing the text contained between those positions (if any), | ||
| 462 | after the change was performed. | ||
| 463 | |||
| 464 | @item @code{:changes-start} and @code{:changes-end} | ||
| 465 | The value is, repectively, the minimum and maximum buffer positions | ||
| 466 | touched by the recent changes. These are provided for convenience and | ||
| 467 | only if @code{:recent-changes} is also provided. | ||
| 468 | |||
| 452 | @end itemize | 469 | @end itemize |
| 453 | 470 | ||
| 454 | Whenever Flymake or the user decide to re-check the buffer, backend | 471 | Whenever Flymake or the user decide to re-check the buffer, backend |
| @@ -504,6 +521,11 @@ details of the situation encountered, if any. | |||
| 504 | @code{:force}, whose value should be a boolean suggesting | 521 | @code{:force}, whose value should be a boolean suggesting |
| 505 | that Flymake consider the report even if it was somehow | 522 | that Flymake consider the report even if it was somehow |
| 506 | unexpected. | 523 | unexpected. |
| 524 | |||
| 525 | @item | ||
| 526 | @code{:region}, a cons (@var{beg} . @var{end}) of buffer positions | ||
| 527 | indicating that the report applies to that region and that previous | ||
| 528 | reports targeting other parts of the buffer remain valid. | ||
| 507 | @end itemize | 529 | @end itemize |
| 508 | 530 | ||
| 509 | @menu | 531 | @menu |