-
Notifications
You must be signed in to change notification settings - Fork 20
/
nqp-mode.el
74 lines (58 loc) · 2.49 KB
/
nqp-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; raku-mode.el --- Major mode for editing Raku code -*- lexical-binding: t; -*-
;; Copyright (C) 2015 Hinrik Örn Sigurðsson <[email protected]>
;; Author: Hinrik Örn Sigurðsson <[email protected]>
;; URL: https://github.com/hinrik/perl6-mode
;; Keywords: languages
;; Version: 0.1-git
;; Package-Requires: ((emacs "24.4"))
;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; GNU Emacs 24 major mode for editing Raku code.
;; Currently only provides very basic syntax highlighting.
;;; Code:
(defgroup raku nil
"Major mode for editing Raku code."
:prefix "raku-"
:group 'language)
(require 'raku-detect)
(require 'raku-font-lock)
(require 'raku-indent)
(require 'raku-imenu)
;;;###autoload
(define-derived-mode raku-mode prog-mode "Raku"
"Major mode for editing Raku code."
;; Syntaxification and font locking
(setq-local syntax-propertize-function #'raku-syntax-propertize)
(add-hook 'syntax-propertize-extend-region-functions #'syntax-propertize-multiline nil 'local)
(setq-local font-lock-syntactic-face-function #'raku-font-lock-syntactic-face)
(setq-local font-lock-defaults '(raku-font-lock-keywords nil nil))
;; Add imenu support for raku-mode. Note that imenu-generic-expression
;; is buffer-local, so we don't need a local-variable for it.
(add-hook 'raku-mode-hook 'imenu-add-menubar-index)
(setq imenu-generic-expression raku-imenu-generic-expression
imenu-case-fold-search nil)
;; Comments
(setq-local comment-start "#")
(setq-local comment-start-skip "#+ *")
(setq-local comment-use-syntax t)
(setq-local comment-end "")
;; Indentation
(smie-setup raku-smie-grammar #'raku-smie-rules
:forward-token #'raku-smie--forward-token
:backward-token #'raku-smie--backward-token))
(provide 'raku-mode)
;; Local Variables:
;; coding: utf-8
;; indent-tabs-mode: nil
;; End:
;;; raku-mode.el ends here