I’m wondering if there’s any way to make a variable automatically save its old value, so that I can, e.g., write a minor mode that will automatically restore the old values of variables when it’s deactivated (without having to declare a bunch of -old-value variables).

  • Qudit314159@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    The function add-variable-watcher registers a callback that is invoked whenever the variable’s value changes. You could use it to save old values in a list or other data structure.