Skip to main content
1 of 2

The functions added to hooks will be called using funcall.

In the first version, you are adding an anonymous function which calls flyspell-prog-mode in its body. So when executing the hook function, funcall will call the anonymous function which then will call flyspell-prog-mode.

In the second version, you are adding a reference to the function flyspell-prog-mode directly. So when executing the hook function, funcall will call that function directly, i.e. this is the (almost) 'correct' version.

Although it is fine to reference a function via a symbol, it is better to let the compiler know that you are referring to a function by using a sharp quote (see for example this answer), although in this case, as far as I understand, it does not really matter.