summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Robinson <casey@rampantmonkey.com>2018-10-20 15:41:46 -0400
committerCasey Robinson <casey@rampantmonkey.com>2018-10-20 15:41:47 -0400
commit0303a2e5d6cd975f973dee28a881187085fd89b9 (patch)
treeff12afb2785b11fe1f2c72717ccd4d0c7debe05d
parent3ba4c10d7268216f434349ecc73a1d4d10d25df0 (diff)
downloadrampantmonkey-0303a2e5d6cd975f973dee28a881187085fd89b9.tar.gz
rampantmonkey-0303a2e5d6cd975f973dee28a881187085fd89b9.tar.bz2
rampantmonkey-0303a2e5d6cd975f973dee28a881187085fd89b9.zip
minimal gdl syntax highlighting for my rust ggp presentation
-rw-r--r--emacsos/Makefile1
-rw-r--r--emacsos/emacsos-appearance.org5
-rw-r--r--emacsos/emacsos-gdl.org37
-rw-r--r--emacsos/emacsos.org130
4 files changed, 108 insertions, 65 deletions
diff --git a/emacsos/Makefile b/emacsos/Makefile
index d149350..74fdb29 100644
--- a/emacsos/Makefile
+++ b/emacsos/Makefile
@@ -4,6 +4,7 @@ INSTALL_DIR ?= $(EMACS_OS_DIR).emacs.d
el-modules = emacsos-core.el \
emacsos-appearance.el \
emacsos-git.el \
+ emacsos-gdl.el \
emacsos-idris.el \
emacsos-perl6.el \
emacsos-development.el \
diff --git a/emacsos/emacsos-appearance.org b/emacsos/emacsos-appearance.org
index 0c5f050..708a7f3 100644
--- a/emacsos/emacsos-appearance.org
+++ b/emacsos/emacsos-appearance.org
@@ -33,7 +33,10 @@ For both light and dark backgrounds I use base16 default color scheme.
(use-package base16-theme
:ensure t
:init
- (load-theme 'base16-default-dark t))
+ (load-theme 'base16-default-dark t)
+ (custom-set-faces
+ '(org-block
+ ((t (:foreground "#d8d8d8" ))))))
(use-package base16-theme
:ensure t
:init
diff --git a/emacsos/emacsos-gdl.org b/emacsos/emacsos-gdl.org
new file mode 100644
index 0000000..87532cf
--- /dev/null
+++ b/emacsos/emacsos-gdl.org
@@ -0,0 +1,37 @@
+#+TITLE: EmacsOS: GDL Module
+#+AUTHOR: Casey Robinson
+#+EMAIL: casey@rampantmonkey.com
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+(provide 'emacsos-gdl)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+(setq gdl-font-lock-keywords
+ (let* (
+ (x-keywords-regexp "role\\|init\\|<=\\|next\\|does\\|goal\\|terminal\\|legal\\|distinct")
+ (x-constants-regexp "true\\|false")
+ (x-variables-regexp "\\?[^ )(]+"))
+
+ `(
+ (,x-constants-regexp . font-lock-constant-face)
+ (,x-keywords-regexp . font-lock-keyword-face)
+ (,x-variables-regexp . font-lock-variable-name-face)
+ )))
+
+(define-derived-mode gdl-mode lisp-mode "gdl mode"
+ "Major mode for editing GDL (Game Description Language)…"
+
+ ;; code for syntax highlighting
+ (setq font-lock-defaults '((gdl-font-lock-keywords))))
+
+;; add the mode to the `features' list
+(provide 'gdl-mode)
+#+END_SRC
+
+#+RESULTS:
+: gdl-mode
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+(add-to-list 'auto-mode-list '("\\.gdl" . gdl-mode))
+#+END_SRC
diff --git a/emacsos/emacsos.org b/emacsos/emacsos.org
index dda1206..aed5ddc 100644
--- a/emacsos/emacsos.org
+++ b/emacsos/emacsos.org
@@ -161,70 +161,72 @@ Here we load all of the modules from the hard coded list.
In the future this shoud be generated from an org table.
#+BEGIN_SRC emacs-lisp :tangle init.el
- ;; Mitigate Bug#28350 in Emacs 25.2 and earlier.
- (eval-after-load "enriched"
- '(defun enriched-decode-display-prop (start end &optional param)
- (list start end)))
-
- (defvar after-emacsos-hook nil
- "Hooks to run after all of the EmacsOS has been loaded")
-
- (defvar emacsos/start-time (current-time)
- "Time Emacs was started.")
-
- ;; Installed by `make install`
- (add-to-list 'load-path "~/.emacs.d/emacsos/")
-
- (defmacro try-load (module)
- "Try to load the given module, logging an error if unable to load"
- `(condition-case ex
- (require ,module)
- ('error
- (message "EmacsOS: Unable to load [%s] module: %s" ,module ex))))
-
- ;; The EmacsOS modules
- (try-load 'emacsos-core)
- (try-load 'emacsos-appearance)
- (try-load 'emacsos-git)
- (try-load 'emacsos-development)
- (try-load 'emacsos-javascript)
- (try-load 'emacsos-elm)
- (try-load 'emacsos-golang)
- (try-load 'emacsos-idris)
- (try-load 'emacsos-perl6)
- (try-load 'emacsos-navigation)
- (try-load 'emacsos-notify)
- (try-load 'emacsos-rust)
- (try-load 'emacsos-swift)
- (try-load 'emacsos-org)
- (try-load 'emacsos-mail)
- (try-load 'emacsos-web)
-
-
- ;; Hooks
- (add-hook 'after-emacsos-hook
- (lambda ()
- (message "The Emacs Operating System has been loaded")))
-
- (defun emacsos/time-since-start ()
- (float-time (time-subtract (current-time)
- emacsos/start-time)))
-
- (add-hook 'after-emacsos-hook
- `(lambda ()
- (let ((elapsed (emacsos/time-since-start)))
- (message "Loading %s...done (%.3fs)"
- ,load-file-name elapsed))) t)
-
- (add-hook 'after-init-hook
- `(lambda ()
- (let ((elapsed (emacsos/time-since-start)))
- (message "Loading %s...done (%.3fs) [after-init]"
- ,load-file-name elapsed))) t)
-
- (run-hooks 'after-emacsos-hook)
-
- (setq initial-scratch-message ";; ╔═╗┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬\n;; ╚═╗│ ├┬┘├─┤ │ │ ├─┤\n;; ╚═╝└─┘┴└─┴ ┴ ┴ └─┘┴ ┴\n")
+;; Mitigate Bug#28350 in Emacs 25.2 and earlier.
+(eval-after-load "enriched"
+ '(defun enriched-decode-display-prop (start end &optional param)
+ (list start end)))
+
+(defvar after-emacsos-hook nil
+ "Hooks to run after all of the EmacsOS has been loaded")
+
+(defvar emacsos/start-time (current-time)
+ "Time Emacs was started.")
+
+;; Installed by `make install`
+(add-to-list 'load-path "~/.emacs.d/emacsos/")
+
+(defmacro try-load (module)
+ "Try to load the given module, logging an error if unable to load"
+ `(condition-case ex
+ (require ,module)
+ ('error
+ (message "EmacsOS: Unable to load [%s] module: %s" ,module ex))))
+
+;; The EmacsOS modules
+(try-load 'emacsos-core)
+(try-load 'emacsos-appearance)
+(try-load 'emacsos-git)
+(try-load 'emacsos-development)
+(try-load 'emacsos-javascript)
+(try-load 'emacsos-elm)
+(try-load 'emacsos-golang)
+(try-load 'emacsos-idris)
+(try-load 'emacsos-perl6)
+(try-load 'emacsos-navigation)
+(try-load 'emacsos-notify)
+(try-load 'emacsos-rust)
+(try-load 'emacsos-clojure)
+(try-load 'emacsos-swift)
+(try-load 'emacsos-org)
+(try-load 'emacsos-mail)
+(try-load 'emacsos-web)
+(try-load 'emacsos-gdl)
+
+
+;; Hooks
+(add-hook 'after-emacsos-hook
+ (lambda ()
+ (message "The Emacs Operating System has been loaded")))
+
+(defun emacsos/time-since-start ()
+ (float-time (time-subtract (current-time)
+ emacsos/start-time)))
+
+(add-hook 'after-emacsos-hook
+ `(lambda ()
+ (let ((elapsed (emacsos/time-since-start)))
+ (message "Loading %s...done (%.3fs)"
+ ,load-file-name elapsed))) t)
+
+(add-hook 'after-init-hook
+ `(lambda ()
+ (let ((elapsed (emacsos/time-since-start)))
+ (message "Loading %s...done (%.3fs) [after-init]"
+ ,load-file-name elapsed))) t)
+
+(run-hooks 'after-emacsos-hook)
+
+(setq initial-scratch-message ";; ╔═╗┌─┐┬─┐┌─┐┌┬┐┌─┐┬ ┬\n;; ╚═╗│ ├┬┘├─┤ │ │ ├─┤\n;; ╚═╝└─┘┴└─┴ ┴ ┴ └─┘┴ ┴\n")
#+END_SRC
Don't forget to turn off debugging.