-
Notifications
You must be signed in to change notification settings - Fork 0
/
web4r.el
43 lines (36 loc) · 1.6 KB
/
web4r.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
; web4r.el
;
; Copyright (c) Tomoyuki Matsumoto
; BSD license - http://www.opensource.org/licenses/bsd-license.php
;
; Configurations:
; 1. Make sure web4r.el is in your load-path
; 2. Add following line to your .emacs file
; (load "web4r")
; Note: this elisp affects entire lisp mode.
(add-to-list 'auto-mode-alist (cons "\\.sml$" 'lisp-mode))
(setf lisp-mode-syntax-table
(let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
(modify-syntax-entry ?[ "(^" table)
(modify-syntax-entry ?] ")$" table)
table))
(defun web4r-face (symbol face)
(let ((r (concat "\\([^']\\|^\\)(\\(" (symbol-name symbol) "\\)[ \n)]")))
(font-lock-add-keywords 'lisp-mode (list (list r 2 face)))))
(defun web4r-func (symbol indent face)
(put symbol 'lisp-indent-function indent)
(web4r-face symbol face))
(put 'defpage 'lisp-indent-hook 'defun)
(web4r-face 'defpage 'font-lock-keyword-face)
(web4r-face 'define-validator 'font-lock-keyword-face)
(web4r-func 'when-let 1 'font-lock-keyword-face)
(web4r-func 'aif 0 'font-lock-keyword-face)
(web4r-func 'awhen 1 'font-lock-keyword-face)
(web4r-func 'aand nil 'font-lock-keyword-face)
(web4r-func 'define-shtml nil 'font-lock-keyword-face)
(web4r-func 'form-for/cont 1 'font-lock-function-name-face)
(web4r-func 'a/cont 1 'font-lock-function-name-face)
(web4r-func 'form/cont 1 'font-lock-function-name-face)
(web4r-func 'page-lambda 2 'font-lock-keyword-face)
(web4r-func 'defpclass 3 'font-lock-keyword-face)
(web4r-func 'with-new-cookie 0 'font-lock-keyword-face)