diff options
| author | Noam Postavsky | 2016-11-19 16:50:34 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2016-12-02 20:25:14 -0500 |
| commit | 459a23444e321d25f0b82bede76947576f01ecc3 (patch) | |
| tree | 7f8d4d4128aa17317b17c337c4b7ab9d0aa5ded3 | |
| parent | 227213164e06363f0a4fb2beeeb647c99749299e (diff) | |
| download | emacs-459a23444e321d25f0b82bede76947576f01ecc3.tar.gz emacs-459a23444e321d25f0b82bede76947576f01ecc3.zip | |
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.
| -rw-r--r-- | lisp/help-fns.el | 7 | ||||
| -rw-r--r-- | src/data.c | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 87e7d8f87bb..23dec896b81 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -918,6 +918,7 @@ it is displayed along with the global value." | |||
| 918 | (indirect-variable variable) | 918 | (indirect-variable variable) |
| 919 | (error variable))) | 919 | (error variable))) |
| 920 | (obsolete (get variable 'byte-obsolete-variable)) | 920 | (obsolete (get variable 'byte-obsolete-variable)) |
| 921 | (watchpoints (get-variable-watchers variable)) | ||
| 921 | (use (car obsolete)) | 922 | (use (car obsolete)) |
| 922 | (safe-var (get variable 'safe-local-variable)) | 923 | (safe-var (get variable 'safe-local-variable)) |
| 923 | (doc (or (documentation-property | 924 | (doc (or (documentation-property |
| @@ -967,6 +968,12 @@ if it is given a local binding.\n")))) | |||
| 967 | (t "."))) | 968 | (t "."))) |
| 968 | (terpri)) | 969 | (terpri)) |
| 969 | 970 | ||
| 971 | (when watchpoints | ||
| 972 | (setq extra-line t) | ||
| 973 | (princ " Calls these functions when changed: ") | ||
| 974 | (princ watchpoints) | ||
| 975 | (terpri)) | ||
| 976 | |||
| 970 | (when (member (cons variable val) | 977 | (when (member (cons variable val) |
| 971 | (with-current-buffer buffer | 978 | (with-current-buffer buffer |
| 972 | file-local-variables-alist)) | 979 | file-local-variables-alist)) |
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. */) | |||
| 1463 | return Qnil; | 1463 | return Qnil; |
| 1464 | } | 1464 | } |
| 1465 | 1465 | ||
| 1466 | DEFUN ("get-variable-watchers", Fget_variable_watchers, Sget_variable_watchers, | ||
| 1467 | 1, 1, 0, | ||
| 1468 | doc: /* Return a list of SYMBOL's active watchers. */) | ||
| 1469 | (Lisp_Object symbol) | ||
| 1470 | { | ||
| 1471 | return (SYMBOL_TRAPPED_WRITE_P (symbol) == SYMBOL_TRAPPED_WRITE) | ||
| 1472 | ? Fget (Findirect_variable (symbol), Qwatchers) | ||
| 1473 | : Qnil; | ||
| 1474 | } | ||
| 1475 | |||
| 1466 | void | 1476 | void |
| 1467 | notify_variable_watchers (Lisp_Object symbol, | 1477 | notify_variable_watchers (Lisp_Object symbol, |
| 1468 | Lisp_Object newval, | 1478 | Lisp_Object newval, |
| @@ -3874,4 +3884,5 @@ syms_of_data (void) | |||
| 3874 | DEFSYM (Qset_default, "set-default"); | 3884 | DEFSYM (Qset_default, "set-default"); |
| 3875 | defsubr (&Sadd_variable_watcher); | 3885 | defsubr (&Sadd_variable_watcher); |
| 3876 | defsubr (&Sremove_variable_watcher); | 3886 | defsubr (&Sremove_variable_watcher); |
| 3887 | defsubr (&Sget_variable_watchers); | ||
| 3877 | } | 3888 | } |