Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

func flymake-post-syntax-check, please check "flymake-check-start-time" #27

Open
PetersonLian opened this issue Jan 26, 2016 · 0 comments

Comments

@PetersonLian
Copy link

Function flymake-post-syntax-check defined like follows:

(defun flymake-post-syntax-check (exit-status command)
(setq flymake-err-info flymake-new-err-info)
(setq flymake-new-err-info nil)
(setq flymake-err-info
    (flymake-fix-line-numbers
     flymake-err-info 1 (flymake-count-lines)))
(flymake-delete-own-overlays)
(flymake-highlight-err-lines flymake-err-info)
(let (err-count warn-count info-count)
(setq err-count (flymake-get-err-count flymake-err-info "e"))
(setq warn-count  (flymake-get-err-count flymake-err-info "w"))
(setq info-count  (flymake-get-err-count flymake-err-info "i"))
(flymake-log 2 "%s: %d error(s), %d warning(s), %d info in %.2f second(s)"
             (buffer-name) err-count warn-count info-count
             (- (flymake-float-time) flymake-check-start-time))
(setq flymake-check-start-time nil)

(if (and (equal 0 err-count) (equal 0 warn-count) (equal 0 info-count))
    (if (equal 0 exit-status)
        (flymake-report-status "" "")        ; PASSED
      (if (not flymake-check-was-interrupted)
          (flymake-report-fatal-status "CFGERR"
                                       (format "Configuration error has occurred while running %s" command))
        (flymake-report-status nil ""))) ; "STOPPED"
  (flymake-report-status (format "%d/%d/%d" err-count warn-count info-count) "")))
(run-hooks 'flymake-after-syntax-check-hook))

At snippet: (flymake-log 2 "%s: %d error(s), %d warning(s), %d info in %.2f second(s)" (buffer-name) err-count warn-count info-count (- (flymake-float-time) flymake-check-start-time))
How about check variable flymake-check-start-time to see whether it is nil because otherwise expression (- (flymake-float-time) flymake-check-start-time)) will fail with an error.

This behavior costed a emacs dummy (like me) one afternoon to locate it. It would be better to check flymake-check-start-time whether it equals to nil, don't you agree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant