summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-chicken.el109
-rw-r--r--elisp/geiser-guile.el36
-rw-r--r--elisp/geiser-racket.el5
-rw-r--r--elisp/geiser-syntax.el60
4 files changed, 134 insertions, 76 deletions
diff --git a/elisp/geiser-chicken.el b/elisp/geiser-chicken.el
index 973c4e7..2a8c082 100644
--- a/elisp/geiser-chicken.el
+++ b/elisp/geiser-chicken.el
@@ -27,17 +27,36 @@
(eval-when-compile (require 'cl))
(defconst geiser-chicken-builtin-keywords
- '("and-let*" "assume" "compiler-typecase" "cond-expand" "condition-case"
- "cut" "cute" "declare" "define-constant" "define-inline" "define-interface"
- "define-record" "define-record-type" "define-specialization"
- "define-syntax-rule" "define-type" "define-values" "dotimes" "ecase"
- "fluid-let" "foreign-lambda" "foreign-lambda*" "foreign-primitive"
- "foreign-safe-lambda" "foreign-safe-lambda*" "functor" "handle-exceptions"
- "import" "let*-values" "let-location" "let-optionals" "let-optionals*"
- "let-values" "letrec*" "letrec-values" "match-letrec" "module"
- "parameterize" "regex-case" "require-extension" "select" "set!"
- "unless" "use" "when" "with-input-from-pipe" "match" "match-lambda"
- "match-lambda*" "match-let" "match-let*" "receive"))
+ '("assume"
+ "compiler-typecase"
+ "cond-expand"
+ "condition-case"
+ "declare"
+ "define-constant"
+ "define-inline"
+ "define-interface"
+ "define-record"
+ "define-specialization"
+ "define-type"
+ "dotimes"
+ "ecase"
+ "fluid-let"
+ "foreign-lambda"
+ "foreign-lambda*"
+ "foreign-primitive"
+ "foreign-safe-lambda"
+ "foreign-safe-lambda*"
+ "functor"
+ "handle-exceptions"
+ "let-location"
+ "let-optionals"
+ "let-optionals*"
+ "letrec-values"
+ "module"
+ "regex-case"
+ "select"
+ "use"
+ "with-input-from-pipe"))
;;; Customization:
@@ -214,62 +233,40 @@ This function uses `geiser-chicken-init-file' if it exists."
;;; Keywords and syntax
(defun geiser-chicken--keywords ()
- `((,(format "[[(]%s\\>" (regexp-opt geiser-chicken-builtin-keywords 1)) . 1)))
+ (append
+ (geiser-syntax--simple-keywords geiser-chicken-extra-keywords)
+ (geiser-syntax--simple-keywords geiser-chicken-builtin-keywords)))
(geiser-syntax--scheme-indent
- (receive 2)
- (match 1)
- (match-lambda 0)
- (match-lambda* 0)
- (match-let scheme-let-indent)
- (match-let* 1)
- (match-letrec 1)
- (declare 0)
+ (assume 1)
+ (compiler-typecase 1)
(cond-expand 0)
- (let-values scheme-let-indent)
- (let*-values scheme-let-indent)
- (letrec-values 1)
- (letrec* 1)
- (parameterize scheme-let-indent)
- (let-location 1)
- (foreign-lambda 2)
- (foreign-lambda* 2)
- (foreign-primitive 2)
- (foreign-safe-lambda 2)
- (foreign-safe-lambda* 2)
- (set! 1)
- (let-optionals* 2)
- (let-optionals 2)
(condition-case 1)
- (fluid-let 1)
- (and-let* 1)
- (assume 1)
(cut 1)
(cute 1)
- (when 1)
- (unless 1)
+ (declare 0)
(dotimes 1)
- (compiler-typecase 1)
(ecase 1)
- (use 0)
- (require-extension 0)
- (import 0)
+ (fluid-let 1)
+ (foreign-lambda 2)
+ (foreign-lambda* 2)
+ (foreign-primitive 2)
+ (foreign-safe-lambda 2)
+ (foreign-safe-lambda* 2)
+ (functor 3)
(handle-exceptions 2)
+ (import 0)
+ (let-location 1)
+ (let-optionals 2)
+ (let-optionals* 2)
+ (letrec-values 1)
+ (module 2)
(regex-case 1)
- (define-inline 1)
- (define-constant 1)
- (define-syntax-rule 1)
- (define-record-type 1)
- (define-values 1)
- (define-record 1)
- (define-specialization 1)
- (define-type 1)
- (with-input-from-pipe 1)
- (with-output-to-pipe 1)
(select 1)
- (functor 3)
- (define-interface 1)
- (module 2))
+ (set! 1)
+ (use 0)
+ (with-input-from-pipe 1)
+ (with-output-to-pipe 1))
;;; REPL startup
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el
index e8eb11a..f942930 100644
--- a/elisp/geiser-guile.el
+++ b/elisp/geiser-guile.el
@@ -245,11 +245,32 @@ This function uses `geiser-guile-init-file' if it exists."
;;; Keywords and syntax
+(defconst geiser-guile--builtin-keywords
+ '("call-with-input-file"
+ "call-with-output-file"
+ "call-with-input-string"
+ "call-with-output-string"
+ "define-accessor"
+ "define-class"
+ "define-enumeration"
+ "define-inlinable"
+ "lambda*"
+ "use-modules"
+ "with-error-to-file"
+ "with-error-to-port"
+ "with-error-to-string"
+ "with-fluid*"
+ "with-fluids"
+ "with-fluids*"
+ "with-input-from-port"
+ "with-input-from-string"
+ "with-output-to-port"
+ "with-output-to-string"))
+
(defun geiser-guile--keywords ()
(append
- (when geiser-guile-extra-keywords
- `((,(format "[[(]%s\\>" (regexp-opt geiser-guile-extra-keywords 1))
- . 1)))
+ (geiser-syntax--simple-keywords geiser-guile-extra-keywords)
+ (geiser-syntax--simple-keywords geiser-guile--builtin-keywords)
`((,(rx "(" (group "define-once") eow (* space) (? (group (+ word))))
(1 font-lock-keyword-face)
(2 font-lock-variable-name-face nil t))
@@ -260,14 +281,21 @@ This function uses `geiser-guile-init-file' if it exists."
(geiser-syntax--scheme-indent
(c-declare 0)
(c-lambda 2)
+ (call-with-input-string 1)
+ (call-with-output-string 0)
(lambda* 1)
(pmatch defun)
(sigaction 1)
+ (with-error-to-file 1)
+ (with-error-to-port 1)
+ (with-error-to-string 0)
(with-fluid* 1)
(with-fluids 1)
(with-fluids* 1)
+ (with-input-from-string 1)
(with-method 1)
- (with-mutex 1))
+ (with-mutex 1)
+ (with-output-to-string 0))
diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el
index 6a849e3..23c6083 100644
--- a/elisp/geiser-racket.el
+++ b/elisp/geiser-racket.el
@@ -272,10 +272,7 @@ using start-geiser, a procedure in the geiser/server module."
(defun geiser-racket--keywords ()
(append geiser-racket-font-lock-forms
- (when geiser-racket-extra-keywords
- `((,(format "[[(]%s\\>"
- (regexp-opt geiser-racket-extra-keywords 1))
- . 1)))))
+ (geiser-syntax--simple-keywords geiser-racket-extra-keywords)))
(geiser-syntax--scheme-indent
(begin0 1)
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,