GNU bug report logs -
#38173
describe-variable: Also tell user *where* variable was changed
Previous Next
Full log
View this message in rfc822 format
On 2019-11-12 15:45, 積丹尼 Dan Jacobson wrote:
> It's like telling users "you transferred $123 from your bank
> account" but not telling users who they transferred it to.
That's pretty crucial information for a bank transfer. Not so much
for every arbitrary variable change (and I think you'd need to be
making an incredible number of bank transactions for the analogy to
hold up :)
Logging every change of every variable made during the execution of a
computer program might carry a noticeable cost, vs the absolutely
tiny number of cases where the logged information would ever be
inspected, so it's not obvious that this would be worthwhile on the
whole?
However, since 26.1 you can do this yourself on a case-by-case basis
when you wish to investigate some particular situation. See: C-h f
add-variable-watcher and remove-variable-watcher, and commands M-x
[cancel-]debug-on-variable-change
Some extremely basic logging without invoking the debugger might be
something like:
(defun var-watcher-backtrace (symbol newval operation where)
"Used with `add-variable-watcher' to log details to *Messages*."
(let ((frames (backtrace-frames)))
(message "%S %S %S %S %S" symbol newval operation where
(pp-to-string frames))))
(add-variable-watcher 'foo 'var-watcher-backtrace)
I suppose the variable watcher mechanism could check another variable
to decide whether to do the sort of "global watching" being requested
here. Then users could turn the behaviour on if desired.
-Phil
This bug report was last modified 5 years and 194 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.