mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 23:10:47 -08:00
Add lisp watchpoints
This allows calling a function whenever a symbol-value is changed. * src/lisp.h (lisp_h_SYMBOL_TRAPPED_WRITE_P): (SYMBOL_TRAPPED_WRITE_P): New function/macro. (lisp_h_SYMBOL_CONSTANT_P): Check for SYMBOL_NOWRITE specifically. (enum symbol_trapped_write): New enumeration. (struct Lisp_Symbol): Rename field constant to trapped_write. (make_symbol_constant): New function. * src/data.c (Fadd_variable_watcher, Fremove_variable_watcher): (set_symbol_trapped_write, restore_symbol_trapped_write): (harmonize_variable_watchers, notify_variable_watchers): New functions. * src/data.c (Fset_default): Call `notify_variable_watchers' for trapped symbols. (set_internal): Change bool argument BIND to 3-value enum and call `notify_variable_watchers' for trapped symbols. * src/data.c (syms_of_data): * src/data.c (syms_of_data): * src/font.c (syms_of_font): * src/lread.c (intern_sym, init_obarray): * src/buffer.c (syms_of_buffer): Use make_symbol_constant. * src/alloc.c (init_symbol): * src/bytecode.c (exec_byte_code): Use SYMBOL_TRAPPED_WRITE_P. * src/data.c (Fmake_variable_buffer_local, Fmake_local_variable): (Fmake_variable_frame_local): * src/eval.c (Fdefvaralias, specbind): Refer to Lisp_Symbol's trapped_write instead of constant. (Ffuncall): Move subr calling code into separate function. (funcall_subr): New function.
This commit is contained in:
parent
0fc4761ca8
commit
227213164e
8 changed files with 381 additions and 176 deletions
|
|
@ -569,10 +569,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
|
|||
if (SYMBOLP (sym)
|
||||
&& !EQ (val, Qunbound)
|
||||
&& !XSYMBOL (sym)->redirect
|
||||
&& !SYMBOL_CONSTANT_P (sym))
|
||||
&& !SYMBOL_TRAPPED_WRITE_P (sym))
|
||||
SET_SYMBOL_VAL (XSYMBOL (sym), val);
|
||||
else
|
||||
set_internal (sym, val, Qnil, false);
|
||||
set_internal (sym, val, Qnil, SET_INTERNAL_SET);
|
||||
}
|
||||
NEXT;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue