0

I try to understand a piece of elisp source code, with many nested and conditional functions calls, and I would like to know if a particular variable is used (and, if so, where in the code) at run time under various conditions/scenarios.

"used" does not only mean assigned a value but for instance printed ou used to evaluate an expression.

Is there a way to detect this variable use at run time, for instance with the debugger.

Drew
  • 75,699
  • 9
  • 109
  • 225
Lgen
  • 1,380
  • 10
  • 19
  • You might be able to put a breakpoint with edebug everywhere a variable is used. – npostavs Dec 08 '17 at 13:38
  • @npostav Npostav mentioned there that he implemented a debug on setting of variables in emacs 26: https://emacs.stackexchange.com/questions/27962/tracking-down-a-write-to-a-variable. To detect access to some variable you can make it unbound with `makunbound` after the program set it. Maybe, remember the value in some replacement variable. If you debug on error you get a backtrace the next time the variable's value cell is accessed. If you want to continue you can re-evaluate the form with the remembered value (maybe). – Tobias Dec 09 '17 at 11:13

0 Answers0