Add support for flycheck.
authorRicardo Wurmus <rekado@elephly.net>
Mon, 11 Feb 2019 22:00:43 +0000 (23:00 +0100)
committerRicardo Wurmus <rekado@elephly.net>
Mon, 11 Feb 2019 22:00:43 +0000 (23:00 +0100)
guile-studio-configure.scm
guix/rekado/guile-studio.scm

index dc7cea4f7854241cdb1fc3511bc366c77c7acf79..08293d356a185323dc93a5c47a32af791cae1a50 100644 (file)
     ;; Hide the fact that this is Emacs
     (modify-frame-parameters nil '((title . "Guile Studio")))
 
     ;; Hide the fact that this is Emacs
     (modify-frame-parameters nil '((title . "Guile Studio")))
 
+    ;; Check syntax on the fly
+    (require 'flycheck)
+    (flycheck-define-checker guile
+                             "A Guile syntax checker with `guild compile'."
+                             :command ("guild" "compile"
+                                       "--warn=unused-variable"
+                                       "--warn=unused-toplevel"
+                                       "--warn=unbound-variable"
+                                       "--warn=macro-use-before-definition"
+                                       "--warn=arity-mismatch"
+                                       "--warn=duplicate-case-datum"
+                                       "--warn=bad-case-datum"
+                                       "--warn=format"
+                                       source)
+                             :predicate
+                             (lambda ()
+                               (and (boundp 'geiser-impl--implementation)
+                                    (eq geiser-impl--implementation 'guile)))
+                             :verify
+                             (lambda (checker)
+                               (let ((geiser-impl (bound-and-true-p geiser-impl--implementation)))
+                                 (list
+                                  (flycheck-verification-result-new
+                                   :label "Geiser Implementation"
+                                   :message (cond
+                                             ((eq geiser-impl 'guile) "Guile")
+                                             (geiser-impl (format "Other: %s" geiser-impl))
+                                             (t "Geiser not active"))
+                                   :face (cond
+                                          ((or (eq geiser-impl 'guile)) 'success)
+                                          (t '(bold error)))))))
+                             :error-patterns
+                             ((warning
+                               line-start (file-name) ":" line ":" column ": warning:" (message) line-end)
+                              (error
+                               line-start (file-name) ":" line ":" column ":" (message) line-end))
+                             :modes (scheme-mode geiser-mode))
+    (add-to-list 'flycheck-checkers 'guile)
+    (global-flycheck-mode 1)
+
     ;; Remember location in buffers
     (require 'saveplace)
     (setq-default save-place t)
     ;; Remember location in buffers
     (require 'saveplace)
     (setq-default save-place t)
index c34b4c606293aaf7ded103b09f541dd823bed7d9..8e555bffa17db285a2c42503bb6b133a858fab69 100644 (file)
@@ -44,6 +44,7 @@
        ("emacs" ,emacs)
        ("emacs-geiser" ,emacs-geiser)
        ("emacs-company" ,emacs-company)
        ("emacs" ,emacs)
        ("emacs-geiser" ,emacs-geiser)
        ("emacs-company" ,emacs-company)
+       ("emacs-flycheck" ,emacs-flycheck)
        ("emacs-smart-mode-line" ,emacs-smart-mode-line)
        ("emacs-paren-face" ,emacs-paren-face)
        ("adwaita-icon-theme" ,adwaita-icon-theme)))
        ("emacs-smart-mode-line" ,emacs-smart-mode-line)
        ("emacs-paren-face" ,emacs-paren-face)
        ("adwaita-icon-theme" ,adwaita-icon-theme)))