lisp-mode-hook lisp-interaction-mode-hook makefile-mode-hook
inferior-lisp-mode-hook slime-repl-mode-hook
sml-mode-hook haskell-mode-hook erlang-mode-hook
- smalltalk-mode-hook rexx-mode-hook
+ smalltalk-mode-hook rexx-mode-hook lua-mode-hook
arm-assembler-mode-hook))
(global-font-lock-mode t)
(add-hook 'go-mode-hook 'mdw-fontify-go t)
(add-hook 'rust-mode-hook 'mdw-fontify-rust t)
+ (add-hook 'lua-mode-hook 'mdw-fontify-lua t)
(add-hook 'icon-mode-hook 'mdw-fontify-icon t)
(add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t)
"raise" "return" "struct" "try" "while" "with"
"yield")))
+;;;--------------------------------------------------------------------------
+;;; Lua programming style.
+
+(setq lua-indent-level 2)
+
+(defun mdw-fontify-lua ()
+
+ ;; Miscellaneous fiddling.
+ (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)")
+
+ ;; Now define fontification things.
+ (make-local-variable 'font-lock-keywords)
+ (let ((lua-keywords
+ (mdw-regexps "and" "break" "do" "else" "elseif" "end"
+ "false" "for" "function" "goto" "if" "in" "local"
+ "nil" "not" "or" "repeat" "return" "then" "true"
+ "until" "while")))
+ (setq font-lock-keywords
+ (list
+
+ ;; Set up the keywords defined above.
+ (list (concat "\\_<\\(" lua-keywords "\\)\\_>")
+ '(0 font-lock-keyword-face))
+
+ ;; At least numbers are simpler than C.
+ (list (concat "\\_<\\(" "0[xX]"
+ "\\(" "[0-9a-fA-F]+"
+ "\\(\\.[0-9a-fA-F]*\\)?"
+ "\\|" "\\.[0-9a-fA-F]+"
+ "\\)"
+ "\\([pP][-+]?[0-9]+\\)?"
+ "\\|" "\\(" "[0-9]+"
+ "\\(\\.[0-9]*\\)?"
+ "\\|" "\\.[0-9]+"
+ "\\)"
+ "\\([eE][-+]?[0-9]+\\)?"
+ "\\)")
+ '(0 mdw-number-face))
+
+ ;; And anything else is punctuation.
+ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
+ '(0 mdw-punct-face))))))
+
;;;--------------------------------------------------------------------------
;;; Icon programming style.