+;;;--------------------------------------------------------------------------
+;;; Ada programming configuration.
+
+(setq ada-auto-case nil
+ ada-broken-indent 2
+ ada-broken-decl-indent 2
+ ada-indent 2
+ ada-indent-handle-comment-special t
+ ada-indent-record-rel-type 2
+ ada-indent-return 2
+ ada-fill-comment-prefix "-- "
+ ada-fill-comment-postfix ""
+ ada-label-indent -2
+ ada-language-version 'ada2005
+ ada-when-indent 2)
+
+(defun mdw-fontify-ada ()
+
+ ;; Set the fill prefix.
+ (mdw-standard-fill-prefix "\\([ \t]*--+[ \t]*\\)")
+ (setq fill-paragraph-function nil)
+
+ ;; Fontify keywords and things.
+ (make-local-variable 'font-lock-keywords)
+ (let ((ada-keywords
+ (mdw-regexps "abort" "abs" "abstract" "accept" "access" "aliased"
+ "all" "and" "array" "at"
+ "begin" "body"
+ "case" "constant"
+ "declare" "delay" "delta" "digits" "do"
+ "else" "elsif" "end" "entry" "exception" "exit"
+ "for" "function"
+ "generic" "goto"
+ "if" "in" "interface" "is"
+ "limited" "loop"
+ "mod"
+ "new" "not" "null"
+ "of" "or" "others" "out" "overriding"
+ "package" "parallel" "pragma" "private" "procedure"
+ "protected"
+ "raise" "range" "record" "rem" "renames" "requeue"
+ "return" "reverse"
+ "select" "separate" "some" "subtype" "synchronized"
+ "tagged" "task" "terminate" "then" "type"
+ "until" "use"
+ "when" "while" "with"
+ "xor")))
+ (setq font-lock-keywords
+ (list
+
+ ;; Handle the keywords defined above.
+ (list (concat "\\_<\\(" ada-keywords "\\)\\_>")
+ '(0 font-lock-keyword-face))
+
+ ;; Handle numbers too.
+ (list (concat "\\_<"
+ "[0-9]+\\(_[0-9]+\\)*"
+ "\\(" "#"
+ "[0-9a-f]+\\(_[0-9a-f]+\\)*"
+ "\\(" "\\."
+ "[0-9a-f]+\\(_[0-9a-f]+\\)*" "\\)?"
+ "#"
+ "\\(" "e" "[-+]?"
+ "[0-9]+\\(_[0-9]+\\)*" "\\_>" "\\)?"
+ "\\|" "\\(" "\\." "[0-9]+\\(_[0-9]+\\)*" "\\)?"
+ "\\(" "e" "[-+]?"
+ "[0-9]+\\(_[0-9]+\\)*" "\\)?"
+ "\\_>"
+ "\\)")
+ '(0 mdw-number-face))
+
+ ;; And anything else is punctuation.
+ (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
+ '(0 mdw-punct-face)))
+ ;font-lock-syntactic-face-function nil
+ )))
+
+(progn
+ (add-hook 'ada-mode-hook 'mdw-misc-mode-config t)
+ (add-hook 'ada-mode-hook 'mdw-fontify-ada t))
+