Skip to content

Commit 0e757d2

Browse files
committed
Implement initial prototype for morganey-mode
1 parent 8c955bc commit 0e757d2

3 files changed

Lines changed: 122 additions & 0 deletions

File tree

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
# Created by https://www.gitignore.io/api/emacs
3+
4+
### Emacs ###
5+
# -*- mode: gitignore; -*-
6+
*~
7+
\#*\#
8+
/.emacs.desktop
9+
/.emacs.desktop.lock
10+
*.elc
11+
auto-save-list
12+
tramp
13+
.\#*
14+
15+
# Org-mode
16+
.org-id-locations
17+
*_archive
18+
19+
# flymake-mode
20+
*_flymake.*
21+
22+
# eshell files
23+
/eshell/history
24+
/eshell/lastdir
25+
26+
# elpa packages
27+
/elpa/
28+
29+
# reftex files
30+
*.rel
31+
32+
# AUCTeX auto folder
33+
/auto/
34+
35+
# cask packages
36+
.cask/
37+
dist/
38+
39+
# Flycheck
40+
flycheck_*.el
41+
42+
# server auth directory
43+
/server/
44+
45+
# projectiles files
46+
.projectile

Cask

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(source gnu)
2+
(source melpa)
3+
4+
(package-file "morganey-mode.el")
5+
6+
(files "*.el")

morganey-mode.el

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
;;; morganey-mode.el --- Major mode for editing Morganey files -*- lexical-binding: t -*-
2+
3+
;; Copyright (C) 2016 Alexey Kutepov <reximkut@gmail.com>
4+
5+
;; Author: Alexey Kutepov <reximkut@gmail.com>
6+
;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
7+
;; URL: https://github.com/morganey-lang/morganey-mode
8+
;; Version: 0.0.1
9+
;; Package-Requires: ((emacs "24.4"))
10+
11+
;; Permission is hereby granted, free of charge, to any person
12+
;; obtaining a copy of this software and associated documentation
13+
;; files (the "Software"), to deal in the Software without
14+
;; restriction, including without limitation the rights to use, copy,
15+
;; modify, merge, publish, distribute, sublicense, and/or sell copies
16+
;; of the Software, and to permit persons to whom the Software is
17+
;; furnished to do so, subject to the following conditions:
18+
19+
;; The above copyright notice and this permission notice shall be
20+
;; included in all copies or substantial portions of the Software.
21+
22+
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23+
;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24+
;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25+
;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26+
;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27+
;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28+
;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29+
;; SOFTWARE.
30+
31+
;;; Commentary:
32+
33+
;; Major mode for editing source files written in Morganey programming
34+
;; language: https://github.com/morganey-lang/Morganey
35+
36+
;;; Code:
37+
38+
(defconst morganey--keywords
39+
(list (cons "load" font-lock-keyword-face)
40+
(cons ":=" font-lock-keyword-face)
41+
(cons "\\\\" font-lock-keyword-face)
42+
(cons "λ" font-lock-keyword-face)))
43+
44+
(defconst morganey--syntax-table
45+
(let ((table (make-syntax-table)))
46+
(modify-syntax-entry ?/ ". 124" table)
47+
(modify-syntax-entry ?* ". 23b" table)
48+
(modify-syntax-entry ?\n ">" table)
49+
table))
50+
51+
(define-derived-mode morganey-mode prog-mode "Morganey"
52+
"Major mode for editing Morganey files"
53+
(set-syntax-table morganey--syntax-table)
54+
55+
(setq font-lock-defaults '(morganey--keywords))
56+
(make-local-variable 'comment-start)
57+
(setq comment-start "// ")
58+
(make-local-variable 'comment-end)
59+
(setq comment-end "")
60+
(make-local-variable 'comment-start-skip)
61+
(setq comment-start-skip "//[ \t]*")
62+
(make-local-variable 'comment-column)
63+
(setq comment-column 0))
64+
65+
;;;###autoload
66+
(add-to-list 'auto-mode-alist '("\\.mgn\\'" . morganey-mode))
67+
68+
(provide 'morganey-mode)
69+
70+
;;; morganey-mode.el ends here

0 commit comments

Comments
 (0)