* Compiler warning
@ 2018-07-18 11:38 Andreas Röhler
2018-07-18 11:48 ` Noam Postavsky
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Röhler @ 2018-07-18 11:38 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi,
get a strange
Warning: Unused lexical variable ‘i’
refering to this:
(defun py-forward-block (&optional arg decorator bol)
"[...]"
(interactive "p")
(let (erg)
(dotimes (i (or arg 1))
(let ((orig (point)))
(setq erg (py--end-base 'py-block-re orig decorator bol))))
(when (and py-verbose-p (called-interactively-p 'any)) (message
"%s" erg))
erg))
While code below compiles without warning:
(defun foo (&optional arg)
(interactive "p")
(dotimes (i (or arg 1))
(insert "Me again\n")))
Any idea?
Thanks,
Andreas
GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5) of
2018-05-29
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Compiler warning
2018-07-18 11:38 Compiler warning Andreas Röhler
@ 2018-07-18 11:48 ` Noam Postavsky
2018-07-18 12:05 ` Andreas Röhler
0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2018-07-18 11:48 UTC (permalink / raw)
To: Andreas Röhler; +Cc: Help Gnu Emacs mailing list
On 18 July 2018 at 07:38, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:
> get a strange
>
> Warning: Unused lexical variable ‘i’
>
> refering to this:
>
> (defun py-forward-block (&optional arg decorator bol)
> "[...]"
> (interactive "p")
> (let (erg)
> (dotimes (i (or arg 1))
> (let ((orig (point)))
> (setq erg (py--end-base 'py-block-re orig decorator bol))))
You haven't use `i', so the warning seems fitting. Use `_' instead of
`i' to tell the compiler the variable is ignored on purpose.
> While code below compiles without warning:
>
> (defun foo (&optional arg)
> (interactive "p")
> (dotimes (i (or arg 1))
> (insert "Me again\n")))
Did you compile this one without lexical-binding?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Compiler warning
2018-07-18 11:48 ` Noam Postavsky
@ 2018-07-18 12:05 ` Andreas Röhler
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Röhler @ 2018-07-18 12:05 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Help Gnu Emacs mailing list
On 18.07.2018 13:48, Noam Postavsky wrote:
> On 18 July 2018 at 07:38, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:
>
>> get a strange
>>
>> Warning: Unused lexical variable ‘i’
>>
>> refering to this:
>>
>> (defun py-forward-block (&optional arg decorator bol)
>> "[...]"
>> (interactive "p")
>> (let (erg)
>> (dotimes (i (or arg 1))
>> (let ((orig (point)))
>> (setq erg (py--end-base 'py-block-re orig decorator bol))))
>
> You haven't use `i', so the warning seems fitting. Use `_' instead of
> `i' to tell the compiler the variable is ignored on purpose.
>
Thanks.
>> While code below compiles without warning:
>>
>> (defun foo (&optional arg)
>> (interactive "p")
>> (dotimes (i (or arg 1))
>> (insert "Me again\n")))
>
> Did you compile this one without lexical-binding?
>
Ehm, yes. Okay, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-18 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-18 11:38 Compiler warning Andreas Röhler
2018-07-18 11:48 ` Noam Postavsky
2018-07-18 12:05 ` Andreas Röhler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).