mirror of
https://github.com/anoma/juvix.git
synced 2025-01-06 06:53:33 +03:00
c99c1825d1
This provides agda-input method (under the name `minijuvix`) to minijuvix-mode.
59 lines
1.6 KiB
EmacsLisp
59 lines
1.6 KiB
EmacsLisp
(require 'minijuvix-highlight)
|
|
(require 'minijuvix-input)
|
|
|
|
(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 (kbd "C-c C-l") 'minijuvix-load)
|
|
(define-key map (kbd "M-.") 'minijuvix-goto-definition)
|
|
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)
|
|
(set-input-method "minijuvix")
|
|
(setq-local comment-start "--")
|
|
|
|
(add-hook
|
|
'minijuvix-mode-hook
|
|
(lambda ()
|
|
(with-eval-after-load 'evil
|
|
(evil-define-key 'normal minijuvix-mode-map (kbd "SPC m l") 'minijuvix-load)
|
|
(evil-define-key 'normal minijuvix-mode-map (kbd "SPC m g") 'minijuvix-goto-definition)
|
|
(evil-normalize-keymaps))))
|
|
)
|
|
|
|
(defun minijuvix-clear-annotations ()
|
|
"Remove all annotations from the current buffer."
|
|
(interactive)
|
|
(remove-list-of-text-properties (point-min) (point-max)
|
|
'(face))
|
|
)
|
|
|
|
(defun minijuvix-load ()
|
|
"Load current buffer."
|
|
(interactive)
|
|
(save-buffer)
|
|
(minijuvix-clear-annotations)
|
|
(eval (read (shell-command-to-string (concat "minijuvix highlight " (buffer-file-name)))))
|
|
(save-buffer)
|
|
)
|
|
|
|
(defun minijuvix-goto-definition ()
|
|
"Goes to the definition of the symbol at point."
|
|
(interactive)
|
|
(let ((goto-info (get-text-property (point) 'minijuvix-goto)))
|
|
(if goto-info
|
|
(goto-char (cdr goto-info))
|
|
(message "No goto information found at cursor"))))
|
|
|
|
(provide 'minijuvix-mode)
|