Subject: Re: bug#46159: 28.0.50; lexical-let does not work with returned closures on nativecomp

From: "Mark A. Hershberger" <[email-masked]>
Date: Thu, 28 Jan 2021 13:20:43 -0800 (PST)

Thank you for asking the dumb question.

I thought it was there because I got warnings about cl being deprecated, but when I put (require 'cl) just before this function, suddenly it worked.

Strange that it breaks on the native-comp branch but not on master.

----- On Jan 28, 2021, at 3:57 PM, Andrea Corallo [email-masked] wrote:

> mah--- via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <[email-masked]> writes:
> 
>> I previously filed #45056 but the problem seemed to be fixed.
>>
>> It has re-appeared and I just noticed some interesting messages in my
>> *Warnings* buffer that appear to be relevant.
>>
>> Specifically:
>>
>>     Warning (comp): init.el:164:39: Warning: ‘(post-cmd post-cmd)’ is a malformed
>>     function
>>     Warning (comp): init.el:181:59: Warning: reference to free variable ‘rsync-buff’
>>
>> That section of code has this function:
>>
>> (defun mah/firestarter-sentinel (host post-cmd)
>>   "Sentinal function that will run the POST-CMD on HOST."
>>   (lexical-let ((post-cmd post-cmd)
>> 		             (host host)
>> 		             (rsync-buff (get-buffer-create mah/rsync-buff-name)))
>>     (lambda (proc event-type)
>>       (message (concat "post cmd: " post-cmd "\nevent: " event-type))
>>       (cond ((string-equal event-type "finished\n")
>> 	            (if post-cmd
>> 		            (progn (message (concat "rsync finished, running "
>> 					                        post-cmd))
>> 			            (mah/firestarter-do-post host post-cmd rsync-buff))
>> 	              (message "rsync finshed")))
>> 	      (t (if post-cmd
>> 		         (progn (message (concat "rsync didn't finish normally, "
>> 					                     "running anyway.  Check "
>> 					                     mah/rsync-buff-name))
>> 			         (mah/firestarter-do-post host post-cmd rsync-buff))
>> 		         (message "rsync finshed with errors")))))))
>>
>> I just compiled emacs from master and it did not exhibit the same behavior
> 
> Hi,
> 
> do we have a reproducer?  Where is possible to see the whole file being
> compiled?
> 
> Could you post all the warning in the *Async-native-compile-log* emitted
> compiling init.el?
> 
> Dumb question: is this file requiring all necessary libraries (ex
> ‘cl.el’)?
> 
> Thanks!
> 
>   Andrea