1
1
mirror of https://github.com/anoma/juvix.git synced 2024-09-20 13:07:20 +03:00

[minijuvix-mode] add minijuvix-mode and basic description in the readme

This commit is contained in:
Jan Mas Rovira 2022-04-01 11:15:32 +02:00
parent 9708dd3fe3
commit 6f2588c165
3 changed files with 99 additions and 0 deletions

View File

@ -67,6 +67,24 @@ It is required at least 8GB RAM for =stack= installation.
$ stack test
#+end_src
** Emacs mode
There is an emacs mode available for MiniJuvix. Currently it supports syntax
highlighting for well-scoped modules. It is a work in progress.
To install it add the following lines to your emacs configuration file:
#+begin_src elisp
(push "/path/to/minijuvix/minijuvix-mode/" load-path)
(require 'minijuvix-mode)
#+end_src
Also, =minijuvix= must be installed in the path.
The MiniJuvix major mode will be activated automatically for =.mjuvix= files.
*** Keybindings
| Key | Function Name | Description |
|---------+----------------+-------------------------------------------------------|
| C-c C-l | minijuvix-load | Runs the scoper and adds semantic syntax highlighting |
** Community
We would love to hear what you think of MiniJuvix! Join us on

View File

@ -0,0 +1,52 @@
(require 'font-lock)
(defgroup minijuvix-highlight nil
"Syntax highlighting for MiniJuvix."
:group 'minijuvix)
(defgroup agda2-highlight-faces nil
"Faces used to highlight MiniJuvix code."
:group 'minijuvix-highlight)
(defface minijuvix-highlight-keyword-face
'((((background light))
(:foreground "#399ee6"))
(((background dark))
(:foreground "#81a1c1")))
"The face used for keywords."
:group 'minijuvix-highlight-faces)
(defface minijuvix-highlight-function-face
'((((background light))
(:foreground "#f2ae49"))
(((background dark))
(:foreground "#ebcb8b")))
"The face used for functions."
:group 'minijuvix-highlight-faces)
(defface minijuvix-highlight-inductive-face
'((((background light))
(:foreground "#86b300"))
(((background dark))
(:foreground "#a3be8c")))
"The face used for inductive types."
:group 'minijuvix-highlight-faces)
(defface minijuvix-highlight-constructor-face
'((((background light))
(:foreground "#a37acc"))
(((background dark))
(:foreground "#b48ead")))
"The face used for constructors."
:group 'minijuvix-highlight-faces)
(defface minijuvix-highlight-axiom-face
'((((background light))
(:foreground "#f07171"))
(((background dark))
(:foreground "#bf616a")))
"The face used for axioms."
:group 'minijuvix-highlight-faces)
(provide 'minijuvix-highlight)

View File

@ -0,0 +1,29 @@
(require 'minijuvix-highlight)
(defgroup minijuvix nil
"Major mode for MiniJuvix files."
:group 'languages)
(defvar minijuvix-mode-map
(let ((map (make-sparse-keymap))
(menu-map (make-sparse-keymap "MiniJuvix")))
(define-key map "\C-c\C-l" 'minijuvix-load)
map)
"Keymap for MiniJuvix mode.")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.m?juvix\\'" . minijuvix-mode))
(define-derived-mode minijuvix-mode prog-mode "MiniJuvix"
(font-lock-mode 0)
)
(defun minijuvix-load ()
"Load current buffer."
(interactive)
(eval (read (shell-command-to-string (concat "minijuvix highlight " (buffer-file-name)))))
)
(provide 'minijuvix-mode)