I came across this code today, and do not understand why the author used the "and" in it. As far as I can tell, these two lines deliver the same results and have the same functionality. The variable initial-major-mode
is defined in startup.el
, and holds the value of the initial major mode (lisp-interaction-mode for the scratch buffer).
(funcall (and initial-major-mode))
(funcall initial-major-mode)
Am I missing some nuance why the "and" is useful or required in the code? The only thing I can think of is that it might be an easy way of protecting against a (funcall nil)
error if the initial-major-mode
is undefined. But since it's a system variable, I would guess that it is always defined?
(funcall initial-major-mode)
, so @lunaryorn are right.