Eliminate hook and add nsis-mode-set-comment-style.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 24 Jun 2011 18:06:06 +0300
changeset 659 3ab316034e6c
parent 658 b8a1ffa6408f
child 660 7abcc3f39fe9
Eliminate hook and add nsis-mode-set-comment-style.
nsis-mode.el
--- a/nsis-mode.el	Fri Jun 24 18:02:12 2011 +0300
+++ b/nsis-mode.el	Fri Jun 24 18:06:06 2011 +0300
@@ -16,8 +16,18 @@
 
 ;;; Code:
 
+(defun nsis-mode-modify-syntax-entry ()
+  (modify-syntax-entry ?_ "w")
+  (modify-syntax-entry ?. "w")
+  )
+
+(defun nsis-mode-set-comment-style ()
+  (setq comment-start "; ")
+  (setq comment-end "")
+  )
+
 ;;;###autoload
-(define-generic-mode 'nsis-mode
+(define-generic-mode nsis-mode
   (list ?\; ?\# '("/*" . "*/"))
   '(
     "Section" "SectionEnd" "SectionIn" "SectionGroup" "SectionGroupEnd" "Function" "FunctionEnd" "File"
@@ -60,17 +70,10 @@
     ("^[[:blank:]]*\\([[:alpha:].][[:alnum:]_.]*:\\)\\([^:]\\|$\\)" (1 'font-lock-function-name-face))
     ("^[[:blank:]]*\\(Function\\|Goto\\|Call\\)[[:blank:]]+\\([[:alnum:]_.]*\\)" (2 'font-lock-function-name-face))
     )
-  (list "\\.\\(nsi\\|nsh\\)$")
-  nil
+  '("\\.nsi\\'" "\\.nsh\\'")
+  '(nsis-mode-modify-syntax-entry nsis-mode-set-comment-style)
   "Generic mode for nsis files.")
 
-(defun nsis-mode-modify-syntax-entry ()
-  (modify-syntax-entry ?_ "w")
-  (modify-syntax-entry ?. "w")
-  )
-
-(add-hook 'nsis-mode-hook 'nsis-mode-modify-syntax-entry)
-
 (setq nsis-imenu-generic-expression
       '(
         ("Defines"  "^!define[[:blank:]]+\\([[:word:]]+\\)" 1)