Subject: Re: bug#15692: 24.3.50; rcirc activity mode-line indicator gets cleared automatically

From: Stefan Monnier <[email-masked]>
Date: Wed, 23 Oct 2013 16:10:25 -0400

>> No.  It wouldn't be very hard to add, tho.
> It's definititely not the first time where I could need something like
> that.  Maybe it could also be a bit more general, e.g., one could add a
> watcher function to a symbol that's called whenever the symbol-value is
> set.

The way to implement it, I think is to take the "read-only" bit of
symbols, and extend it with a third value ("watched").
So assignment to such a variable would be a variation of "read-only",
except that instead of signally an error, it would call some Elisp code.
The point being that the "normal execution path" can stay unchanged, so
we don't slow down normal execution.

Of course, it wouldn't work on those Elisp variable that are defined in
C (i.e. defined via DEFVAR_LISP, DEFVAR_BOOL, or DEFVAR_INT), where the
value can be directly changed by the C code without going through
those tests.  Kind of like advice on subrs.

        Stefan