Nsi-mode for emacs: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.)
mNo edit summary
 
(6 intermediate revisions by 6 users not shown)
Line 3: Line 3:
== Links ==
== Links ==
download nsi-mode.el [http://www.xs4all.nl/%7Ehdam/nsi-mode.el here]
download nsi-mode.el [http://www.xs4all.nl/%7Ehdam/nsi-mode.el here]
Alternatively nsis-mode [http://www.emacswiki.org/emacs/nsis-mode.el 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):
<highlight-nsis>
(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))))
</highlight-nsis>
If you have python-mode.el loaded, you can work-around this problem by executing:
(defalias 'nsi-point 'py-point)


== Description ==
== Description ==
Line 8: Line 45:


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


and put nsi-mode.el somewhere in your load-path variable
and put nsi-mode.el somewhere in your load-path variable
Line 18: Line 55:
then you can compile your nsi files in emacs with Ctrl-F9.
then you can compile your nsi files in emacs with Ctrl-F9.


[[Category:Related Software]]
[[Category:Syntax_Highlighting]]

Latest revision as of 09:45, 1 June 2013

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.