javascriptemacsflymakejs2-mode

Flymake quits right ahead after loading with js2-mode


When opening .js files, js2-mode and, subsequently, flymake-js is automatically loaded. But flymake unloads right ahead with the message

Toggling flymake-mode off; better pass an explicit argument.

However, when enabling it manually, using M-x flymake-mode, it keeps activated. Has anybody encountered similar behavior and has fixed it?

My setup: I followed the instructions on emacswiki to set up Flymake to work with the most recent js2-mode with a little modification:

(add-hook 'js2-mode-hook '(lambda () (flymake-js-load)))

instead of

(add-hook 'javascript-mode-hook '(lambda () (flymake-js-load)))

Solution

  • Probably, somewhere in your hook, there is a statement like :

         (flymake-mode t)
    

    you need to change it to :

         (flymake-mode 1)
    

    I read the documentation on flymake-mode. It says:

    flymake-mode is an interactive compiled Lisp function in `flymake.el'.
    (flymake-mode &optional ARG)
    
    Minor mode to do on-the-fly syntax checking.
    When called interactively, toggles the minor mode.
    With arg, turn Flymake mode on if and only if arg is positive.
    

    If and only if the arg is positive. Not non-nil. But the page on http://www.emacswiki.org/emacs/FlymakeJavaScript which suggests a definition for flymake-js-load, shows (flymake-mode t) .

    That seems wrong.