Skip to main content
added 57 characters in body
Source Link

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.

Others are welcome to provide more nuanced answers :)

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.

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.

Others are welcome to provide more nuanced answers :)

Source Link

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.