From 459a23444e321d25f0b82bede76947576f01ecc3 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 19 Nov 2016 16:50:34 -0500 Subject: Show watchpoints when describing variables * src/data.c (Fget_variable_watchers): New function. * lisp/help-fns.el (describe-variable): Use it to detect watching functions. --- src/data.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/data.c') diff --git a/src/data.c b/src/data.c index 07730d0924f..095b740c1b2 100644 --- a/src/data.c +++ b/src/data.c @@ -1463,6 +1463,16 @@ SYMBOL (or its aliases) are set. */) return Qnil; } +DEFUN ("get-variable-watchers", Fget_variable_watchers, Sget_variable_watchers, + 1, 1, 0, + doc: /* Return a list of SYMBOL's active watchers. */) + (Lisp_Object symbol) +{ + return (SYMBOL_TRAPPED_WRITE_P (symbol) == SYMBOL_TRAPPED_WRITE) + ? Fget (Findirect_variable (symbol), Qwatchers) + : Qnil; +} + void notify_variable_watchers (Lisp_Object symbol, Lisp_Object newval, @@ -3874,4 +3884,5 @@ syms_of_data (void) DEFSYM (Qset_default, "set-default"); defsubr (&Sadd_variable_watcher); defsubr (&Sremove_variable_watcher); + defsubr (&Sget_variable_watchers); } -- cgit v1.2.1