The following elisp code inserts
hello world! 10 times:
-*- lexical-binding: t -*- (dotimes (i 10) (insert "hello world!\n"))
If I byte-compile that code, I get the following message:
hellos.el:2:1:Warning: Unused lexical variable `i'
This is strange ...
i is used to count from 0 to 9, even if it is not used in the repeated code. How am I supposed to loop 10 times ?!
Even stranger, the warning message disappears if I set
-*- lexical-binding: nil -*-
Go figure ...
Is this a bug (admittedly minor) in the emacs compiler? Is there a way to loop 10 times without using a counting variable?