--- /dev/null
+;=============================================================================
+; bbs-mode.el = Emacs major mode for editing bbi script files (.bbs).
+
+; Add bbs listfile names to the mode list.
+(setq auto-mode-alist
+ (append
+ '(("\\.bbs\\'" . bbs-mode))
+ auto-mode-alist))
+; Note, add the above setq auto-mode-alist to your .emacs
+; along with the following to have the mode loaded when
+; a *.mac file is loaded in emacs.
+; (autoload 'bbs-mode "bbs-mode.el" t)
+
+; Default indentation increment.
+(defvar bbs-tab-width 2)
+
+; Define keyword highlighting.
+(defconst bbs-font-lock-defaults
+ (list
+ (regexp-opt '(
+ "author"
+ "config"
+ "connect"
+ "define"
+ "delete"
+ "description"
+ "endefine"
+ "endpackage"
+ "exec"
+ "graph"
+ "help"
+ "include"
+ "input"
+ "load"
+ "message"
+ "new"
+ "output"
+ "package"
+ "print"
+ "quit"
+ "reset"
+ "set"
+ "unload"
+ ) t )
+ "Highlighting expressions for bbs mode.")
+ )
+
+; Define a variable to hold the syntax table.
+(defvar bbs-mode-syntax-table nil "Syntax table for bbs-mode.")
+
+; If bbs mode file is reloaded, we want the syntax table to be
+; regenerated when bbs-mode is called.
+(setq bbs-mode-syntax-table nil)
+
+; Let users hook to bbs mode.
+(defvar bbs-mode-hook nil)
+
+; Mode startup function.
+(defun bbs-mode ()
+ "Major mode for editing bbtk script files (.bbs)."
+ (interactive)
+ (kill-all-local-variables)
+ (setq major-mode 'bbs-mode)
+ (setq mode-name "bbs")
+ ; Create the syntax table
+ (setq bbs-mode-syntax-table (make-syntax-table))
+ (set-syntax-table bbs-mode-syntax-table)
+ (modify-syntax-entry ?_ "w" bbs-mode-syntax-table)
+ (modify-syntax-entry ?\( "()" bbs-mode-syntax-table)
+ (modify-syntax-entry ?\) ")(" bbs-mode-syntax-table)
+ (modify-syntax-entry ?# "<" bbs-mode-syntax-table)
+ (modify-syntax-entry ?\n ">" bbs-mode-syntax-table)
+
+ ; Setup font-lock mode.
+ (make-local-variable 'font-lock-defaults)
+ (setq font-lock-defaults '(bbs-font-lock-defaults))
+
+ ; Setup comment syntax.
+ (make-local-variable 'comment-start)
+ (setq comment-start "#")
+
+ (run-hooks 'bbs-mode-hook))
+
+; This file provides bbs-mode.
+(provide 'bbs-mode)
+