Nsi-mode for emacs

From NSIS Wiki
Jump to navigationJump to search
Author: hansvandam (talk, contrib)


Links

download nsi-mode.el here

Alternatively nsis-mode here from Emacs wiki (which seems to work well with Emacs 23.3 for me)

Warning

This mode currently does not work properly. It requires a "nsi-point" function which is not defined anywhere. It does do syntax highlighting though. But everytime you try to indent a line, an error message will be displayed.

You can use the following for nsi-point (modified from py-point):

(defsubst nsi-point (position)
  "Returns the value of point at certain commonly referenced POSITIONs.
POSITION can be one of the following symbols:
  bol  -- beginning of line    eol  -- end of line           bod  -- beginning of def or class
  eod  -- end of def or class  bob  -- beginning of buffer   eob  -- end of buffer
  boi  -- back to indentation  bos  -- beginning of statement
This function does not modify point or mark."
  (let ((here (point)))
    (cond
     ((eq position 'bol) (beginning-of-line))
     ((eq position 'eol) (end-of-line))
     ((eq position 'bod) (nsi-beginning-of-def-or-class))
     ((eq position 'eod) (nsi-end-of-def-or-class))
     ;; Kind of funny, I know, but useful for py-up-exception.
     ((eq position 'bob) (beginning-of-buffer))
     ((eq position 'eob) (end-of-buffer))
     ((eq position 'boi) (back-to-indentation))
     ((eq position 'bos) (nsi-goto-initial-line))
     (t (error "Unknown buffer position requested: %s" position))
     )
    (prog1
	(point)
      (goto-char here))))

If you have python-mode.el loaded, you can work-around this problem by executing:

(defalias 'nsi-point 'py-point)

Description

just add the following lines (with the right paths) to your .emacs file:

(autoload 'nsi-mode "nsi-mode" "nsi editing mode." t)
(add-to-list 'auto-mode-alist '("\\.nsi$" . nsi-mode))

and put nsi-mode.el somewhere in your load-path variable e.g. I have a load path set as :

(defvar extra-stuff-path "c:/extra" "defines the extra path")
(setq load-path (cons extra-stuff-path load-path)

then you can compile your nsi files in emacs with Ctrl-F9.