nsis-mode.el
changeset 659 3ab316034e6c
parent 651 e71e91de1915
child 661 95d6a3c48afd
equal deleted inserted replaced
658:b8a1ffa6408f 659:3ab316034e6c
    14 ;;
    14 ;;
    15 ;; Very pure syntax highlighting.
    15 ;; Very pure syntax highlighting.
    16 
    16 
    17 ;;; Code:
    17 ;;; Code:
    18 
    18 
       
    19 (defun nsis-mode-modify-syntax-entry ()
       
    20   (modify-syntax-entry ?_ "w")
       
    21   (modify-syntax-entry ?. "w")
       
    22   )
       
    23 
       
    24 (defun nsis-mode-set-comment-style ()
       
    25   (setq comment-start "; ")
       
    26   (setq comment-end "")
       
    27   )
       
    28 
    19 ;;;###autoload
    29 ;;;###autoload
    20 (define-generic-mode 'nsis-mode
    30 (define-generic-mode nsis-mode
    21   (list ?\; ?\# '("/*" . "*/"))
    31   (list ?\; ?\# '("/*" . "*/"))
    22   '(
    32   '(
    23     "Section" "SectionEnd" "SectionIn" "SectionGroup" "SectionGroupEnd" "Function" "FunctionEnd" "File"
    33     "Section" "SectionEnd" "SectionIn" "SectionGroup" "SectionGroupEnd" "Function" "FunctionEnd" "File"
    24     "SectionSetFlags" "SectionGetFlags" "SectionSetText" "SectionGetText" "SectionSetInstTypes" "SectionGetInstTypes" "SectionSetSize" "SectionGetSize" "SetCurInstType" "GetCurInstType" "InstTypeSetText" "InstTypeGetText"
    34     "SectionSetFlags" "SectionGetFlags" "SectionSetText" "SectionGetText" "SectionSetInstTypes" "SectionGetInstTypes" "SectionSetSize" "SectionGetSize" "SetCurInstType" "GetCurInstType" "InstTypeSetText" "InstTypeGetText"
    25     "Name" "ShowInstDetails" "Caption"
    35     "Name" "ShowInstDetails" "Caption"
    58     ("!\\(insertmacro\\|define\\|ifdef\\|ifndef\\|else\\|endif\\|echo\\|verbose\\|include\\|macroend\\|macro\\|undef\\|packhdr\\|warning\\|error\\)" (1 'font-lock-builtin-face))
    68     ("!\\(insertmacro\\|define\\|ifdef\\|ifndef\\|else\\|endif\\|echo\\|verbose\\|include\\|macroend\\|macro\\|undef\\|packhdr\\|warning\\|error\\)" (1 'font-lock-builtin-face))
    59     ("$[({]?\\([A-Za-z0-9_]+\\)[)}]?" (1 'font-lock-variable-name-face))
    69     ("$[({]?\\([A-Za-z0-9_]+\\)[)}]?" (1 'font-lock-variable-name-face))
    60     ("^[[:blank:]]*\\([[:alpha:].][[:alnum:]_.]*:\\)\\([^:]\\|$\\)" (1 'font-lock-function-name-face))
    70     ("^[[:blank:]]*\\([[:alpha:].][[:alnum:]_.]*:\\)\\([^:]\\|$\\)" (1 'font-lock-function-name-face))
    61     ("^[[:blank:]]*\\(Function\\|Goto\\|Call\\)[[:blank:]]+\\([[:alnum:]_.]*\\)" (2 'font-lock-function-name-face))
    71     ("^[[:blank:]]*\\(Function\\|Goto\\|Call\\)[[:blank:]]+\\([[:alnum:]_.]*\\)" (2 'font-lock-function-name-face))
    62     )
    72     )
    63   (list "\\.\\(nsi\\|nsh\\)$")
    73   '("\\.nsi\\'" "\\.nsh\\'")
    64   nil
    74   '(nsis-mode-modify-syntax-entry nsis-mode-set-comment-style)
    65   "Generic mode for nsis files.")
    75   "Generic mode for nsis files.")
    66 
       
    67 (defun nsis-mode-modify-syntax-entry ()
       
    68   (modify-syntax-entry ?_ "w")
       
    69   (modify-syntax-entry ?. "w")
       
    70   )
       
    71 
       
    72 (add-hook 'nsis-mode-hook 'nsis-mode-modify-syntax-entry)
       
    73 
    76 
    74 (setq nsis-imenu-generic-expression
    77 (setq nsis-imenu-generic-expression
    75       '(
    78       '(
    76         ("Defines"  "^!define[[:blank:]]+\\([[:word:]]+\\)" 1)
    79         ("Defines"  "^!define[[:blank:]]+\\([[:word:]]+\\)" 1)
    77         ("Sections"  "^Section[[:blank:]]+\\(-?[[:word:]]+\\)" 1)
    80         ("Sections"  "^Section[[:blank:]]+\\(-?[[:word:]]+\\)" 1)