-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfth-mode.el
30 lines (24 loc) · 838 Bytes
/
fth-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
(defvar fth-mode-hook nil)
(defvar fth-mode-map
(make-keymap)
"fth-mode keymap.")
;;;#autoload
(add-to-list 'auto-mode-alist '("\\.f" . fth-mode))
(defconst fth-font-lock-keywords-1
(list (regexp-opt (cons '("if" ":" ";" "then" "loop" "do" "?do" "while" "until" "begin") 'font-lock-builtin-face)))
"Highlighting for fth-mode.")
(defvar fth-mode-syntax-table
(let (st (make-syntax-table))
(modify-syntax-entry ?_ "w" st)
(modify-syntax-entry ?- "w" st)))
(defun fth-mode ()
"Major mode for editing Forth code."
(interactive)
(kill-all-local-variables)
(set-syntax-table fth-mode-syntax-table)
(use-local-map fth-mode-map)
(set (make-local-variable 'font-lock-defaults) '(fth-font-lock-keywords-1))
(setq major-mode 'fth-mode)
(setq mode-name "4th")
(run-hooks 'fth-mode-hook))
(provide 'fth-mode)