ankurdave / color-identifiers-mode

Emacs minor mode to highlight each source code identifier uniquely based on its name
308 stars 23 forks source link

Make buffer-local color-index even more buffer-local #110

Closed Hi-Angel closed 1 year ago

Hi-Angel commented 1 year ago

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.