diff options
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-guile.el | 15 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 4 | ||||
-rw-r--r-- | elisp/geiser-racket.el | 13 | ||||
-rw-r--r-- | elisp/geiser-syntax.el | 16 |
4 files changed, 46 insertions, 2 deletions
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index a53395d..865c7fc 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -87,6 +87,11 @@ effect on new REPLs. For existing ones, use the command (repeat :tag "Custom" symbol)) :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-extra-keywords nil + "Extra keywords highlighted in Guile scheme buffers." + :type '(repeat string) + :group 'geiser-guile) + ;;; REPL support: @@ -207,6 +212,13 @@ This function uses `geiser-guile-init-file' if it exists." (re-search-forward geiser-guile--guess-re nil t))) +;;; Keywords +(defun geiser-guile--keywords () + (when geiser-guile-extra-keywords + `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1)) + . 1)))) + + ;;; Compilation shell regexps (defconst geiser-guile--path-rx "^In \\([^:\n ]+\\):\n") @@ -284,7 +296,8 @@ it spawn a server thread." (find-symbol-begin geiser-guile--symbol-begin) (display-error geiser-guile--display-error) (display-help) - (check-buffer geiser-guile--guess)) + (check-buffer geiser-guile--guess) + (keywords geiser-guile--keywords)) (geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile nil) 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-racket.el b/elisp/geiser-racket.el index b348732..ac2e1f6 100644 --- a/elisp/geiser-racket.el +++ b/elisp/geiser-racket.el @@ -56,6 +56,11 @@ This executable is used by `run-gracket', and, if :type 'boolean :group 'geiser-racket) +(geiser-custom--defcustom geiser-racket-extra-keywords + '("define-syntax-rule" "unless" "when" "with-handlers") + "Extra keywords highlighted in Racket buffers." + :type '(repeat string) + :group 'geiser-racket) ;;; REPL support: @@ -223,6 +228,13 @@ This function uses `geiser-racket-init-file' if it exists." (geiser-racket--explicit-module))) +;;; Keywords +(defun geiser-racket--keywords () + (when geiser-racket-extra-keywords + `((,(format "[[(]%s\\>" (regexp-opt geiser-racket-extra-keywords 1)) + . 1)))) + + ;;; Remote REPLs (defun connect-to-racket () @@ -251,6 +263,7 @@ using start-geiser, a procedure in the geiser/server module." (display-error geiser-racket--display-error) (display-help geiser-racket--external-help) (check-buffer geiser-racket--guess) + (keywords geiser-racket--keywords) (binding-forms geiser-racket--binding-forms) (binding-forms* geiser-racket--binding-forms*)) 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 @@ -85,6 +85,22 @@ (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 (defvar geiser-syntax--read/buffer-limit nil) |