Apparently, the fact it's declared with defvar-local is not enough. Presumably, (make-hash-table) is only executed when the ELisp file gets loaded, but upon further enabling/disabling the mode it's not. So the hash-table is created just once, and re-used every time mode loads. As a result, this "buffer-local" variable implicitly becomes a global one.
Work around that by defaulting the variable to nil and then initializing it inside the mode definition.
Apparently, the fact it's declared with
defvar-local
is not enough. Presumably, (make-hash-table) is only executed when the ELisp file gets loaded, but upon further enabling/disabling the mode it's not. So the hash-table is created just once, and re-used every time mode loads. As a result, this "buffer-local" variable implicitly becomes a global one.Work around that by defaulting the variable to nil and then initializing it inside the mode definition.