5

I wrote a Flycheck frontend for LDC. It installs into Emacs fine, and I remember to require it, but for some reason, it doesn't automatically enable itself when I open a file in d-mode. What did I miss?

Edit: As per request, here are the relevant parts of my init file:

;;D
(autoload 'd-mode "d-mode" "Major mode for editing D code." t)
(add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode))

;;Flycheck
(require 'flycheck-ldc)
(add-hook 'after-init-hook #'global-flycheck-mode)
(setq-default flycheck-disabled-checkers '(c/c++-clang))

Edit 2: As per request, here is the result of C-c ! v in a d-mode buffer:

Syntax checkers for buffer logic.d in d-mode:

  d-dmd
    - predicate:  nil
    - executable: Not found

Flycheck Mode is enabled.

The following syntax checkers are not registered:

  - d-ldc

 Try adding these syntax checkers to `flycheck-checkers'.
7
  • That's impossible to say with as little information as you have given. Please edit your question and add the relevant parts of your init file. Specifically, show your D-Mode and Flycheck setup.
    – user227
    Commented Apr 24, 2015 at 9:18
  • I have some foggy memory that flycheck keeps a list of major modes where it should be enabled. Don't remember what the variable name. You would probably find it if you looked into its sources.
    – wvxvw
    Commented Apr 24, 2015 at 12:34
  • Do you actually turn flycheck on in your d-mode buffers? For instance, automatically with (add-hook 'd-mode-hook 'flycheck-mode)
    – deprecated
    Commented Apr 27, 2015 at 4:42
  • I just noticed that you enable global-flycheck-mode, so my suggestion in the previous comment should not be necessary.
    – deprecated
    Commented Apr 27, 2015 at 13:36
  • 1
    Please type C-c ! v in a D Mode buffer, and add the contents of the buffer which pops up to your question. Feel free to use a screenshot if that's convenient for you.
    – user227
    Commented Apr 29, 2015 at 19:22

2 Answers 2

3

Flycheck does not find syntax checkers automagically. It's not enough to just define a syntax checker, you also need to register it, by adding it to flycheck-checkers, as Flycheck told you.

(add-to-list 'flycheck-checkers 'd-ldc)

For more information please consult the Flycheck manual which guides you through the whole process of defining a new syntax checker.

2
  • My source clearly indicates that I do exactly this (line 62 to be exact).
    – Koz Ross
    Commented May 4, 2015 at 8:26
  • I'm sorry, but the output clearly indicates that you did not successfully register the checker. Flycheck doesn't lie—there must be something wrong in your code. Did you check for possible typos?
    – user227
    Commented May 4, 2015 at 10:20
1

For malabar-mode, which is enabled in java and groovy buffers, I also added:

(flycheck-define-generic-checker 'jvm-mode-malabar
  "Integrate flycheck with the malabar JVM service."
  :start #'malabar-flycheck-command
  :modes '(java-mode groovy-mode)
)

(add-to-list 'flycheck-checkers 'jvm-mode-malabar)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.