From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
On 2018-05-17 08:18, Shea Levy wrote:
> 2. How do we actually ensure the variables are propagated? I wrote the=
>=C2=A0 =C2=A0 inherit-local package to do the propagation, but there= 9;s no obvious
>=C2=A0 =C2=A0 hook point to call it (thus the advice around generate-ne= w-buffer)
We now have variable watchers:
> add-variable-watcher is a built-in function in =E2=80=98C source code= =E2=80=99.
>
> (add-variable-watcher SYMBOL WATCH-FUNCTION)
>
> Cause WATCH-FUNCTION to be called when SYMBOL is set.
>
> It will be called with 4 arguments: (SYMBOL NEWVAL OPERATION WHERE). > SYMBOL is the variable being changed.
> NEWVAL is the value it will be changed to.
> OPERATION is a symbol representing the kind of change, one of: =E2=80= =98set=E2=80=99,
> =E2=80=98let=E2=80=99, =E2=80=98unlet=E2=80=99, =E2=80=98makunbound=E2= =80=99, and =E2=80=98defvaralias=E2=80=99.
> WHERE is a buffer if the buffer-local value of the variable is being > changed, nil otherwise.
>
> All writes to aliases of SYMBOL will call WATCH-FUNCTION too.
These could probably be used for that purpose: