blob: 6ad47d5c7e58aa93da72cd5777ef579aff885b6f [file] [log] [blame]
swissChili94f1e762022-01-29 21:55:45 -08001(defvar fth-mode-hook nil)
2
3(defvar fth-mode-map
4 (make-keymap)
5 "fth-mode keymap.")
6
7;;;#autoload
8(add-to-list 'auto-mode-alist '("\\.f" . fth-mode))
9
10(defconst fth-font-lock-keywords-1
11 (list (regexp-opt (cons '("if" ":" ";" "then" "loop" "do" "?do" "while" "until" "begin") 'font-lock-builtin-face)))
12 "Highlighting for fth-mode.")
13
14(defvar fth-mode-syntax-table
15 (let (st (make-syntax-table))
16 (modify-syntax-entry ?_ "w" st)
17 (modify-syntax-entry ?- "w" st)))
18
19(defun fth-mode ()
20 "Major mode for editing Forth code."
21 (interactive)
22 (kill-all-local-variables)
23 (set-syntax-table fth-mode-syntax-table)
24 (use-local-map fth-mode-map)
25 (set (make-local-variable 'font-lock-defaults) '(fth-font-lock-keywords-1))
26 (setq major-mode 'fth-mode)
27 (setq mode-name "4th")
28 (run-hooks 'fth-mode-hook))
29
30(provide 'fth-mode)