diff options
| author | João Távora | 2017-08-21 00:17:05 +0100 |
|---|---|---|
| committer | João Távora | 2017-10-03 13:49:04 +0100 |
| commit | f1601bef93a23ecd5092d9360a48e2288d835886 (patch) | |
| tree | a9d3f520dae3041f5dac39ada739e236409b3b99 | |
| parent | fe9dc7a087ad2b1ac94d32f975f649a2d7dfeb65 (diff) | |
| download | emacs-f1601bef93a23ecd5092d9360a48e2288d835886.tar.gz emacs-f1601bef93a23ecd5092d9360a48e2288d835886.zip | |
Flymake provides flymake-report re-entry point for backends
* lisp/progmodes/flymake-proc.el (flymake-post-syntax-check):
Simplify. Call flymake-report.
* lisp/progmodes/flymake.el (flymake-report): New function.
| -rw-r--r-- | lisp/progmodes/flymake-proc.el | 38 | ||||
| -rw-r--r-- | lisp/progmodes/flymake.el | 18 |
2 files changed, 31 insertions, 25 deletions
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index 89633feaabd..63c65c25210 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el | |||
| @@ -440,31 +440,18 @@ It's flymake process filter." | |||
| 440 | (setq flymake-is-running nil)))))))) | 440 | (setq flymake-is-running nil)))))))) |
| 441 | 441 | ||
| 442 | (defun flymake-post-syntax-check (exit-status command) | 442 | (defun flymake-post-syntax-check (exit-status command) |
| 443 | (save-restriction | 443 | (let ((err-count (flymake-get-err-count flymake-new-err-info "e")) |
| 444 | (widen) | 444 | (warn-count (flymake-get-err-count flymake-new-err-info "w"))) |
| 445 | (setq flymake-err-info flymake-new-err-info) | 445 | (if (equal 0 exit-status) |
| 446 | (setq flymake-new-err-info nil) | 446 | (flymake-report flymake-new-err-info) |
| 447 | (setq flymake-err-info | 447 | (if flymake-check-was-interrupted |
| 448 | (flymake-fix-line-numbers | 448 | (flymake-report-status nil "") ;; STOPPED |
| 449 | flymake-err-info 1 (count-lines (point-min) (point-max)))) | 449 | (if (and (zerop err-count) (zerop warn-count)) |
| 450 | (flymake-delete-own-overlays) | 450 | (flymake-report-fatal-status "CFGERR" |
| 451 | (flymake-highlight-err-lines flymake-err-info) | 451 | (format "Configuration error has occurred while running %s" command)) |
| 452 | (let (err-count warn-count) | 452 | (flymake-report flymake-new-err-info)))) |
| 453 | (setq err-count (flymake-get-err-count flymake-err-info "e")) | 453 | (setq flymake-new-err-info nil))) |
| 454 | (setq warn-count (flymake-get-err-count flymake-err-info "w")) | 454 | |
| 455 | (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" | ||
| 456 | (buffer-name) err-count warn-count | ||
| 457 | (- (float-time) flymake-check-start-time)) | ||
| 458 | (setq flymake-check-start-time nil) | ||
| 459 | |||
| 460 | (if (and (equal 0 err-count) (equal 0 warn-count)) | ||
| 461 | (if (equal 0 exit-status) | ||
| 462 | (flymake-report-status "" "") ; PASSED | ||
| 463 | (if (not flymake-check-was-interrupted) | ||
| 464 | (flymake-report-fatal-status "CFGERR" | ||
| 465 | (format "Configuration error has occurred while running %s" command)) | ||
| 466 | (flymake-report-status nil ""))) ; "STOPPED" | ||
| 467 | (flymake-report-status (format "%d/%d" err-count warn-count) ""))))) | ||
| 468 | 455 | ||
| 469 | (defun flymake-parse-output-and-residual (output) | 456 | (defun flymake-parse-output-and-residual (output) |
| 470 | "Split OUTPUT into lines, merge in residual if necessary." | 457 | "Split OUTPUT into lines, merge in residual if necessary." |
| @@ -709,6 +696,7 @@ Return its components if so, nil otherwise." | |||
| 709 | (flymake-clear-project-include-dirs-cache) | 696 | (flymake-clear-project-include-dirs-cache) |
| 710 | 697 | ||
| 711 | (setq flymake-check-was-interrupted nil) | 698 | (setq flymake-check-was-interrupted nil) |
| 699 | (setq flymake-check-start-time (float-time)) | ||
| 712 | 700 | ||
| 713 | (let* ((source-file-name buffer-file-name) | 701 | (let* ((source-file-name buffer-file-name) |
| 714 | (init-f (flymake-get-init-function source-file-name)) | 702 | (init-f (flymake-get-init-function source-file-name)) |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 441784c8a17..a1b16c0a13f 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -427,6 +427,24 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'." | |||
| 427 | (setq flymake-mode-line mode-line) | 427 | (setq flymake-mode-line mode-line) |
| 428 | (force-mode-line-update))) | 428 | (force-mode-line-update))) |
| 429 | 429 | ||
| 430 | (defun flymake-report (diagnostics) | ||
| 431 | (save-restriction | ||
| 432 | (widen) | ||
| 433 | (setq flymake-err-info | ||
| 434 | (flymake-fix-line-numbers | ||
| 435 | diagnostics 1 (count-lines (point-min) (point-max)))) | ||
| 436 | (flymake-delete-own-overlays) | ||
| 437 | (flymake-highlight-err-lines flymake-err-info) | ||
| 438 | (let ((err-count (flymake-get-err-count flymake-err-info "e")) | ||
| 439 | (warn-count (flymake-get-err-count flymake-err-info "w"))) | ||
| 440 | (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" | ||
| 441 | (buffer-name) err-count warn-count | ||
| 442 | (- (float-time) flymake-check-start-time)) | ||
| 443 | (if (and (equal 0 err-count) (equal 0 warn-count)) | ||
| 444 | (flymake-report-status "" "") | ||
| 445 | (flymake-report-status (format "%d/%d" err-count warn-count) ""))))) | ||
| 446 | |||
| 447 | |||
| 430 | ;; Nothing in flymake uses this at all any more, so this is just for | 448 | ;; Nothing in flymake uses this at all any more, so this is just for |
| 431 | ;; third-party compatibility. | 449 | ;; third-party compatibility. |
| 432 | (define-obsolete-function-alias 'flymake-display-warning 'message-box "26.1") | 450 | (define-obsolete-function-alias 'flymake-display-warning 'message-box "26.1") |