summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elisp/geiser-syntax.el60
1 files changed, 48 insertions, 12 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 9557f5e..6a5cb55 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -28,39 +28,75 @@
pairs)))
(geiser-syntax--scheme-indent
+ (and-let* 1)
(case-lambda 0)
(catch defun)
(class defun)
(dynamic-wind 0)
(let*-values 1)
- (letrec* 1)
- (letrec-values 1)
(let-values 1)
(let/ec 1)
- (match defun)
+ (letrec* 1)
+ (match 1)
+ (match-lambda 0)
+ (match-lambda* 0)
+ (match-let 1)
+ (match-let* 1)
+ (match-letrec 1)
(opt-lambda 1)
(parameterize 1)
(parameterize* 1)
(receive 2)
+ (require-extension 0)
(syntax-case 2)
(unless 1)
(when 1)
(while 1)
- (with-error-to-port 1)
(with-syntax 1))
;;; Extra syntax keywords
-(defconst geiser-syntax--keywords
- `(("\\[\\(else\\)\\>" . 1)
- ("(\\(parameterize\\)\\>" . 1)
- (,(rx "(" (group "define-syntax-rule") eow (* space)
- (? "(") (? (group (1+ word))))
+
+(defconst geiser-syntax--builtin-keywords
+ '("and-let*"
+ "cut"
+ "cute"
+ "define-condition-type"
+ "define-immutable-record-type"
+ "define-record-type"
+ "define-values"
+ "letrec*"
+ "match"
+ "match-lambda"
+ "match-lambda*"
+ "match-let"
+ "match-let*"
+ "match-letrec"
+ "parameterize"
+ "receive"
+ "require-extension"
+ "set!"
+ "unless"
+ "when"
+ "with-input-from-file"
+ "with-output-to-file"))
+
+(defun geiser-syntax--simple-keywords (keywords)
+ "Return `font-lock-keywords' to highlight scheme KEYWORDS.
+KEYWORDS should be a list of strings."
+ (when keywords
+ `((,(format "[[(]%s\\>" (regexp-opt keywords 1)) . 1))))
+
+(defun geiser-syntax--keywords ()
+ (append
+ (geiser-syntax--simple-keywords geiser-syntax--builtin-keywords)
+ `(("\\[\\(else\\)\\>" . 1)
+ (,(rx "(" (group "define-syntax-rule") eow (* space)
+ (? "(") (? (group (1+ word))))
(1 font-lock-keyword-face)
- (2 font-lock-function-name-face nil t))
- (,(rx "(" (group "when") eow) . 1)))
+ (2 font-lock-function-name-face nil t)))))
-(font-lock-add-keywords 'scheme-mode geiser-syntax--keywords)
+(font-lock-add-keywords 'scheme-mode (geiser-syntax--keywords))
(geiser-impl--define-caller geiser-syntax--impl-kws keywords ()
"A variable (or thunk returning a value) giving additional,