#190878 - 2008-12-05 07:01 PM
Editor question?
|
jpastin
Fresh Scripter
Registered: 2007-05-07
Posts: 6
|
At the risk of starting a flame war over which editor to use, does anyone know if someone has developed a major mode for Emacs for KiXtart?
|
|
Top
|
|
|
|
#190898 - 2008-12-08 09:39 AM
Re: Editor question?
[Re: jpastin]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
I've not heard of one.
If you are from a *nix background then there is an old syntax file that I wrote for VIM that is included in the distro - it's a couple of KiXtart versions old and has a couple of bugs due to syntax changes but I still use it daily.
For other examples of KiXtart friendly editors: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=118362
If you find that there is KiXtart support in Emacs (or you decide to cobble something together yourself) be sure to post the information.
|
|
Top
|
|
|
|
#191939 - 2009-01-27 11:04 PM
Re: Editor question?
[Re: Richard H.]
|
jpastin
Fresh Scripter
Registered: 2007-05-07
Posts: 6
|
Well I did come up with something. It is pretty rough code, but it works.
;;; ;;; kix-mode.el ;;; ;;; A major mode for GNU Emacs for KiXtart ;;; ;;; Jeremy Pastin ;;; 1-27-09 ;;; ;;; Version 1.0 ;;; ;;; ;;; This mode is freely distributable, under GPL ;;; Please send me any bug reports, bug fixes, or extensions, so that I can ;;; merge them into the Master Version ;;; ;;; jpastin@evilpc.com ;;; ;;; ;;; Code:
;;; Define Kix Commands (defvar kix-commands '("AND" "BEEP" "BIG" "BREAK" "CALL" "CASE" "CD" "CLS" "COLOR" "COOKIE1" "COPY" "DEBUG" "DEL" "DIM" "DISPLAY" "DO" "EACH" "ELSE" "ENDFUNCTION" "ENDIF" "ENDSELECT" "EXIT" "FLUSHKB" "FOR" "FUNCTION" "GET" "GETS" "GLOBAL" "GO" "GOSUB" "GOTO" "IF" "INCLUDE" "LOOP" "MD" "MOVE" "NEXT" "NOT" "OR" "PASSWORD" "PLAY" "QUIT" "RD" "REDIM" "RETURN" "RUN" "PRESERVE" "SELECT" "SET" "SETL" "SETM" "SETTIME" "SHELL" "SLEEP" "SMALL" "TO" "UNTIL" "USE" "WHILE") "Kix Commands.")
;;; Define Kix Functions (defvar kix-functions '("ABS" "ADDKEY" "ADDPRINTERCONNECTION" "ADDPROGRAMGROUP" "ADDPROGRAMITEM" "ASC" "ASCAN" "AT" "BACKUPEVENTLOG" "BOX" "CDBL" "CHR" "CINT" "CLEAREVENTLOG" "CLOSE" "COMPAREFILETIMES" "CREATEOBJECT" "CSTR" "DECTOHEX" "DELKEY" "DELPRINTERCONNECTION" "DELPROGRAMGROUP" "DELPROGRAMITEM" "DELTREE" "DELVALUE" "DIR" "ENUMGROUP" "ENUMIPINFO" "ENUMKEY" "ENUMLOCALGROUP" "ENUMVALUE" "EXECUTE" "EXIST" "EXISTKEY" "EXPANDENVIRONMENTVARS" "FIX" "FORMATNUMBER" "FREEFILEHANDLE" "GETDISKSPACE" "GETFILEATTR" "GETFILESIZE" "GETFILETIME" "GETFILEVERSION" "GETOBJECT" "IIF" "INGROUP" "INSTR" "INSTRREV" "INT" "ISDECLARED" "JOIN" "KBHIT" "KEYEXIST" "LCASE" "LEFT" "LEN" "LOADHIVE" "LOADKEY" "LOGEVENT" "LOGOFF" "LTRIM" "MEMORYSIZE" "MESSAGEBOX" "OPEN" "READLINE" "READPROFILESTRING" "READTYPE" "READVALUE" "REDIRECTOUTPUT" "RIGHT" "RND" "ROUND" "RTRIM" "SAVEKEY" "SENDKEYS" "SENDMESSAGE" "SETASCII" "SETCONSOLE" "SETDEFAULTPRINTER" "SETFILEATTR" "SETFOCUS" "SETOPTION" "SETSYSTEMSTATE" "SETTITLE" "SETWALLPAPER" "SHOWPROGRAMGROUP" "SHUTDOWN" "SIDTONAME" "SPLIT" "SRND" "SUBSTR" "TRIM" "UBOUND" "UCASE" "UNLOADHIVE" "VAL" "VARTYPE" "VARTYPENAME" "WRITELINE" "WRITEPROFILESTRING" "WRITEVALUE") "Kix Functions.")
;;; Define Kix Macros (defvar kix-macros '("ADDRESS" "BUILD" "COLOR" "COMMENT" "CPU" "CRLF" "CSD" "CURDIR" "DATE" "DAY" "DOMAIN" "DOS" "ERROR" "FULLNAME" "HOMEDIR" "HOMEDRIVE" "HOMESHARE" "HOSTNAME" "INWIN" "IPADDRESS0" "IPADDRESS1" "IPADDRESS2" "IPADDRESS3" "IPADDRESS" "KIX" "LANROOT" "LDOMAIN" "LDRIVE" "LM" "LOGONMODE" "LONGHOMEDIR" "LSERVER" "MAXPWAGE" "MDAYNO" "MHZ" "MONTHNO" "MONTH" "MSECS" "ONWOW64" "PID" "PRIMARYGROUP" "PRIV" "PRODUCTSUITE" "PRODUCTTYPE" "PWAGE" "RAS" "RESULT" "RSERVER" "SCRIPTDIR" "SCRIPTEXE" "SCRIPTNAME" "SERROR" "SID" "SITE" "STARTDIR" "SYSLANG" "TICKS" "TIME" "TSESSION" "USERID" "USERLANG" "WDAYNO" "WKSTA" "WUSERID" "YDAYNO" "YEAR") "Kix Macros.")
;;; Create variables containing regexps for each type (defvar kix-commands-regexp (regexp-opt kix-commands 'words)) (defvar kix-functions-regexp (concat (regexp-opt kix-functions 'words) "")) (defvar kix-macros-regexp (concat "@" (regexp-opt kix-macros 'words))) (defvar kix-variables-regexp "\$[a-z|1-9|A-Z|\.|\_]*")
;;; Set up commenting (defun kix-comment-dwim (arg) (interactive "*P") (require 'newcomment) (let ((deactivate-mark nil) (comment-start ";") (comment-end "")) (comment-dwim arg)))
;;; Override the default syntax table (defvar kix-syntax-table (let ((table (make-syntax-table)))
;;; To Fix '\' escaping things (modify-syntax-entry ?\\ ". 14")
;;; For single line comments that start with ';' (modify-syntax-entry ?\; "< b") (modify-syntax-entry ?\n "> b")
;;; For block comments /*...*/ (modify-syntax-entry ?\/ ". 14") (modify-syntax-entry ?* ". 23") table))
;;; Assign the various faces ;;; Order matters here (setq kix-font-lock-keywords `( (,kix-variables-regexp . font-lock-variable-name-face) (,kix-commands-regexp . font-lock-keyword-face) (,kix-functions-regexp . font-lock-function-name-face) (,kix-macros-regexp . font-lock-constant-face) ))
;;; Define the mode (define-derived-mode kix-mode fundamental-mode "Kix Mode" "A Major mode for editing KiXtart"
;;; Commit all of the font-lock changes ;;; The 'nil t' is required for case insensitivity in highlighting (setq font-lock-defaults '((kix-font-lock-keywords) nil t))
;;; Commit the syntax table changes (set-syntax-table kix-syntax-table)
;;; Set up commenting (define-key kix-mode-map [remap comment-dwim] 'kix-comment-dwim)
;;; Set up basic indenting (setq-default tab-width 4) (setq-default tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80)) (setq-default indent-tabs-mode nil)
)
Edited by jpastin (2009-01-28 12:01 AM)
|
|
Top
|
|
|
|
#191992 - 2009-01-30 04:40 PM
Re: Editor question?
[Re: jpastin]
|
jpastin
Fresh Scripter
Registered: 2007-05-07
Posts: 6
|
Modified a little bit for some fixes I missed in the original version:
;;; ;;; kix-mode.el ;;; ;;; A major mode for GNU Emacs for KiXtart ;;; ;;; Jeremy Pastin ;;; 1-27-09 ;;; ;;; Version 1.1 ;;; ;;; ;;; Changelog ;;; ;;; 1.0 - Initial write ;;; 1.1 - Fixed regexp for variables to include '0', added "IN" to keywords, ;;; modified syntax table to use ' as a string quote character. ;;; ;;; ;;; This mode is freely distributable, under GPL ;;; Please send me any bug reports, bug fixes, or extensions, so that I can ;;; merge them into the Master Version ;;; ;;; jpastin@evilpc.com ;;; ;;; ;;; Code:
;;; Define Kix Commands (defvar kix-commands '("AND" "BEEP" "BIG" "BREAK" "CALL" "CASE" "CD" "CLS" "COLOR" "COOKIE1" "COPY" "DEBUG" "DEL" "DIM" "DISPLAY" "DO" "EACH" "ELSE" "ENDFUNCTION" "ENDIF" "ENDSELECT" "EXIT" "FLUSHKB" "FOR" "FUNCTION" "GET" "GETS" "GLOBAL" "GO" "GOSUB" "GOTO" "IF" "IN" "INCLUDE" "LOOP" "MD" "MOVE" "NEXT" "NOT" "OR" "PASSWORD" "PLAY" "QUIT" "RD" "REDIM" "RETURN" "RUN" "PRESERVE" "SELECT" "SET" "SETL" "SETM" "SETTIME" "SHELL" "SLEEP" "SMALL" "TO" "UNTIL" "USE" "WHILE") "Kix Commands.")
;;; Define Kix Functions (defvar kix-functions '("ABS" "ADDKEY" "ADDPRINTERCONNECTION" "ADDPROGRAMGROUP" "ADDPROGRAMITEM" "ASC" "ASCAN" "AT" "BACKUPEVENTLOG" "BOX" "CDBL" "CHR" "CINT" "CLEAREVENTLOG" "CLOSE" "COMPAREFILETIMES" "CREATEOBJECT" "CSTR" "DECTOHEX" "DELKEY" "DELPRINTERCONNECTION" "DELPROGRAMGROUP" "DELPROGRAMITEM" "DELTREE" "DELVALUE" "DIR" "ENUMGROUP" "ENUMIPINFO" "ENUMKEY" "ENUMLOCALGROUP" "ENUMVALUE" "EXECUTE" "EXIST" "EXISTKEY" "EXPANDENVIRONMENTVARS" "FIX" "FORMATNUMBER" "FREEFILEHANDLE" "GETDISKSPACE" "GETFILEATTR" "GETFILESIZE" "GETFILETIME" "GETFILEVERSION" "GETOBJECT" "IIF" "INGROUP" "INSTR" "INSTRREV" "INT" "ISDECLARED" "JOIN" "KBHIT" "KEYEXIST" "LCASE" "LEFT" "LEN" "LOADHIVE" "LOADKEY" "LOGEVENT" "LOGOFF" "LTRIM" "MEMORYSIZE" "MESSAGEBOX" "OPEN" "READLINE" "READPROFILESTRING" "READTYPE" "READVALUE" "REDIRECTOUTPUT" "RIGHT" "RND" "ROUND" "RTRIM" "SAVEKEY" "SENDKEYS" "SENDMESSAGE" "SETASCII" "SETCONSOLE" "SETDEFAULTPRINTER" "SETFILEATTR" "SETFOCUS" "SETOPTION" "SETSYSTEMSTATE" "SETTITLE" "SETWALLPAPER" "SHOWPROGRAMGROUP" "SHUTDOWN" "SIDTONAME" "SPLIT" "SRND" "SUBSTR" "TRIM" "UBOUND" "UCASE" "UNLOADHIVE" "VAL" "VARTYPE" "VARTYPENAME" "WRITELINE" "WRITEPROFILESTRING" "WRITEVALUE") "Kix Functions.")
;;; Define Kix Macros (defvar kix-macros '("ADDRESS" "BUILD" "COLOR" "COMMENT" "CPU" "CRLF" "CSD" "CURDIR" "DATE" "DAY" "DOMAIN" "DOS" "ERROR" "FULLNAME" "HOMEDIR" "HOMEDRIVE" "HOMESHARE" "HOSTNAME" "INWIN" "IPADDRESS0" "IPADDRESS1" "IPADDRESS2" "IPADDRESS3" "IPADDRESS" "KIX" "LANROOT" "LDOMAIN" "LDRIVE" "LM" "LOGONMODE" "LONGHOMEDIR" "LSERVER" "MAXPWAGE" "MDAYNO" "MHZ" "MONTHNO" "MONTH" "MSECS" "ONWOW64" "PID" "PRIMARYGROUP" "PRIV" "PRODUCTSUITE" "PRODUCTTYPE" "PWAGE" "RAS" "RESULT" "RSERVER" "SCRIPTDIR" "SCRIPTEXE" "SCRIPTNAME" "SERROR" "SID" "SITE" "STARTDIR" "SYSLANG" "TICKS" "TIME" "TSESSION" "USERID" "USERLANG" "WDAYNO" "WKSTA" "WUSERID" "YDAYNO" "YEAR") "Kix Macros.")
;;; Create variables containing regexps for each type (defvar kix-commands-regexp (regexp-opt kix-commands 'words)) (defvar kix-functions-regexp (concat (regexp-opt kix-functions 'words) "")) (defvar kix-macros-regexp (concat "@" (regexp-opt kix-macros 'words))) (defvar kix-variables-regexp "\$[a-z|0-9|A-Z|\.|\_]*")
;;; Set up commenting (defun kix-comment-dwim (arg) (interactive "*P") (require 'newcomment) (let ((deactivate-mark nil) (comment-start ";") (comment-end "")) (comment-dwim arg)))
;;; Override the default syntax table (defvar kix-syntax-table (let ((table (make-syntax-table)))
;;; Use ' as a string quote character (modify-syntax-entry ?\' "\"") ;;; To Fix '\' escaping things (modify-syntax-entry ?\\ ". 14")
;;; For single line comments that start with ';' (modify-syntax-entry ?\; "< b") (modify-syntax-entry ?\n "> b")
;;; For block comments /*...*/ (modify-syntax-entry ?\/ ". 14") (modify-syntax-entry ?* ". 23") table))
;;; Assign the various faces ;;; Order matters here (setq kix-font-lock-keywords `( (,kix-variables-regexp . font-lock-variable-name-face) (,kix-commands-regexp . font-lock-keyword-face) (,kix-functions-regexp . font-lock-function-name-face) (,kix-macros-regexp . font-lock-constant-face) ))
;;; Define the mode (define-derived-mode kix-mode fundamental-mode "Kix Mode" "A Major mode for editing KiXtart"
;;; Commit all of the font-lock changes ;;; The 'nil t' is required for case insensitivity in highlighting (setq font-lock-defaults '((kix-font-lock-keywords) nil t))
;;; Commit the syntax table changes (set-syntax-table kix-syntax-table)
;;; Set up commenting (define-key kix-mode-map [remap comment-dwim] 'kix-comment-dwim)
;;; Set up basic indenting (setq-default tab-width 4) (setq-default tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80)) (setq-default indent-tabs-mode nil)
)
Also to invoke automatically for all .kix files, add the following to your .emacs file:
(load-library "kix-mode") (add-to-list 'auto-mode-alist '("\\.kix\\'" . kix-mode))
|
|
Top
|
|
|
|
#192742 - 2009-03-09 05:30 AM
Re: Editor question?
[Re: Richard H.]
|
jpastin
Fresh Scripter
Registered: 2007-05-07
Posts: 6
|
Just FYI for everyone, I'll be tracking changes to this here from now on.
Please feel free to send any tweaks or suggestions my way.
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|