Skip to content

Commit 2ad7563

Browse files
committed
Fix decl-scan, fixes #832
symbol-value doesn't work with lexical bindings enabled
1 parent 083c113 commit 2ad7563

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

haskell-decl-scan.el

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,24 @@ datatypes) in a Haskell file for the `imenu' package."
491491
(name (car name-posns))
492492
(posns (cdr name-posns))
493493
(start-pos (car posns))
494-
(type (cdr result))
494+
(type (cdr result)))
495495
;; Place `(name . start-pos)' in the correct alist.
496-
(sym (cdr (assq type
497-
'((variable . index-var-alist)
498-
(datatype . index-type-alist)
499-
(class . index-class-alist)
500-
(import . index-imp-alist)
501-
(instance . index-inst-alist))))))
502-
(set sym (cons (cons name start-pos) (symbol-value sym))))))
496+
(cl-case type
497+
(variable
498+
(setq index-var-alist
499+
(cl-acons name start-pos index-var-alist)))
500+
(datatype
501+
(setq index-type-alist
502+
(cl-acons name start-pos index-type-alist)))
503+
(class
504+
(setq index-class-alist
505+
(cl-acons name start-pos index-class-alist)))
506+
(import
507+
(setq index-imp-alist
508+
(cl-acons name start-pos index-imp-alist)))
509+
(instance
510+
(setq index-inst-alist
511+
(cl-acons name start-pos index-inst-alist)))))))
503512
;; Now sort all the lists, label them, and place them in one list.
504513
(message "Sorting declarations in %s..." bufname)
505514
(when index-type-alist

0 commit comments

Comments
 (0)