aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/flymake.el122
1 files changed, 60 insertions, 62 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index ec71f353ee3..f73bdadef72 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -695,12 +695,12 @@ region is invalid. This function saves match data."
695(defvar flymake-diagnostic-functions nil 695(defvar flymake-diagnostic-functions nil
696 "Special hook of Flymake backends that check a buffer. 696 "Special hook of Flymake backends that check a buffer.
697 697
698The functions in this hook diagnose problems in a buffer's 698The functions in this hook diagnose problems in a buffer's contents and
699contents and provide information to the Flymake user interface 699provide information to the Flymake user interface about where and how to
700about where and how to annotate problems diagnosed in a buffer. 700annotate problems diagnosed in a buffer.
701 701
702Each backend function must be prepared to accept an arbitrary 702Each backend function must be prepared to accept an arbitrary number of
703number of arguments: 703arguments:
704 704
705* the first argument is always REPORT-FN, a callback function 705* the first argument is always REPORT-FN, a callback function
706 detailed below; 706 detailed below;
@@ -710,74 +710,72 @@ number of arguments:
710 710
711Currently, Flymake may provide these keyword-value pairs: 711Currently, Flymake may provide these keyword-value pairs:
712 712
713* `:recent-changes', a list of recent changes since the last time 713* `:recent-changes', a list of recent changes since the last time the
714 the backend function was called for the buffer. An empty list 714 backend function was called for the buffer. An empty list indicates
715 indicates that no changes have been recorded. If it is the 715 that no changes have been recorded. If it is the first time that this
716 first time that this backend function is called for this 716 backend function is called for this activation of `flymake-mode', then
717 activation of `flymake-mode', then this argument isn't provided 717 this argument isn't provided at all (i.e. it's not merely nil).
718 at all (i.e. it's not merely nil). 718
719 719 Each element is in the form (BEG END TEXT) where BEG and END are
720 Each element is in the form (BEG END TEXT) where BEG and END 720 buffer positions, and TEXT is a string containing the text contained
721 are buffer positions, and TEXT is a string containing the text 721 between those positions (if any) after the change was performed.
722 contained between those positions (if any) after the change was 722
723 performed. 723* `:changes-start' and `:changes-end', the minimum and maximum buffer
724 724 positions touched by the recent changes. These are only provided if
725* `:changes-start' and `:changes-end', the minimum and maximum 725 `:recent-changes' is also provided.
726 buffer positions touched by the recent changes. These are only 726
727 provided if `:recent-changes' is also provided. 727Whenever Flymake or the user decides to re-check the buffer, backend
728 728functions are called as detailed above and are expected to initiate this
729Whenever Flymake or the user decides to re-check the buffer, 729check, but aren't required to complete it before exiting: if the
730backend functions are called as detailed above and are expected 730computation involved is expensive, especially for large buffers, that
731to initiate this check, but aren't required to complete it before 731task can be scheduled for the future using asynchronous processes or
732exiting: if the computation involved is expensive, especially for 732other asynchronous mechanisms.
733large buffers, that task can be scheduled for the future using 733
734asynchronous processes or other asynchronous mechanisms. 734In any case, backend functions are expected to return quickly or signal
735 735an error, in which case the backend is disabled. Flymake will not try
736In any case, backend functions are expected to return quickly or 736disabled backends again for any future checks of this buffer. To reset
737signal an error, in which case the backend is disabled. Flymake 737the list of disabled backends, turn `flymake-mode' off and on again, or
738will not try disabled backends again for any future checks of 738interactively call `flymake-start' with a prefix argument.
739this buffer. To reset the list of disabled backends, turn
740`flymake-mode' off and on again, or interactively call
741`flymake-start' with a prefix argument.
742 739
743If the function returns, Flymake considers the backend to be 740If the function returns, Flymake considers the backend to be
744\"running\". If it has not done so already, the backend is 741\"running\". If it has not done so already, the backend is expected to
745expected to call the function REPORT-FN with a single argument 742call the function REPORT-FN with a single argument REPORT-ACTION also
746REPORT-ACTION also followed by an optional list of keyword-value 743followed by an optional list of keyword-value pairs in the
747pairs in the form (:REPORT-KEY VALUE :REPORT-KEY2 VALUE2...). 744form (:REPORT-KEY VALUE :REPORT-KEY2 VALUE2...).
748 745
749Currently accepted values for REPORT-ACTION are: 746Currently accepted values for REPORT-ACTION are:
750 747
751* A (possibly empty) list of diagnostic objects created with 748* A (possibly empty) list of diagnostic objects created with
752 `flymake-make-diagnostic', causing Flymake to delete all 749 `flymake-make-diagnostic', causing Flymake to delete all previous
753 previous diagnostic annotations in the buffer and create new 750 diagnostic annotations in the buffer and create new ones from this
754 ones from this list. 751 list.
755 752
756 A backend may call REPORT-FN repeatedly in this manner, but 753 A backend may call REPORT-FN repeatedly in this manner, but only until
757 only until Flymake considers that the most recently requested 754 Flymake considers that the most recently requested buffer check is now
758 buffer check is now obsolete because, say, buffer contents have 755 obsolete because, say, buffer contents have changed in the meantime.
759 changed in the meantime. The backend is only given notice of 756 The backend is only given notice of this via a renewed call to the
760 this via a renewed call to the backend function. Thus, to 757 backend function. Thus, to prevent making obsolete reports and
761 prevent making obsolete reports and wasting resources, backend 758 wasting resources, backend functions should first cancel any ongoing
762 functions should first cancel any ongoing processing from 759 processing from previous calls.
763 previous calls. 760
764 761* The symbol `:panic', signaling that the backend has encountered an
765* The symbol `:panic', signaling that the backend has encountered 762 exceptional situation and should be disabled.
766 an exceptional situation and should be disabled.
767 763
768Currently accepted REPORT-KEY arguments are: 764Currently accepted REPORT-KEY arguments are:
769 765
770* `:explanation' value should give user-readable details of 766* `:explanation' value should give user-readable details of the
771 the situation encountered, if any. 767 situation encountered, if any.
772 768
773* `:force': value should be a boolean suggesting that Flymake 769* `:force': value should be a boolean suggesting that Flymake consider
774 consider the report even if it was somehow unexpected. 770 the report even if it was somehow unexpected.
775 771
776* `:region': a cons (BEG . END) of buffer positions indicating 772* `:region': a cons (BEG . END) of buffer positions specifying that
777 that the report applies to that region only. Specifically, 773 Flymake should only delete diagnostic annotations of past reports if
778 this means that Flymake will only delete diagnostic annotations 774 they intersect the region by at least one character. The list of
779 of past reports if they intersect the region by at least one 775 diagnostics objects in the report need not be contained in the region.
780 character.") 776 This makes it allows backends to choose between accumulating or
777 completely replacing diagnostics across different invocations of
778 REPORT-FN, by specifying a either 0-length region or the full buffer.")
781 779
782(put 'flymake-diagnostic-functions 'safe-local-variable #'null) 780(put 'flymake-diagnostic-functions 'safe-local-variable #'null)
783 781