Hi @Netsu, I noticed you added back the quote I had removed from your lambda. In general, it's harmful to quote lambdas, so Stefan and I are just trying to motivate good practices. :-)
– MalabarbaDec 14 '14 at 19:48

3 Answers
3

It depends on which version(s) of Emacs you are using (or targeting). Iff you are exclusively using Emacs 24+ then you can safely use variant A:

* Incompatible Lisp Changes in Emacs 24.1
** Passing a nil argument to a minor mode function call now ENABLES
the minor mode unconditionally. This is so that you can write e.g.
(add-hook 'text-mode-hook 'foo-mode)
to enable foo-mode in Text mode buffers, removing the need for
`turn-on-foo-mode' style functions. This affects all mode commands
defined by `define-minor-mode'. If called interactively, the mode
command still toggles the minor mode.

That's from the NEWS file, but as per the comments it's good practice to use function-quoting for function symbols, like so:

(add-hook 'text-mode-hook #'foo-mode)

If the code might need to run under Emacs 23 (or earlier), then I would go with variant C, as personally I dislike seeing anonymous functions in hook variables. (I'm not sure I understand what you mean by variants D & E, mind).

This is (essentially) variant C with a different name, but I agree it's worth emphasising. This is certainly the approach I take when I'm customising major mode behaviours in my own config.
– philsDec 14 '14 at 20:49

1

Variant C implies multiple add-hook statements for each minor mode to enable. I wanted to emphasize that having only one add-hook statement is an advantage.
– abo-aboDec 14 '14 at 21:20

Agreed. In my head I pretty much translated variant C to "define a custom function which enables the mode" rather than "define a custom function which only enables the mode", but in retrospect the latter does seem to have been the intent. As you say, it depends upon whether or not the code is for personal use.
– philsDec 14 '14 at 21:28