Subject: Re: 28.0.50; Dynbind add-function and lambdas as file vars

From: Michael Heerdegen <[email-masked]>
Date: Mon, 28 Jun 2021 04:56:23 +0200

Stefan Monnier <[email-masked]> writes:

> >> -     (save-excursion (eval val)))
> >> +     (save-excursion (eval val t)))
>
> Pushed.  I understand it doesn't directly satisfies your original
> request, but that seems harder to do.

Thanks, Stefan.

I can live with what we have now.

> This said, technically you *can* get exactly what you asked for with
> something like:
>
>     Local Variables:
>     my-do-with-test-process-fun: #[257 "\300\301\^B\302\303\^B\"\302\304\^C\"B\262\^A\305\306$\207" [advice--add-function :before make-closure #[0 "\301\300!\207" [V0 process-sentinel] 2] #[257 "\301\300\^B\"\207" [V0 set-process-sentinel] 4 "\n\n(fn GV--VAL)"] #[128 "\300\301!\207" [message "Test"] 3 "\n\n(fn &rest _)"] nil] 8 "\n\n(fn P)"]
>     End:
>
> which you can generate with:
>
>     M-: (let ((lexical-binding t) (print-escape-newlines t)) (insert (format "%S" (byte-compile '(lambda (p) (add-function :before (process-sentinel p) (lambda (&rest _) (message "Test"))))))))

Good to know that this works.  The main problem is that it's not human
readable and doesn't contain the "source", so it's not less complex
than using `eval' at the end.

Michael.