bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9164: 23.2; Scheme mode should recognize R6RS libraries


From: Simen Heggestøyl
Subject: bug#9164: 23.2; Scheme mode should recognize R6RS libraries
Date: Fri, 14 Jun 2013 17:09:22 +0200

This patch fixes bug #9164, by indenting R6RS `library' forms correctly,
and highlighting them (consistent with how Guile modules are
highlighted).

Denis Washington <denis@dwashington.fritz.box> writes:
> Emacs' Scheme mode does not seem to have been updated for
> the language additions of the R6RS standard. Most specifically,
> it does not recognize R6RS "library" forms, which means that:
>
> * "library" is not highlighted, and neither is the defined
>   library name or the "export" and "import" auxiliary
>   keywords.
>
> * Library forms are auto-indented like procedure calls,
>   but should have "define"-style indentation.
>
> This should be fixed in scheme-mode.

=== modified file 'lisp/progmodes/scheme.el'
*** lisp/progmodes/scheme.el    2013-03-16 22:08:22 +0000
--- lisp/progmodes/scheme.el    2013-06-14 13:30:30 +0000
*************** See `run-hooks'."
*** 312,317 ****
--- 312,319 ----
               "call-with-input-file" "call-with-output-file" "case" "cond"
               "do" "else" "for-each" "if" "lambda" "λ"
               "let" "let*" "let-syntax" "letrec" "letrec-syntax"
+                ;; R6RS library subforms.
+                "export" "import"
               ;; SRFI 11 usage comes up often enough.
               "let-values" "let*-values"
               ;; Hannes Haug <hannes.haug@student.uni-tuebingen.de> wants:
*************** See `run-hooks'."
*** 330,335 ****
--- 332,341 ----
        ;;
        ;; Scheme `:' and `#:' keywords as builtins.
        '("\\<#?:\\sw+\\>" . font-lock-builtin-face)
+       ;; R6RS library declarations.
+       '("(\\(\\<library\\>\\)\\s-*(?\\(\\sw+\\)?"
+         (1 font-lock-keyword-face)
+         (2 font-lock-type-face))
        )))
    "Gaudy expressions to highlight in Scheme modes.")
  
*************** indentation."
*** 536,541 ****
--- 542,548 ----
  (put 'letrec-syntax 'scheme-indent-function 1)
  (put 'syntax-rules 'scheme-indent-function 1)
  (put 'syntax-case 'scheme-indent-function 2) ; not r5rs
+ (put 'library 'scheme-indent-function 1) ; R6RS
  
  (put 'call-with-input-file 'scheme-indent-function 1)
  (put 'with-input-from-file 'scheme-indent-function 1)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]