purescript-emacs / purescript-mode

Emacs major mode and related tools for Purescript
20 stars 10 forks source link

Simplify `purescript-ds-create-imenu-index` with hashtable #27

Open Hi-Angel opened 1 week ago

Hi-Angel commented 1 week ago

The function has implemented a poor man's hash table by manually enlisting keys and then jumping through the hoops by fetching them from one place, converting values to symbols to values… In particular, it was using symbol-value to map a symbol to its value, however the symbol was a local variable, and symbol-value doesn't work with them under lexical-binding, which the file was converted to since commit 9a9f550.

So fix the regression and simplify the code at the same time.

Fixes: https://github.com/purescript-emacs/purescript-mode/issues/25

Hi-Angel commented 1 week ago

…oh, and I've grepped for other usages of symbol-value, it seems the only one that was referring to local symbols, so we should be fine in that regard.

Hi-Angel commented 3 days ago

UPD: changed for compatibility with older Emacs versions per discussion here

Hi-Angel commented 3 days ago

Well, and now it fails to compile on snapshot due to "obsolete macro"…

Hi-Angel commented 3 days ago

Okay, I added a wrapper macro to silence the warning, it builds now on snapshot without warnings.