GNU bug report logs - #49163
28.0.50; Dynbind add-function and lambdas as file vars

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Mon, 21 Jun 2021 23:18:02 UTC

Severity: normal

Found in version 28.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 49163-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 49163-done <at> debbugs.gnu.org
Subject: Re: 28.0.50; Dynbind add-function and lambdas as file vars
Date: Mon, 28 Jun 2021 04:56:23 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> 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.




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

Previous Next


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