From d832f2ca2ffbd16858feb1a96be5a3059620f418 Mon Sep 17 00:00:00 2001
From: Stephen D <webmaster@scd31.com>
Date: Tue, 11 Mar 2025 18:33:56 -0400
Subject: [PATCH] beginnings of emacs mode

---
 lpp-mode.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 lpp-mode.el

diff --git a/lpp-mode.el b/lpp-mode.el
new file mode 100644
index 0000000..8707d3e
--- /dev/null
+++ b/lpp-mode.el
@@ -0,0 +1,46 @@
+(defvar lpp-mode-hook nil)
+
+(defvar lpp-mode-map
+  (let ((map (make-keymap)))
+    (define-key map (kbd "C-\\") (lambda () (interactive) (insert "\\")))
+    (define-key map (kbd "\\") "λ")
+    map)
+  "Keymap for LPP major mode")
+
+(defun lpp-indent-line ()) ; todo
+
+(defconst lpp--token-syntax-types
+  '((
+     ("#.*" . font-lock-comment-face)
+     ("$\\w*" . font-lock-variable-name-face)
+     ("λ\\w*" . font-lock-builtin-face)
+     )nil nil nil))
+
+(defconst lpp--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?\/  "<" table)
+    (modify-syntax-entry ?\n  ">" table)
+    table)
+  "Syntax table for lpp-mode.")
+
+;;;###autoload
+(defgroup lpp nil
+  "Major mode for editing λ++ code."
+  :prefix 'lpp
+  :group 'languages)
+
+;;;###autoload
+(define-derived-mode lpp-mode prog-mode "lpp"
+  "Major mode for editing λ++ source code."
+  :syntax-table lpp--syntax-table
+  :group 'lpp
+  (setq-local font-lock-defaults lpp--token-syntax-types)
+  (use-local-map lpp-mode-map)
+  (set (make-local-variable 'indent-line-function) 'lpp-indent-line)  
+  (run-hooks 'lpp-mode-hook))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.lpp\\'" . lpp-mode))
+;;;###autoload
+(add-to-list 'interpreter-mode-alist '("lpp" . lpp-mode))
+(provide 'lpp-mode)
-- 
GitLab