summaryrefslogtreecommitdiffhomepage
path: root/contrib/emacs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-09-11 02:12:47 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-09-11 02:12:47 +0200
commit5ca7f75d004574b2ce4f94a6820546d3efef92fe (patch)
tree920530fb0c04cc5c4c750c17ee9a65eee77d1868 /contrib/emacs
parent25987f87e61e6fd25445ea15a3a6e149e27b1c91 (diff)
Split contrib/ into emacs/ and vim/
Diffstat (limited to 'contrib/emacs')
-rw-r--r--contrib/emacs/mintage-mode.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/emacs/mintage-mode.el b/contrib/emacs/mintage-mode.el
new file mode 100644
index 0000000..8cfe036
--- /dev/null
+++ b/contrib/emacs/mintage-mode.el
@@ -0,0 +1,26 @@
+;;; mintage-mode.el --- Major mode for mintage data files -*- lexical-binding: t; -*-
+
+(defconst mintage--number (rx (or digit ?.)))
+(defconst mintage--string (rx "\"" (*? (not "\"")) "\""))
+(defconst mintage--unknown (rx ??))
+(defconst mintage--comment (rx bol (* space) ?# (* any)))
+(defconst mintage--year (rx bol (= 4 digit) (? ?- (+ (not space)))))
+
+(defun mintage--font-lock-keywords ()
+ `((,mintage--year . font-lock-constant-face)
+ (,mintage--number . 'font-lock-number-face)
+ (,mintage--string . font-lock-string-face)
+ (,mintage--comment . font-lock-comment-face)
+ (,mintage--unknown . font-lock-warning-face)))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist (cons "mintages/[a-z]\\{2\\}\\'" 'mintage-mode))
+
+;;;###autoload
+(define-derived-mode mintage-mode conf-mode "Mintage"
+ "Major mode for editing euro-cash.eu mintage files"
+ (setq comment-start "#"
+ comment-end "")
+ (setq font-lock-defaults '(mintage--font-lock-keywords)))
+
+(provide 'mintage-mode)