summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tw/home/files/emacs-packages/flymake-guile.el60
1 files changed, 37 insertions, 23 deletions
diff --git a/tw/home/files/emacs-packages/flymake-guile.el b/tw/home/files/emacs-packages/flymake-guile.el
index a482cf18..edfbce82 100644
--- a/tw/home/files/emacs-packages/flymake-guile.el
+++ b/tw/home/files/emacs-packages/flymake-guile.el
@@ -60,7 +60,20 @@ Any running invocations are killed before running another one."
;; Direct output to a temporary buffer.
:buffer (generate-new-buffer " *flymake-guile*")
;; Guild can't read from stdin; it needs a file.
- :command (list flymake-guile-guild-executable "compile" "-W3"
+ :command (list flymake-guile-guild-executable "compile"
+ ;; See "guild --warn=help" for details.
+ ;; "--warn=unsupported-warning" ; ignore unsupported warning types
+ ;; "--warn=unused-variable" ; too many false positives from macros
+ "--warn=unused-toplevel"
+ "--warn=shadowed-toplevel"
+ "--warn=unbound-variable"
+ "--warn=macro-use-before-definition"
+ "--warn=use-before-definition"
+ "--warn=non-idempotent-definition"
+ "--warn=arity-mismatch"
+ "--warn=duplicate-case-datum"
+ "--warn=bad-case-datum"
+ "--warn=format"
"-L" (expand-file-name
(project-root (project-current nil (file-name-directory
(buffer-file-name source)))))
@@ -72,28 +85,29 @@ Any running invocations are killed before running another one."
(when (memq (process-status proc) '(exit signal))
(unwind-protect
;; Only proceed if we've got the "latest" process.
- (if (with-current-buffer source (eq proc flymake-guile--flymake-proc))
- (with-current-buffer (process-buffer proc)
- (goto-char (point-min))
- (cl-loop
- with msg-regexp = (rx bol (literal temp-file) ":" ; filename
- (group (+ digit)) ":" ; line
- (group (+ digit)) ": " ; column
- (group (or "warning" "error")) ": " ; type
- (group (+ not-newline)) eol) ; message
- while (search-forward-regexp msg-regexp nil t)
- for (beg . end) = (flymake-diag-region
- source ; we filter for messages matching our buffer in the regexp
- (string-to-number (match-string 1))
- (string-to-number (match-string 2)))
- for type = (pcase (match-string 3)
- ("warning" :warning)
- ("error" :error)
- (type (error "Unknown guild error type %s" type)))
- collect (flymake-make-diagnostic source beg end type (match-string 4))
- into diags
- finally (funcall report-fn diags)))
- (flymake-log :warning "Canceling obsolete check %s" proc))
+ (if (with-current-buffer source (not (eq proc flymake-guile--flymake-proc)))
+ (flymake-log :warning "Canceling obsolete check %s" proc)
+ (with-current-buffer (process-buffer proc)
+ (goto-char (point-min))
+ (cl-loop
+ with msg-regexp = (rx bol (literal temp-file) ":" ; filename
+ (group (+ digit)) ":" ; line
+ (group (+ digit)) ": " ; column
+ (group (or "warning" "error")) ": " ; type
+ (group (+ not-newline)) eol) ; message
+ while (search-forward-regexp msg-regexp nil t)
+ for (beg . end) = (flymake-diag-region
+ source ; we filter for messages matching our buffer in the regexp
+ (string-to-number (match-string 1))
+ ;; guild outputs 0-based column numbers
+ (1+ (string-to-number (match-string 2))))
+ for type = (pcase (match-string 3)
+ ("warning" :warning)
+ ("error" :error)
+ (type (error "Unknown guild error type %s" type)))
+ collect (flymake-make-diagnostic source beg end type (match-string 4))
+ into diags
+ finally (funcall report-fn diags))))
;; Clean up temporary buffer.
(kill-buffer (process-buffer proc))
(delete-file temp-file)))))))))