From f0b21e7a636900729910f26dd9b0262cc27db998 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 14 Nov 2010 20:19:10 +0100 Subject: Support for implementation-specific font lock keywords Spinning up from correct fontification of [else in this brave Racket world. I'm keeping the list of extra keywords lean and mean, but making it customizable in both Racket and Guile. --- elisp/geiser-mode.el | 4 +++- elisp/geiser-syntax.el | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index 8f8b7fe..fe7936f 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -21,6 +21,7 @@ (require 'geiser-edit) (require 'geiser-autodoc) (require 'geiser-debug) +(require 'geiser-syntax) (require 'geiser-impl) (require 'geiser-eval) (require 'geiser-popup) @@ -244,7 +245,8 @@ interacting with the Geiser REPL is at your disposal. (when geiser-mode-autodoc-p (geiser-autodoc-mode (if geiser-mode 1 -1))) (when geiser-mode-smart-tab-p - (geiser-smart-tab-mode (if geiser-mode 1 -1)))) + (geiser-smart-tab-mode (if geiser-mode 1 -1))) + (geiser-syntax--add-kws)) (defun turn-on-geiser-mode () "Enable `geiser-mode' (in a Scheme buffer)." diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index f134ea4..40f2def 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -84,6 +84,22 @@ (with-method 1) (with-syntax 1)) + +;;; Extra syntax keywords +(defconst geiser-syntax--keywords + '(("\\[\\(else\\)\\>" . 1) + ("(\\(parameterize\\)\\>" . 1))) + +(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, +implementation-specific entries for font-lock-keywords.") + +(defun geiser-syntax--add-kws () + (let ((kw (geiser-syntax--impl-kws geiser-impl--implementation))) + (when kw (font-lock-add-keywords nil kw)))) + ;;; A simple scheme reader -- cgit v1.2.3