Nsi-mode for emacs: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(work-around for missing nsi-point function) |
|||
Line 9: | Line 9: | ||
you try to indent a line, an error message will be displayed. | 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: | If you have python-mode.el loaded, you can work-around this problem by executing: | ||
Revision as of 22:05, 9 July 2007
Author: hansvandam (talk, contrib) |
Links
download nsi-mode.el here
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.