2

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?

  • 4
    I do not think it is used deliberately. It looks as if left over from debugging. I'm not aware of any way and could have any effect here. – lunaryorn Jul 23 '16 at 9:45
  • In Emacs 24.5.1 2016-06-04 this string looks like (funcall initial-major-mode), so @lunaryorn are right. – Konstantin Morenko Jul 23 '16 at 12:43
1

I'm posting an "answer" just to clear the question. Everyone, including me when I posted the question, thinks that the "and" has no value, and might be a leftover from something.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.