Okay, I think I have something mostly working now. The first patch adds watchpoints, then the following 2 implement lisp debug on variable set, and ensure redisplay, respectively. The debugger part isn't quite right, I'm seeing it trigger a 2nd time after continuing. On Sat, Nov 14, 2015 at 5:29 PM, Stefan Monnier wrote: > OTOH if we make sure that the "read-only" hook can't be > overridden/changed/skipped by Elisp code, it might be fine. After thinking about it, I think the simplest thing is not to implement read-only with watchpoints, but rather keep it as a separate Lisp_Symbol setting. > - The risk involved in running arbitrary Lisp code for a variable-read > seems higher. We could make `add-variable-watcher' callable only from C, and manipulate some internal hash table instead of the symbol's plist. Of course this would make it less flexible, but it avoids the whole problem of running arbitrary Lisp code for variable-write (and read, though I don't plan to implement read watchpoints for now).