(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?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
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