-;;; scheme.el --- Scheme (and DSSSL) editing mode.
+;;; scheme.el --- Scheme (and DSSSL) editing mode
;; Copyright (C) 1986, 87, 88, 97, 1998 Free Software Foundation, Inc.
\f
(require 'lisp-mode)
-(defvar scheme-mode-syntax-table nil)
-(if (not scheme-mode-syntax-table)
- (let ((i 0))
- (setq scheme-mode-syntax-table (make-syntax-table))
- (set-syntax-table scheme-mode-syntax-table)
-
- ;; Default is atom-constituent.
- (while (< i 256)
- (modify-syntax-entry i "_ ")
- (setq i (1+ i)))
-
- ;; Word components.
- (setq i ?0)
- (while (<= i ?9)
- (modify-syntax-entry i "w ")
- (setq i (1+ i)))
- (setq i ?A)
- (while (<= i ?Z)
- (modify-syntax-entry i "w ")
- (setq i (1+ i)))
- (setq i ?a)
- (while (<= i ?z)
- (modify-syntax-entry i "w ")
- (setq i (1+ i)))
-
- ;; Whitespace
- (modify-syntax-entry ?\t " ")
- (modify-syntax-entry ?\n "> ")
- (modify-syntax-entry ?\f " ")
- (modify-syntax-entry ?\r " ")
- (modify-syntax-entry ? " ")
-
- ;; These characters are delimiters but otherwise undefined.
- ;; Brackets and braces balance for editing convenience.
- (modify-syntax-entry ?\[ "(] ")
- (modify-syntax-entry ?\] ")[ ")
- (modify-syntax-entry ?{ "(} ")
- (modify-syntax-entry ?} "){ ")
- (modify-syntax-entry ?\| " 23")
-
- ;; Other atom delimiters
- (modify-syntax-entry ?\( "() ")
- (modify-syntax-entry ?\) ")( ")
- (modify-syntax-entry ?\; "< ")
- (modify-syntax-entry ?\" "\" ")
- (modify-syntax-entry ?' " p")
- (modify-syntax-entry ?` " p")
-
- ;; Special characters
- (modify-syntax-entry ?, "_ p")
- (modify-syntax-entry ?@ "_ p")
- (modify-syntax-entry ?# "_ p14")
- (modify-syntax-entry ?\\ "\\ ")))
+(defvar scheme-mode-syntax-table
+ (let ((st (make-syntax-table))
+ (i 0))
+
+ ;; Default is atom-constituent.
+ (while (< i 256)
+ (modify-syntax-entry i "_ " st)
+ (setq i (1+ i)))
+
+ ;; Word components.
+ (setq i ?0)
+ (while (<= i ?9)
+ (modify-syntax-entry i "w " st)
+ (setq i (1+ i)))
+ (setq i ?A)
+ (while (<= i ?Z)
+ (modify-syntax-entry i "w " st)
+ (setq i (1+ i)))
+ (setq i ?a)
+ (while (<= i ?z)
+ (modify-syntax-entry i "w " st)
+ (setq i (1+ i)))
+
+ ;; Whitespace
+ (modify-syntax-entry ?\t " " st)
+ (modify-syntax-entry ?\n "> " st)
+ (modify-syntax-entry ?\f " " st)
+ (modify-syntax-entry ?\r " " st)
+ (modify-syntax-entry ? " " st)
+
+ ;; These characters are delimiters but otherwise undefined.
+ ;; Brackets and braces balance for editing convenience.
+ (modify-syntax-entry ?\[ "(] " st)
+ (modify-syntax-entry ?\] ")[ " st)
+ (modify-syntax-entry ?{ "(} " st)
+ (modify-syntax-entry ?} "){ " st)
+ (modify-syntax-entry ?\| " 23" st)
+
+ ;; Other atom delimiters
+ (modify-syntax-entry ?\( "() " st)
+ (modify-syntax-entry ?\) ")( " st)
+ (modify-syntax-entry ?\; "< " st)
+ (modify-syntax-entry ?\" "\" " st)
+ (modify-syntax-entry ?' "' " st)
+ (modify-syntax-entry ?` "' " st)
+
+ ;; Special characters
+ (modify-syntax-entry ?, "' " st)
+ (modify-syntax-entry ?@ "' " st)
+ (modify-syntax-entry ?# "' 14" st)
+ (modify-syntax-entry ?\\ "\\ " st)
+ st))
\f
(defvar scheme-mode-abbrev-table nil)
(define-abbrev-table 'scheme-mode-abbrev-table ())
(make-local-variable 'lisp-indent-function)
(set lisp-indent-function 'scheme-indent-function)
(setq mode-line-process '("" scheme-mode-line-process))
- (make-local-variable 'imenu-case-fold-search)
- (setq imenu-case-fold-search t)
+ (set (make-local-variable 'imenu-case-fold-search) t)
(setq imenu-generic-expression scheme-imenu-generic-expression)
- (make-local-variable 'imenu-syntax-alist)
- (setq imenu-syntax-alist '(("+-*/.<>=?!$%_&~^:" . "w")))
+ (set (make-local-variable 'imenu-syntax-alist)
+ '(("+-*/.<>=?!$%_&~^:" . "w")))
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
'((scheme-font-lock-keywords
scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
- nil t (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun
- (font-lock-mark-block-function . mark-defun))))
+ nil t (("+-*/.<>=!?$%_&~^:#" . "w")) beginning-of-defun
+ (font-lock-mark-block-function . mark-defun)
+ (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function))))
(defvar scheme-mode-line-process "")
(unless scheme-mode-map
(let ((map (make-sparse-keymap "Scheme")))
(setq scheme-mode-map (make-sparse-keymap))
- (set-keymap-parent scheme-mode-map shared-lisp-mode-map)
+ (set-keymap-parent scheme-mode-map lisp-mode-shared-map)
(define-key scheme-mode-map [menu-bar] (make-sparse-keymap))
(define-key scheme-mode-map [menu-bar scheme]
(cons "Scheme" map))
commands will be defined, for evaluating expressions and controlling
the interpreter, and the state of the process will be displayed in the
modeline of all Scheme buffers. The names of commands that interact
-with the Scheme process start with \"xscheme-\". For more information
-see the documentation for xscheme-interaction-mode.
+with the Scheme process start with \"xscheme-\" if you use the MIT
+Scheme-specific `xscheme' package; for more information see the
+documentation for `xscheme-interaction-mode'. Use \\[run-scheme] to
+start an inferior Scheme using the more general `cmuscheme' package.
Commands:
Delete converts tabs to spaces as it moves back.
:type 'hook
:group 'scheme)
+;; This is shared by cmuscheme and xscheme.
+(defcustom scheme-program-name "scheme"
+ "*Program invoked by the `run-scheme' command."
+ :type 'string
+ :group 'scheme)
+
(defvar dsssl-imenu-generic-expression
;; Perhaps this should also look for the style-sheet DTD tags. I'm
;; not sure it's the best way to organize it; perhaps one type
;; Function names.
"\\(\\|-public\\|-method\\|-generic\\(-procedure\\)?\\)\\|"
;; Macro names, as variable names. A bit dubious, this.
- "\\(-syntax\\)\\|"
+ "\\(-syntax\\|-macro\\)\\|"
;; Class names.
"-class"
;; Guile modules.
"do" "else" "for-each" "if" "lambda"
"let" "let*" "let-syntax" "letrec" "letrec-syntax"
;; Hannes Haug <hannes.haug@student.uni-tuebingen.de> wants:
- "and" "or" "delay"
+ "and" "or" "delay" "force"
;; Stefan Monnier <stefan.monnier@epfl.ch> says don't bother:
;;"quasiquote" "quote" "unquote" "unquote-splicing"
"map" "syntax" "syntax-rules") t)
;; David Fox <fox@graphics.cs.nyu.edu> for SOS/STklos class specifiers.
'("\\<<\\sw+>\\>" . font-lock-type-face)
;;
- ;; Scheme `:' keywords as builtins.
- '("\\<:\\sw+\\>" . font-lock-builtin-face)
+ ;; Scheme `:' and `#:' keywords as builtins.
+ '("\\<#?:\\sw+\\>" . font-lock-builtin-face)
)))
"Gaudy expressions to highlight in Scheme modes.")
nil t (("+-*/.<>=?$%_&~^:" . "w"))
beginning-of-defun
(font-lock-mark-block-function . mark-defun)))
- (setq imenu-case-fold-search nil)
+ (set (make-local-variable 'imenu-case-fold-search) nil)
(setq imenu-generic-expression dsssl-imenu-generic-expression)
- (setq imenu-syntax-alist '(("+-*/.<>=?$%_&~^:" . "w")))
+ (set (make-local-variable 'imenu-syntax-alist)
+ '(("+-*/.<>=?$%_&~^:" . "w")))
(run-hooks 'scheme-mode-hook)
(run-hooks 'dsssl-mode-hook))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(if (and (elt state 2)
(not (looking-at "\\sw\\|\\s_")))
- ;; car of form doesn't seem to be a a symbol
+ ;; car of form doesn't seem to be a symbol
(progn
(if (not (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp))
(put 'let-syntax 'scheme-indent-function 1)
(put 'letrec-syntax 'scheme-indent-function 1)
(put 'syntax-rules 'scheme-indent-function 1)
-
+(put 'syntax-case 'scheme-indent-function 2) ; not r5rs
(put 'call-with-input-file 'scheme-indent-function 1)
(put 'with-input-from-file 'scheme-indent-function 1)
(provide 'scheme)
+;;; arch-tag: a8f06bc1-ad11-42d2-9e36-ce651df37a90
;;; scheme.el ends here