1. 10 Oct, 2017 9 commits
    • João Távora's avatar
      Unbreak the button in the Flymake diagnostics buffer again · 0526aac4
      João Távora authored
      Adding the 'keymap' property enabled RET but broke the mouse-action.
      
      * lisp/progmodes/flymake.el
      (flymake--diagnostics-buffer-entries): Use 'action' instead of 'keymap'.
      0526aac4
    • Mark Oteiza's avatar
      Add mode map to Flymake diagnostic button · c89f001d
      Mark Oteiza authored
      * lisp/progmodes/flymake.el (flymake--diagnostics-buffer-entries): Add
      keymap propery.
      c89f001d
    • João Távora's avatar
      Tweak the Flymake diagnostics buffer again · f9cd8ee6
      João Távora authored
      * lisp/progmodes/flymake.el
      (flymake-diagnostics-buffer-mode-map): Don't bind [mouse-1].
      (flymake-show-diagnostic): Rename from
      flymake-show-diagnostic-at-point.  Really use another window.
      (flymake-goto-diagnostic): Rename from
      flymake-goto-diagnostic-at-point.
      (flymake--diagnostics-buffer-entries): Use a button just for
      the message bit.
      f9cd8ee6
    • Mark Oteiza's avatar
      Simplify Flymake diagnostics buffer UX · 0e83f5f2
      Mark Oteiza authored
      Don't create text-buttons unnecessarily, just bind RET and SPC in the
      diagnostics buffer to a command that figures out which diagnostic it
      was invoked on.
      
      * lisp/progmodes/flymake.el
      (flymake--diagnostics-buffer-mode-keymap): Renamed from
      flymake--diagnostics-buffer-button-keymap.
      (flymake-show-diagnostic-at-point): Don't take a button.
      (flymake-goto-diagnostic-at-point): Don't pass button to
      flymake-show-diagnostic-at-point.
      (flymake--diagnostics-buffer-entries): Simplify.
      0e83f5f2
    • João Távora's avatar
      First stab at a Flymake diagnostics buffer · cf4a15b9
      João Távora authored
      The diagnostics buffer summarizes the diagnostics of a buffer in a
      tabulated list and is permanently updated after each Flymake check.
      
      * lisp/progmodes/flymake.el (flymake--handle-report): Call
      flymake-show-diagnostics-buffer under certain conditions.
      (flymake-menu, flymake--diagnostics-buffer-source)
      (flymake--diagnostics-buffer-button-keymap)
      (flymake-show-diagnostic-at-point)
      (flymake-goto-diagnostic-at-point)
      (flymake--diagnostics-buffer-entries)
      (flymake-diagnostics-buffer-mode)
      (flymake--diagnostics-buffer-name)
      (flymake-show-diagnostics-buffer): New definitions.
      cf4a15b9
    • João Távora's avatar
      Fix two Flymake bugs · 042b3cfb
      João Távora authored
      * lisp/progmodes/flymake.el (define-fringe-bitmap): Protect
      against --without-x.
      (flymake--mode-line-format): Ensure mode-line's mouse-4 and mouse-5 work
      in their own windows.
      042b3cfb
    • João Távora's avatar
      Add full documentation on new Flymake API · 1c2e1884
      João Távora authored
      Also, as a minor addition to this API, set flymake-text
      on the diagnostic overlay.  This enables a good example in
      the section "Customization Flymake annotations".
      
      * doc/misc/flymake.texi (Overview of Flymake)
      (Syntax check statuses): Rework.
      (Backend exceptions): Rename from "Troubleshooting"
      (Customizable variables): Add flymake-start-on-flymake-mode. Rework.
      (Extending Flymake): Write chapter.
      (Customizing Flymake annotations, Flymake backends)
      (Flymake utility functions, An annotated example backend):
      New sections and subsections
      
      * lisp/progmodes/flymake.el (flymake-diagnostic-functions)
      (flymake-diagnostic-types-alist): Rework docstring.
      (flymake--highlight-line): Set and use flymake-text property in overlay.
      (flymake-goto-next-error, flymake-goto-prev-error): Fix funny quotes.
      1c2e1884
    • João Távora's avatar
      Fix some Flymake docstrings and messages · 0f7f677f
      João Távora authored
      * lisp/progmodes/flymake.el
      (flymake-start-on-flymake-mode): fix typo.
      (flymake-mode): Add docstring.
      (flymake-mode-line-format): Fix help-echo indications. mouse-2
      describes flymake-mode.
      0f7f677f
    • João Távora's avatar
      Make three new Flymake commands for debugging common problems · 21e70757
      João Távora authored
      * lisp/progmodes/flymake.el (flymake-running-backends)
      (flymake-disabled-backends)
      (flymake-reporting-backends): Make interactive.
      (flymake--collect): Take optional arg.
      21e70757
  2. 09 Oct, 2017 1 commit
    • João Távora's avatar
      Be lazy when starting Flymake checks · 11b37b4a
      João Távora authored
      Don't start the check immediately if the buffer is not being
      displayed.  Wait until it is, using window-configuration-change-hook.
      
      This enables the user to batch-enable flymake-mode on many buffers and
      not have that operation exhaust system resources for checking each
      one.  Likewise, an editing or save operation in a currently
      non-displayed buffer does not immediately start a check.
      
      * lisp/progmodes/flymake.el (flymake-start-on-flymake-mode):
      Rename from flymake-start-syntax-check-on-find-file.
      (flymake-start-syntax-check-on-find-file): Obsolete alias for
      flymake-start-on-flymake-mode.
      (flymake-start): Redesign.  Affect the global post-command-hook
      and local window-configuraiton-change-hook.
      (flymake--schedule-timer-maybe)
      (flymake-after-change-function, flymake-after-save-hook): Pass
      t to flymake-start.
      
      * test/lisp/progmodes/flymake-tests.el (flymake-tests--call-with-fixture)
      (dummy-backends, recurrent-backend): Start flymake check
      explicitly and immediately.
      11b37b4a
  3. 07 Oct, 2017 1 commit
  4. 06 Oct, 2017 1 commit
    • Lele Gaifax's avatar
      Fix typos in Flymake documentation · 9655937d
      Lele Gaifax authored
      * doc/misc/flymake.texi (Syntax check statuses)
      (Adding support for a new syntax check tool)
      (Implementation overview, Locating the buildfile): Fix typos.
      
      * lisp/progmodes/flymake-proc.el (flymake-proc--report-fn)
      (flymake-proc--find-possible-master-files):Fix typos.
      (flymake-proc--panic)
      (flymake-proc-legacy-flymake): Fix function reference in doc.
      
      * lisp/progmodes/flymake.el (flymake-error)
      (flymake-diagnostic-functions): Fix typos.
      (flymake-diagnostic-types-alist): Rephrase and fix typos.
      (flymake--backend-state): Fix typos and rephrase.
      (flymake--handle-report): Delete empty line.
      (flymake--disable-backend)
      (flymake--run-backend): Fix typos.
      (flymake-goto-next-error, flymake-goto-prev-error): Rephrase.
      9655937d
  5. 05 Oct, 2017 3 commits
    • João Távora's avatar
      Don't error when turning on Flymake with no known backends · 6b88f78a
      João Távora authored
      Leave it to the mode line indicator to inform the user that there
      is still some configuration to do.
      
      * lisp/progmodes/flymake.el (flymake-mode): Simplify.
      6b88f78a
    • João Távora's avatar
      Delete a Flymake obsolete alias that can't possibly work · 03eab7a0
      João Távora authored
      The function `flymake-ler-make-ler' can't possibly work as an backward
      compatible interface to existing extensinos (even purely hypothetical
      ones, since none are known).  This is because every diagnostic
      considered by Flymake has to passed to a report-fn function.
      
      * lisp/progmodes/flymake.el (flymake-ler-make-ler): Delete.
      03eab7a0
    • João Távora's avatar
      Misc. minor adjustments to Flymake · 7a1133f1
      João Távora authored
      - Add a half-decent minor-mode menu;
      - Fix "waiting for backends" mode line message;
      - Adjust the flymake-diag-region API;
      - Autoload the flymake-log macro;
      - Auto-disable the legacy backend in more situations;
      - Fix a couple of warnings in legacy backend.
      
      * lisp/progmodes/flymake-proc.el
      (flymake-proc--diagnostics-for-pattern): Use new
      flymake-diag-region.
      
      * lisp/progmodes/flymake-proc.el
      (flymake-proc-legacy-flymake): Do error when no
      buffer-file-name or not writable.
      (flymake-proc-legacy-flymake)
      (flymake-proc-simple-cleanup): Don't reference flymake-last-change-time
      
      * lisp/progmodes/flymake.el (flymake-diag-region):
      Autoload.  Take buffer as first argument.
      
      * lisp/progmodes/flymake.el (flymake-switch-to-log-buffer):
      New command.
      (flymake-menu): Add a simple menu.
      (flymake--mode-line-format): Use menu.  Fix message.  Switch to
      log buffer when clicking exceptional warnings.
      7a1133f1
  6. 03 Oct, 2017 25 commits
    • Paul Eggert's avatar
      ; Spelling fixes · fdbaebde
      Paul Eggert authored
      fdbaebde
    • João Távora's avatar
      Minimal tweak as an attempt to future-proof Flymake API · f964aa99
      João Távora authored
      Discussed with Stefan that this should allow Flymake to request more
      from backends in the future, while also allowing backends to report
      more accurately.
      
      * lisp/progmodes/elisp-mode.el (elisp-flymake-checkdoc)
      (elisp-flymake-byte-compile): Adjust to new API.
      
      * lisp/progmodes/flymake-proc.el ()
      (flymake-proc-legacy-flymake): Adjust to new API.
      
      * lisp/progmodes/flymake.el (flymake-diagnostic-functions):
      Review API again.
      (flymake--handle-report): Allow other keys.  Change ACTION to
      REPORT-ACTION.
      f964aa99
    • João Távora's avatar
      Tweak Flymake autoloads and dependencies · 2e84179a
      João Távora authored
      * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Add to
      flymake-diagnostic-functions here.
      
      * lisp/progmodes/flymake-elisp.el[top]: Don't add to
      emacs-lisp-mode-hook.  Don't call flymake-elisp-setup-backends in
      every buffer.  (flymake-elisp-checkdoc) (flymake-elisp-byte-compile):
      Autoload.  (flymake-elisp-setup-backends): Remove.
      
      * lisp/progmodes/flymake.el: Add some top-level comments.
      (flymake-make-diagnostic)
      (flymake-mode, flymake-mode-on, flymake-mode-off): Add autoloads
      
      Where to fixup this shit?
      2e84179a
    • João Távora's avatar
      Capitalize "Flymake" in docstrings and comments · 5d3f8a8b
      João Távora authored
      * lisp/progmodes/flymake-elisp.el (flymake-elisp-checkdoc)
      (flymake-elisp-setup-backends): Capitalize "Flymake"
      
      * lisp/progmodes/flymake-proc.el:
      (flymake-proc-reformat-err-line-patterns-from-compile-el)
      (flymake-proc--panic, flymake-proc-legacy-flymake)
      (flymake-start-syntax-check, flymake-proc-compile)
      (define-obsolete-variable-alias): Capitalize "Flymake"
      
      * lisp/progmodes/flymake.el (flymake-fringe-indicator-position)
      (flymake-make-diagnostic, flymake-delete-own-overlays)
      (flymake-diagnostic-functions)
      (flymake-diagnostic-types-alist, flymake-is-running)
      (flymake-make-report-fn, flymake-mode-on, flymake-mode-off)
      (flymake-goto-next-error, flymake-goto-prev-error): Capitalize "Flymake"
      5d3f8a8b
    • João Távora's avatar
      Flymake backends can report multiple times per check · f6e909b4
      João Távora authored
      Rewrote a significant part of the Flymake backend API.  Flymake now
      ignores the return value of backend functions: a function can either
      returns or errors.  If it doesn't error, a backend is no longer
      constrained to call REPORT-FN exactly once.  It may do so any number
      of times, cumulatively reporting diagnostics.  Flymake keeps track of
      outdated REPORT-FN instances and disconsiders obsolete reports.
      Backends should avoid reporting obsolete data by cancelling any
      ongoing processing at every renewed call to the backend function.
      
      Consolidated flymake.el internal data structures to require less
      buffer-local variables.  Adjusted Flymake's mode-line indicator to the
      new semantics.
      
      Adapted and simplified the implementation of elisp and legacy
      backends, fixing potential race conditions when calling backends in
      rapid succession.
      
      Added a new test for a backend that calls REPORT-FN multiple
      times.  Simplify test infrastructure.
      
      * lisp/progmodes/flymake-elisp.el (flymake-elisp-checkdoc)
      (flymake-elisp-byte-compile): Error instead of returning nil
      if not in emacs-lisp-mode.
      (flymake-elisp--byte-compile-process): New buffer-local variable.
      (flymake-elisp-byte-compile): Mark (and kill) previous process
      obsolete process before starting a new one.  Don't report if
      obsolete process.
      
      * lisp/progmodes/flymake-proc.el
      (flymake-proc--current-process): New buffer-local variable.
      (flymake-proc--processes): Remove.
      (flymake-proc--process-filter): Don't bind
      flymake-proc--report-fn.
      (flymake-proc--process-sentinel): Rewrite.  Don't report if
      obsolete process.
      (flymake-proc-legacy-flymake): Rewrite.  Mark (and kill)
      previous process obsolete process before starting a new
      one.  Integrate flymake-proc--start-syntax-check-process
      helper.
      (flymake-proc--start-syntax-check-process): Delete.
      (flymake-proc-stop-all-syntax-checks): Don't use
      flymake-proc--processes, iterate buffers.
      (flymake-proc-compile):
      
      * lisp/progmodes/flymake.el (subr-x): Require it
      explicitly.
      (flymake-diagnostic-functions): Reword docstring.
      (flymake--running-backends, flymake--disabled-backends)
      (flymake--diagnostics-table): Delete.
      (flymake--backend-state): New buffer-local variable and new defstruct.
      (flymake--with-backend-state, flymake--collect)
      (flymake-running-backends, flymake-disabled-backends)
      (flymake-reporting-backends): New helpers.
      (flymake-is-running): Use flymake-running-backends.
      (flymake--handle-report): Rewrite.
      (flymake-make-report-fn): Ensure REPORT-FN runs in the correct
      buffer or not at all.
      (flymake--disable-backend, flymake--run-backend): Rewrite.
      (flymake-start): Rewrite.
      (flymake-mode): Set flymake--backend-state.
      (flymake--mode-line-format): Rewrite.
      
      * test/lisp/progmodes/flymake-tests.el
      (flymake-tests--wait-for-backends): New helper.
      (flymake-tests--call-with-fixture): Use it.
      (included-c-header-files): Fix whitespace.
      (flymake-tests--diagnose-words): New helper.
      (dummy-backends): Rewrite for new semantics.  Use cl-letf.
      (flymake-tests--assert-set): Use quote.
      (recurrent-backend): New test.
      f6e909b4
    • João Távora's avatar
      Flymake uses proper idle timers · 22a7372f
      João Távora authored
      Also, flymake-no-changes-timeout can be set to nil to disable
      automatic periodic checks.  But even in that situation the idle timer
      still runs at a reduced rate to detect changes in the variable and
      revert that decision.
      
      * lisp/progmodes/flymake.el (flymake-no-changes-timeout): Improve doc.
      (flymake-last-change-time): Delete.
      (flymake--schedule-timer-maybe): New helper.
      (flymake-after-change-function): Use it.
      (flymake-on-timer-event): Delete
      (flymake-mode): Don't scheduler timer.
      22a7372f
    • João Távora's avatar
      Flymake variable flymake-diagnostic-functions now a special hook · 91851c3e
      João Távora authored
      * lisp/progmodes/flymake-proc.el: Use add-hook to affect
      flymake-diagnostic-functions.
      
      * lisp/progmodes/flymake-elisp.el
      (flymake-elisp-setup-backends): Use add-hook.
      
      * lisp/progmodes/flymake.el (flymake-diagnostic-functions):
      Revise docstring.
      (flymake-start): Use run-hook-wrapped.
      91851c3e
    • João Távora's avatar
      Batch of minor Flymake cleanup actions agreed to with Stefan · bd8ea887
      João Távora authored
      Discussed with Stefan, in no particular order
      
      - Remove aliases for symbols thought to be internal to flymake-proc.el
      - Don’t need :group in defcustom and defface in flymake.el
      - Fix docstring of flymake-make-diagnostic
      - Fix docstring of flymake-diagnostic-functions to clarify keywords.
      - Mark overlays with just the property ’flymake, not ’flymake-overlay
      - Tune flymake-overlays for performance
      - Make flymake-mode-on and flymake-mode-off obsolete
      - Don’t use hash-table-keys unless necessary.
      - Copyright notice in flymake-elisp.
      
      Added some more
      
      - Clarify docstring of flymake-goto-next-error
      - Clarify a comment in flymake--run-backend complaining about ert-deftest.
      - Prevent compilation warnings in flymake-proc.el
      - Remove doctring from obsolete aliases
      
      Now the changelog:
      
      * lisp/progmodes/flymake-elisp.el: Proper copyright notice.
      
      * lisp/progmodes/flymake-proc.el (flymake-warning-re)
      (flymake-proc-diagnostic-type-pred)
      (flymake-proc-default-guess)
      (flymake-proc--get-file-name-mode-and-masks): Move up to
      beginning of file to shoosh compiler warnings
      (define-obsolete-variable-alias): Delete many obsolete aliases.
      
      * lisp/progmodes/flymake.el (flymake-error-bitmap)
      (flymake-warning-bitmap, flymake-note-bitmap)
      (flymake-fringe-indicator-position)
      (flymake-start-syntax-check-on-newline)
      (flymake-no-changes-timeout, flymake-gui-warnings-enabled)
      (flymake-start-syntax-check-on-find-file, flymake-log-level)
      (flymake-wrap-around, flymake-error, flymake-warning)
      (flymake-note): Don't need :group in these defcustom and defface.
      (flymake--run-backend): Clarify comment
      (flymake-mode-map): Remove.
      (flymake-make-diagnostic): Fix docstring.
      (flymake--highlight-line, flymake--overlays): Identify flymake
      overlays with just ’flymake.
      (flymake--overlays): Reverse order of invocation for
      cl-remove-if-not and cl-sort.
      (flymake-mode-on)
      (flymake-mode-off): Make obsolete.
      (flymake-goto-next-error, flymake-goto-prev-error): Fix docstring.
      (flymake-diagnostic-functions): Clarify keyword arguments in
      docstring.
      
      Maybe squash in that one where I remove many obsoletes
      bd8ea887
    • João Távora's avatar
      Explicitly add a(n empty) keymap for Flymake · 87993cdc
      João Távora authored
      Too early to decide what will be in it, if anything.  Though "M-n" and
      "M-p" would be great.
      
      * lisp/progmodes/flymake-ui.el (flymake-mode-map): New variable
      87993cdc
    • João Távora's avatar
      Flymake uses some new fringe bitmaps · 1b271ad7
      João Távora authored
      Also fix behaviour whereby flymake wouldn't react to a change in the
      variable.
      
      * lisp/progmodes/flymake-ui.el (flymake-error-bitmap)
      (flymake-warning-bitmap): Update bitmaps.
      (flymake-note-bitmap): New defcustom.
      (flymake-double-exclamation-mark): New bitmap.
      (flymake-error, flymake-warning, flymake-note)
      (flymake--highlight-line): 'bitmap property must be a symbol.
      Also set default face to flymake-error.
      (flymake--fringe-overlay-spec): Bitmap property can be a
      variable symbol.
      1b271ad7
    • João Távora's avatar
      Remove old flymake-display-err-menu-for-current-line, it's useless · cd39edb5
      João Távora authored
      See https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00949.html
      
      * lisp/progmodes/flymake-ui.el
      (flymake-popup-current-error-menu): Remove.
      cd39edb5
    • João Távora's avatar
      Treat Flymake errors as just another type of diagnostic · 5235eaf7
      João Távora authored
      * lisp/progmodes/flymake.el (flymake--diag-errorp): Remove.
      (flymake--handle-report, flymake-popup-current-error-menu):
      Don't use it.
      5235eaf7
    • João Távora's avatar
      Fix three Flymake bugs when checking C header files · 8118f0f9
      João Távora authored
      The first of these problems is longstanding: if an error-less B.h is
      included from error-ridden A.h, flymake's legacy parser will panic
      (and disable itself) since it sees a non-zero exit for a clean file.
      To fix this, recommend returning 'true' in the documentation for the
      check-syntax target.
      
      Another problem was introduced by the parser rewrite.  For error
      patterns spanning more than one line, point may be left in the middle
      of a line and thus render other patterns useless.  Those patterns were
      written for the old line-by-line parser.  To make them useful again,
      move to the beginning of line in those situations.
      
      The third problem was also longstanding and happened on newer GCC's:
      The "In file included from" prefix confused
      flymake-proc-get-real-file-name.  Fix this.
      
      Also updated flymake--diag-region to fallback to highlighting a full
      line less often.
      
      Add automatic tests to check this.
      
      * lisp/progmodes/flymake-proc.el
      (flymake-proc--diagnostics-for-pattern): Fix bug when patterns
      accidentally spans more than one line.  Don't create
      diagnostics without error messages.
      (flymake-proc-real-file-name-considering-includes): New
      helper.
      (flymake-proc-allowed-file-name-masks): Use it.
      
      * lisp/progmodes/flymake.el (flymake-diag-region): Make COL
      argument explicitly optional.  Only fall back to full line in extreme
      cases.
      
      * test/lisp/progmodes/flymake-tests.el
      (included-c-header-files): New test.
      (different-diagnostic-types): Update.
      
      * test/lisp/progmodes/flymake-resources/Makefile
      (check-syntax): Always return success (0) error code.
      (CC_OPTS): Add -Wextra
      
      * test/lisp/progmodes/flymake-resources/errors-and-warnings.c
      (main): Rewrite comments.
      
      * test/lisp/progmodes/flymake-resources/errors-and-warnings.c:
      Include some dummy header files.
      
      * test/lisp/progmodes/flymake-resources/no-problems.h: New file.
      
      * test/lisp/progmodes/flymake-resources/some-problems.h: New file.
      
      * doc/misc/flymake.texi (Example---Configuring a tool called
      via make): Recommend adding "|| true" to the check-syntax target.
      8118f0f9
    • João Távora's avatar
      Add interactive flymake-start function · 9a629a73
      João Távora authored
      * lisp/progmodes/flymake.el (flymake-on-timer-event)
      (flymake-after-change-function, flymake-mode): Call
      flymake-start.
      (flymake-start): Rename from flymake--start-syntax-check.
      9a629a73
    • João Távora's avatar
      A couple of Flymake backends for emacs-lisp-mode · 483f1e83
      João Távora authored
      Loading flymake-elisp.el doesn't setup flymake-mode to turn on
      automatically, but it affects emacs-lisp-mode-hook so that
      flymake-diagnostic-functions is setup with a suitable buffer-local
      value.  The variable flymake-diagnostic-funtions in every live
      emacs-lisp-mode buffer is also adjusted.
      
      * lisp/progmodes/flymake.el (top): Require flymake-elisp.
      
      * lisp/progmodes/flymake-elisp.el: New file.
      483f1e83
    • João Távora's avatar
      Fancy Flymake mode-line construct displays status · e0df7b96
      João Távora authored
      Imitates compilation-mode's mode-line a bit, and uses its faces.
      
      * lisp/progmodes/flymake.el
      (flymake-error, flymake-warning, flymake-note): Add
      mode-line-face to these flymake error types.
      (flymake-note): Notes don't need a noisy fringe bitmap.
      (flymake-lighter): Delete.
      (flymake--update-lighter): Delete.
      (flymake--mode-line-format): New function and variable.
      (flymake--diagnostics-table): New buffer-local variable.
      (flymake--handle-report): Don't update "lighters".  Affect
      flymake--diagnostics-table.
      (flymake--run-backend): Init flymake--diagnostics-table for backend.
      (flymake-mode): Use flymake--mode-line-format.
      (flymake-mode): Don't update lighter.
      (flymake--highlight-line): Be more careful when overriding a
      nil default overlay property.
      e0df7b96
    • João Távora's avatar
      Tweak Flymake commands flymake-goto-[next/prev]-error · 73601787
      João Távora authored
      Add filters, useful for backends like the upcoming
      flymake-elisp-checkdoc backend, for example, which litters everything
      with low-priority notes.
      
      Also re-implement wraparound for flymake-goto-next-error. Manual
      mentions this, so it's probably a good idea to keep it.  Added a new
      customization variable flymake-wrap-around to control it.
      
      * lisp/progmodes/flymake.el (flymake-goto-prev-error)
      (flymake-goto-next-error): Accept FILTER argument.
      (flymake-wrap-around): New variable.
      (flymake-goto-next-error): Wrap around according to flymake-wrap-around.
      
      * test/lisp/progmodes/flymake-tests.el
      (different-diagnostic-types, dummy-backends): Pass FILTER to
      flymake-goto-prev-error.
      (different-diagnostic-types)
      (dummy-backends): Use flymake-wrap-around.
      73601787
    • João Távora's avatar
      Simplify Flymake logging and erroring · f930963d
      João Távora authored
      Use display-warning and a dedicated *Flymake log* buffer.
      
      To ease readability, flymake log messages are now prefixed with a
      common prefix and the buffer that originated them.
      
      Some situations of over-zealous logging are fixed.
      
      Use byte-compiler info, if available, to determine whence the
      flymake-related log message is coming.
      
      * lisp/progmodes/flymake-proc.el
      (flymake-proc--diagnostics-for-pattern): Improve log message.
      (flymake-proc--panic): Always flymake-log an error
      (flymake-proc--safe-delete-file)
      (flymake-proc--safe-delete-directory):
      Downgrade warning
      (flymake-proc-start-syntax-check): Simplify slightly.
      (flymake-proc--start-syntax-check-process): Simplify.
      (flymake-proc--init-find-buildfile-dir)
      (flymake-proc--init-create-temp-source-and-master-buffer-copy):
      No need to warn twice.
      
      * lisp/progmodes/flymake.el (flymake-log): Convert to macro.
      (flymake--log-1): New helper.
      (flymake-log-level): Deprecate.
      (flymake-error): New helper.
      (flymake-ler-make-ler, flymake--handle-report, flymake-mode):
      Use flymake-error.
      (flymake-on-timer-event)
      (flymake--handle-report, flymake--disable-backend)
      (flymake--run-backend, flymake-start, flymake-mode-on)
      (flymake-mode-off, flymake-after-change-function)
      (flymake-after-save-hook, flymake-find-file-hook): Adjust
      flymake-log calls.
      
      * test/lisp/progmodes/flymake-tests.el
      (flymake-tests--call-with-fixture): Only log errors.
      f930963d
    • João Távora's avatar
      New Flymake API variable flymake-diagnostic-functions · 94a88c1a
      João Távora authored
      Lay groundwork for multiple active backends in the same buffer.
      
      Backends are lisp functions called when flymake-mode sees fit.  They
      are responsible for examining the current buffer and telling
      flymake.el, via return value, if they can syntax check it.
      Backends should return quickly and inexpensively, but they are also
      passed a REPORT-FN argument which they may or may not call
      asynchronously after performing more expensive work.
      
      REPORT-FN's calling convention stipulates that a backend calls it with
      a list of diagnostics as argument, or, alternatively, with a symbol
      denoting an exceptional situation, usually some panic resulting from a
      misconfigured backend.  In keeping with legacy behaviour,
      flymake.el's response to a panic is to disable the issuing backend.
      
      The flymake--diag object representing a diagnostic now also keeps
      information about its source backend.  Among other uses, this allows
      flymake to selectively cleanup overlays based on which backend is
      updating its diagnostics.
      
      * lisp/progmodes/flymake-proc.el (flymake-proc--report-fn):
      New dynamic variable.
      (flymake-proc--process): New variable.
      (flymake-can-syntax-check-buffer): Remove.
      (flymake-proc--process-sentinel): Simplify.  Use
      unwind-protect.  Affect flymake-proc--processes here.
      Bind flymake-proc--report-fn.
      (flymake-proc--process-filter): Bind flymake-proc--report-fn.
      (flymake-proc--post-syntax-check): Delete
      (flymake-proc-start-syntax-check): Take mandatory
      report-fn.  Rewrite.  Bind flymake-proc--report-fn.
      (flymake-proc--process-sentinel): Rewrite and simplify.
      (flymake-proc--panic): New helper.
      (flymake-proc--start-syntax-check-process): Record report-fn
      in process.  Use flymake-proc--panic.
      (flymake-proc-stop-all-syntax-checks): Use mapc.  Don't affect
      flymake-proc--processes here.  Record interruption reason.
      (flymake-proc--init-find-buildfile-dir)
      (flymake-proc--init-create-temp-source-and-master-buffer-copy):
      Use flymake-proc--panic.
      (flymake-diagnostic-functions): Add
      flymake-proc-start-syntax-check.
      (flymake-proc-compile): Call
      flymake-proc-stop-all-syntax-checks with a reason.
      
      * lisp/progmodes/flymake.el (flymake-backends): Delete.
      (flymake-check-was-interrupted): Delete.
      (flymake--diag): Add backend slot.
      (flymake-delete-own-overlays): Take optional filter arg.
      (flymake-diagnostic-functions): New user-visible variable.
      (flymake--running-backends, flymake--disabled-backends): New
      buffer-local variables.
      (flymake-is-running): Now a function, not a variable.
      (flymake-mode-line, flymake-mode-line-e-w)
      (flymake-mode-line-status): Delete.
      (flymake-lighter):  flymake's minor-mode "lighter".
      (flymake-report): Delete.
      (flymake--backend): Delete.
      (flymake--can-syntax-check-buffer): Delete.
      (flymake--handle-report, flymake--disable-backend)
      (flymake--run-backend, flymake--run-backend):  New helpers.
      (flymake-make-report-fn): Make a lambda.
      (flymake--start-syntax-check): Iterate
      flymake-diagnostic-functions.
      (flymake-mode): Use flymake-lighter.  Simplify.  Initialize
      flymake--running-backends and flymake--disabled-backends.
      (flymake-find-file-hook): Simplify.
      
      * test/lisp/progmodes/flymake-tests.el
      (flymake-tests--call-with-fixture): Use flymake-is-running the
      function.  Check if flymake-mode already active before activating it.
      Add a thorough test for flymake multiple backends
      
      * lisp/progmodes/flymake.el (flymake--start-syntax-check):
      Don't use condition-case-unless-debug, use condition-case
      
      * test/lisp/progmodes/flymake-tests.el
      (flymake-tests--assert-set): New helper macro.
      (dummy-backends): New test.
      94a88c1a
    • João Távora's avatar
      More Flymake cleanup before advancing to backend redesign · b2f8b8b4
      João Távora authored
      Diagnostics are reported for buffers, not necessarily files.  It’s the
      backend’s responsibility to compute the buffer where the diagnostic is
      applicable.  For now, this has to match the buffer where flymake-mode
      is active and which is at the origin of the backend call.
      
      flymake.el knows nothing about line/column diagnostics (except for
      backward-compatible flymake-ler-make-ler, which must yet be tested).
      It’s also the backend’s reponsibility to compute a BEG and END
      positions for the diagnostic in the relevant buffer.
      
      * lisp/progmodes/flymake-proc.el
      (flymake-proc--diagnostics-for-pattern): Convert LINE/COL to
      region here.  Check file buffer here.
      (flymake-proc--process-sentinel): Don’t kill output buffer if
      high enough log level.
      
      * lisp/progmodes/flymake.el (flymake-diag-region): Make this a utility
      function.  (flymake--highlight-line): Diagnostic has region now.
      (flymake-popup-current-error-menu): Don’t add file and line numbers to
      already this silly menu.  (flymake--fix-line-numbers): Remove.
      (flymake-report): No need to fix diagnostics here.
      b2f8b8b4
    • João Távora's avatar
      Protect Flymake's eager checks against commands like fill-paragraph · b0bb181f
      João Távora authored
      If flymake-start-syntax-check-on-newline is t, check should start as
      soon as a newline is seen by after-change-functions.  But don't rush
      it: since the buffer state might not be final, we might end up with
      invalid diagnostic regions after some commands silently insert and
      delete newlines (looking at you, fill-paragraph).
      
      * lisp/progmodes/flymake.el (flymake-after-change-function): Pass
      `deferred' to flymake--start-syntax-check.
      (flymake--start-syntax-check): Take optional `deferred' arg.
      b0bb181f
    • João Távora's avatar
      Flymake highlights GCC info/notes as detected by flymake-proc.el · 54beebb4
      João Távora authored
      * lisp/progmodes/flymake-proc.el
      (flymake-proc--diagnostics-for-pattern): Rewrite (using cl-loop) to
      honour more sophisticated flymake-proc-diagnostic-type-pred.
      (flymake-warning-re): Is now an obsolete alias for
      flymake-proc-diagnostic-type-pred.
      (flymake-proc-diagnostic-type-pred): Rename and augment from
      flymake-proc-warning-predicate.  (flymake-proc-warning-predicate):
      Delete.
      
      * lisp/progmodes/flymake.el (flymake-note): New face.
      (flymake-diagnostic-types-alist): Simplify.
      (flymake-note): New overlay category.
      (flymake--lookup-type-property): Only lookup single keys, not lists.
      (flymake--diag-errorp): Rewrite.
      (flymake--highlight-line): Use flymake--lookup-type-property.
      
      * test/lisp/progmodes/flymake-tests.el
      (different-diagnostic-types): Rename from errors-and-warnings.
      Check notes.
      (flymake-tests--call-with-fixture): Use
      flymake-proc-diagnostic-type-pred.
      54beebb4
    • João Távora's avatar
      Flymake checks file names before considering diagnostics · 491cc4a1
      João Távora authored
      The error patterns for gcc picked up errors for the Makefile itself,
      for example.  These shouldn't count as actual errors.
      
      * lisp/progmodes/flymake.el (flymake-report): Check
      matching file names.
      491cc4a1
    • João Távora's avatar
      Echo Flymake error messages when navigating errors interactively · 8c85ab02
      João Távora authored
      Perhaps binding M-n and M-p to flymake-goto-next-error and
      flymake-goto-prev-error also wouldn't be a bad idea.
      
      * lisp/progmodes/flymake.el (flymake-goto-next-error): Use
      target overlay's help-echo.
      8c85ab02
    • João Távora's avatar
      Flymake warning face easier to distinguish · 77879885
      João Távora authored
      A orange wavy underline is very hard to tell from a red wavy
      underline.
      
      * lisp/progmodes/flymake.el (flymake-warning): Change color to
      "deep sky blue"
      77879885