Add support for 'imenu' and 'which-func' to 'nsis-mode'.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 19 Jun 2011 23:02:11 +0300
changeset 650 d21c5ae9b7e6
parent 649 f7c0aea0de32
child 651 e71e91de1915
Add support for 'imenu' and 'which-func' to 'nsis-mode'.
.emacs-my
nsis-mode.el
--- a/.emacs-my	Sun Jun 19 17:05:50 2011 +0300
+++ b/.emacs-my	Sun Jun 19 23:02:11 2011 +0300
@@ -1328,7 +1328,7 @@
                       (imenu-add-menubar-index)
                       (run-hooks 'menu-bar-update-hook)
                       ) ))
-        (delq 'nsis-mode-hook my-devel-mode-hook-list))
+        my-devel-mode-hook-list)
   )
 
 ;;; ----------------------------------------------------------------
--- a/nsis-mode.el	Sun Jun 19 17:05:50 2011 +0300
+++ b/nsis-mode.el	Sun Jun 19 23:02:11 2011 +0300
@@ -72,6 +72,23 @@
    )
  )
 
+(setq nsis-imenu-generic-expression
+      '(
+        ("Defines"  "^!define[[:blank:]]+\\([[:word:]]+\\)" 1)
+        ("Sections"  "^Section[[:blank:]]+\\(-?[[:word:]]+\\)" 1)
+        ("Functions"  "^Function[[:blank:]]+\\([[:word:]]+\\)" 1)
+        ))
+
+(add-hook
+ 'nsis-mode-hook
+ (lambda ()
+   (setq imenu-generic-expression nsis-imenu-generic-expression)
+   ) )
+
+(eval-after-load 'which-func
+  '(add-to-list 'which-func-modes 'nsis-mode)
+  )
+
 (provide 'nsis-mode)
 
 ;;; nsis-mode.el ends here