From 2ad7563d77a04d4f529bf3e3e1bcbdcdcf82c5a8 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Sat, 29 Aug 2015 19:13:52 +0200 Subject: [PATCH] Fix decl-scan, fixes #832 symbol-value doesn't work with lexical bindings enabled --- haskell-decl-scan.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/haskell-decl-scan.el b/haskell-decl-scan.el index e88df945d..57c3faaec 100644 --- a/haskell-decl-scan.el +++ b/haskell-decl-scan.el @@ -491,15 +491,24 @@ datatypes) in a Haskell file for the `imenu' package." (name (car name-posns)) (posns (cdr name-posns)) (start-pos (car posns)) - (type (cdr result)) + (type (cdr result))) ;; Place `(name . start-pos)' in the correct alist. - (sym (cdr (assq type - '((variable . index-var-alist) - (datatype . index-type-alist) - (class . index-class-alist) - (import . index-imp-alist) - (instance . index-inst-alist)))))) - (set sym (cons (cons name start-pos) (symbol-value sym)))))) + (cl-case type + (variable + (setq index-var-alist + (cl-acons name start-pos index-var-alist))) + (datatype + (setq index-type-alist + (cl-acons name start-pos index-type-alist))) + (class + (setq index-class-alist + (cl-acons name start-pos index-class-alist))) + (import + (setq index-imp-alist + (cl-acons name start-pos index-imp-alist))) + (instance + (setq index-inst-alist + (cl-acons name start-pos index-inst-alist))))))) ;; Now sort all the lists, label them, and place them in one list. (message "Sorting declarations in %s..." bufname) (when index-type-alist