GNU bug report logs - #45056
28.0.50; lexical-let doesn't work with returned closures on nativecomp

Previous Next

Package: emacs;

Reported by: "Mark A. Hershberger" <mah <at> everybody.org>

Date: Sat, 5 Dec 2020 18:17:01 UTC

Severity: normal

Found in version 28.0.50

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andrea Corallo <akrl <at> sdf.org>
To: 45056 <at> debbugs.gnu.org
Cc: mah <at> everybody.org
Subject: bug#45056: 28.0.50; lexical-let doesn't work with returned closures on nativecomp
Date: Sat, 05 Dec 2020 19:49:57 +0000
"Mark A. Hershberger" via "Bug reports for GNU Emacs, the Swiss army
knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:

> I have a function (mah/firestarter-sentinel) that is called from
> make-process.  The make-process call looks like this:
>
>     (make-process :name "rsync"
>                           :buffer rsync-buff
>                           :stderr rsync-buff
>                           :command (apply 'list "rsync" args)
>                           :sentinel (mah/firestarter-sentinel (getenv "REMOTE_HOST") post-cmd))
>
> mah/firestarter-sentinal creates a lambda function and uses lexical-let
> to make its parameters (host and post-cmd) available to the lambda
> function that it returns to act as a sentinal.
>
> Using eval-last-sexp on mah/firestarter-sentinal works, but loading the
> function from a compiled file does not and results in the message:
>
>     mah/firestarter-sentinel: Symbol’s function definition is void: host
>
> Here is the function:
>
> (defun mah/firestarter-sentinel (host post-cmd)
>   "Sentinel 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")))))))

Hi Mark,

have you checked if this behavior is common to the non native build?

  Andrea




This bug report was last modified 4 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.