(add-hook 'json-mode 'flymake-json-load)
in my .emacs file, but it has no effect. I have to do
M-x flymake-json-load whenever I visit a
.json file. Why doesn't it work?
add-hook does not take a mode symbol as its first parameter; it takes a symbol for a hook variable.
'json-mode-hook and you'll be all set.
Note the differences between the symbols. One is a variable used to store a list of functions to run when entering
json-mode-hook is a variable defined in ‘json-mode.el’.
Documentation: Hook run after entering JSON mode.
and the other is a function used to enter
json-mode is an interactive autoloaded compiled Lisp function in ‘json-mode.el’.
Major mode for editing JSON files