(Search-based Fontification): Correct a typo.
[emacs.git] / lisp / progmodes / scheme.el
blob790a71720fcbe7b2ec516fb9a441ec65736e29fb
1 ;;; scheme.el --- Scheme (and DSSSL) editing mode
3 ;; Copyright (C) 1986, 1987, 1988, 1997, 1998, 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
6 ;; Author: Bill Rozas <jinx@martigny.ai.mit.edu>
7 ;; Adapted-by: Dave Love <d.love@dl.ac.uk>
8 ;; Keywords: languages, lisp
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;; The major mode for editing Scheme-type Lisp code, very similar to
28 ;; the Lisp mode documented in the Emacs manual. `dsssl-mode' is a
29 ;; variant of scheme-mode for editing DSSSL specifications for SGML
30 ;; documents. [As of Apr 1997, some pointers for DSSSL may be found,
31 ;; for instance, at <URL:http://www.sil.org/sgml/related.html#dsssl>.]
32 ;; All these Lisp-ish modes vary basically in details of the language
33 ;; syntax they highlight/indent/index, but dsssl-mode uses "^;;;" as
34 ;; the page-delimiter since ^L isn't normally a valid SGML character.
36 ;; For interacting with a Scheme interpreter See also `run-scheme' in
37 ;; the `cmuscheme' package and also the implementation-specific
38 ;; `xscheme' package.
40 ;; Here's a recipe to generate a TAGS file for DSSSL, by the way:
41 ;; etags --lang=scheme --regex='/[ \t]*(\(mode\|element\)[ \t
42 ;; ]+\([^ \t(
43 ;; ]+\)/\2/' --regex='/[ \t]*(element[ \t
44 ;; ]*([^)]+[ \t
45 ;; ]+\([^)]+\)[ \t
46 ;; ]*)/\1/' --regex='/(declare[^ \t
47 ;; ]*[ \t
48 ;; ]+\([^ \t
49 ;; ]+\)/\1/' "$@"
51 ;;; Code:
53 (require 'lisp-mode)
55 (defvar scheme-mode-syntax-table
56 (let ((st (make-syntax-table))
57 (i 0))
59 ;; Default is atom-constituent.
60 (while (< i 256)
61 (modify-syntax-entry i "_ " st)
62 (setq i (1+ i)))
64 ;; Word components.
65 (setq i ?0)
66 (while (<= i ?9)
67 (modify-syntax-entry i "w " st)
68 (setq i (1+ i)))
69 (setq i ?A)
70 (while (<= i ?Z)
71 (modify-syntax-entry i "w " st)
72 (setq i (1+ i)))
73 (setq i ?a)
74 (while (<= i ?z)
75 (modify-syntax-entry i "w " st)
76 (setq i (1+ i)))
78 ;; Whitespace
79 (modify-syntax-entry ?\t " " st)
80 (modify-syntax-entry ?\n "> " st)
81 (modify-syntax-entry ?\f " " st)
82 (modify-syntax-entry ?\r " " st)
83 (modify-syntax-entry ?\s " " st)
85 ;; These characters are delimiters but otherwise undefined.
86 ;; Brackets and braces balance for editing convenience.
87 (modify-syntax-entry ?\[ "(] " st)
88 (modify-syntax-entry ?\] ")[ " st)
89 (modify-syntax-entry ?{ "(} " st)
90 (modify-syntax-entry ?} "){ " st)
91 (modify-syntax-entry ?\| "\" 23bn" st)
92 ;; Guile allows #! ... !# comments.
93 ;; But SRFI-22 defines the comment as #!...\n instead.
94 ;; Also Guile says that the !# should be on a line of its own.
95 ;; It's too difficult to get it right, for too little benefit.
96 ;; (modify-syntax-entry ?! "_ 2" st)
98 ;; Other atom delimiters
99 (modify-syntax-entry ?\( "() " st)
100 (modify-syntax-entry ?\) ")( " st)
101 ;; It's used for single-line comments as well as for #;(...) sexp-comments.
102 (modify-syntax-entry ?\; "< 2 " st)
103 (modify-syntax-entry ?\" "\" " st)
104 (modify-syntax-entry ?' "' " st)
105 (modify-syntax-entry ?` "' " st)
107 ;; Special characters
108 (modify-syntax-entry ?, "' " st)
109 (modify-syntax-entry ?@ "' " st)
110 (modify-syntax-entry ?# "' 14b" st)
111 (modify-syntax-entry ?\\ "\\ " st)
112 st))
114 (defvar scheme-mode-abbrev-table nil)
115 (define-abbrev-table 'scheme-mode-abbrev-table ())
117 (defvar scheme-imenu-generic-expression
118 '((nil
119 "^(define\\(\\|-\\(generic\\(\\|-procedure\\)\\|method\\)\\)*\\s-+(?\\(\\sw+\\)" 4)
120 ("Types"
121 "^(define-class\\s-+(?\\(\\sw+\\)" 1)
122 ("Macros"
123 "^(\\(defmacro\\|define-macro\\|define-syntax\\)\\s-+(?\\(\\sw+\\)" 2))
124 "Imenu generic expression for Scheme mode. See `imenu-generic-expression'.")
126 (defun scheme-mode-variables ()
127 (set-syntax-table scheme-mode-syntax-table)
128 (setq local-abbrev-table scheme-mode-abbrev-table)
129 (make-local-variable 'paragraph-start)
130 (setq paragraph-start (concat "$\\|" page-delimiter))
131 (make-local-variable 'paragraph-separate)
132 (setq paragraph-separate paragraph-start)
133 (make-local-variable 'paragraph-ignore-fill-prefix)
134 (setq paragraph-ignore-fill-prefix t)
135 (make-local-variable 'fill-paragraph-function)
136 (setq fill-paragraph-function 'lisp-fill-paragraph)
137 ;; Adaptive fill mode gets in the way of auto-fill,
138 ;; and should make no difference for explicit fill
139 ;; because lisp-fill-paragraph should do the job.
140 (make-local-variable 'adaptive-fill-mode)
141 (setq adaptive-fill-mode nil)
142 (make-local-variable 'indent-line-function)
143 (setq indent-line-function 'lisp-indent-line)
144 (make-local-variable 'parse-sexp-ignore-comments)
145 (setq parse-sexp-ignore-comments t)
146 (make-local-variable 'outline-regexp)
147 (setq outline-regexp ";;; \\|(....")
148 (make-local-variable 'comment-start)
149 (setq comment-start ";")
150 (set (make-local-variable 'comment-add) 1)
151 (make-local-variable 'comment-start-skip)
152 ;; Look within the line for a ; following an even number of backslashes
153 ;; after either a non-backslash or the line beginning.
154 (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
155 (set (make-local-variable 'font-lock-comment-start-skip) ";+ *")
156 (make-local-variable 'comment-column)
157 (setq comment-column 40)
158 (make-local-variable 'parse-sexp-ignore-comments)
159 (setq parse-sexp-ignore-comments t)
160 (make-local-variable 'lisp-indent-function)
161 (setq lisp-indent-function 'scheme-indent-function)
162 (setq mode-line-process '("" scheme-mode-line-process))
163 (set (make-local-variable 'imenu-case-fold-search) t)
164 (setq imenu-generic-expression scheme-imenu-generic-expression)
165 (set (make-local-variable 'imenu-syntax-alist)
166 '(("+-*/.<>=?!$%_&~^:" . "w")))
167 (set (make-local-variable 'font-lock-defaults)
168 '((scheme-font-lock-keywords
169 scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
170 nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
171 beginning-of-defun
172 (font-lock-mark-block-function . mark-defun)
173 (font-lock-syntactic-face-function
174 . scheme-font-lock-syntactic-face-function)
175 (parse-sexp-lookup-properties . t)
176 (font-lock-extra-managed-props syntax-table)))
177 (set (make-local-variable 'lisp-doc-string-elt-property)
178 'scheme-doc-string-elt))
180 (defvar scheme-mode-line-process "")
182 (defvar scheme-mode-map
183 (let ((smap (make-sparse-keymap))
184 (map (make-sparse-keymap "Scheme")))
185 (set-keymap-parent smap lisp-mode-shared-map)
186 (define-key smap [menu-bar scheme] (cons "Scheme" map))
187 (define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme))
188 (define-key map [uncomment-region]
189 '("Uncomment Out Region" . (lambda (beg end)
190 (interactive "r")
191 (comment-region beg end '(4)))))
192 (define-key map [comment-region] '("Comment Out Region" . comment-region))
193 (define-key map [indent-region] '("Indent Region" . indent-region))
194 (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
195 (put 'comment-region 'menu-enable 'mark-active)
196 (put 'uncomment-region 'menu-enable 'mark-active)
197 (put 'indent-region 'menu-enable 'mark-active)
198 smap)
199 "Keymap for Scheme mode.
200 All commands in `lisp-mode-shared-map' are inherited by this map.")
202 ;; Used by cmuscheme
203 (defun scheme-mode-commands (map)
204 ;;(define-key map "\t" 'indent-for-tab-command) ; default
205 (define-key map "\177" 'backward-delete-char-untabify)
206 (define-key map "\e\C-q" 'indent-sexp))
208 ;;;###autoload
209 (defun scheme-mode ()
210 "Major mode for editing Scheme code.
211 Editing commands are similar to those of `lisp-mode'.
213 In addition, if an inferior Scheme process is running, some additional
214 commands will be defined, for evaluating expressions and controlling
215 the interpreter, and the state of the process will be displayed in the
216 modeline of all Scheme buffers. The names of commands that interact
217 with the Scheme process start with \"xscheme-\" if you use the MIT
218 Scheme-specific `xscheme' package; for more information see the
219 documentation for `xscheme-interaction-mode'. Use \\[run-scheme] to
220 start an inferior Scheme using the more general `cmuscheme' package.
222 Commands:
223 Delete converts tabs to spaces as it moves back.
224 Blank lines separate paragraphs. Semicolons start comments.
225 \\{scheme-mode-map}
226 Entry to this mode calls the value of `scheme-mode-hook'
227 if that value is non-nil."
228 (interactive)
229 (kill-all-local-variables)
230 (use-local-map scheme-mode-map)
231 (setq major-mode 'scheme-mode)
232 (setq mode-name "Scheme")
233 (scheme-mode-variables)
234 (run-mode-hooks 'scheme-mode-hook))
236 (defgroup scheme nil
237 "Editing Scheme code."
238 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
239 :group 'lisp)
241 (defcustom scheme-mit-dialect t
242 "If non-nil, scheme mode is specialized for MIT Scheme.
243 Set this to nil if you normally use another dialect."
244 :type 'boolean
245 :group 'scheme)
247 (defcustom dsssl-sgml-declaration
248 "<!DOCTYPE style-sheet PUBLIC \"-//James Clark//DTD DSSSL Style Sheet//EN\">
250 "*An SGML declaration for the DSSSL file.
251 If it is defined as a string this will be inserted into an empty buffer
252 which is in `dsssl-mode'. It is typically James Clark's style-sheet
253 doctype, as required for Jade."
254 :type '(choice (string :tag "Specified string")
255 (const :tag "None" :value nil))
256 :group 'scheme)
258 (defcustom scheme-mode-hook nil
259 "Normal hook run when entering `scheme-mode'.
260 See `run-hooks'."
261 :type 'hook
262 :group 'scheme)
264 (defcustom dsssl-mode-hook nil
265 "Normal hook run when entering `dsssl-mode'.
266 See `run-hooks'."
267 :type 'hook
268 :group 'scheme)
270 ;; This is shared by cmuscheme and xscheme.
271 (defcustom scheme-program-name "scheme"
272 "*Program invoked by the `run-scheme' command."
273 :type 'string
274 :group 'scheme)
276 (defvar dsssl-imenu-generic-expression
277 ;; Perhaps this should also look for the style-sheet DTD tags. I'm
278 ;; not sure it's the best way to organize it; perhaps one type
279 ;; should be at the first level, though you don't see this anyhow if
280 ;; it gets split up.
281 '(("Defines"
282 "^(define\\s-+(?\\(\\sw+\\)" 1)
283 ("Modes"
284 "^\\s-*(mode\\s-+\\(\\(\\sw\\|\\s-\\)+\\)" 1)
285 ("Elements"
286 ;; (element foo ...) or (element (foo bar ...) ...)
287 ;; Fixme: Perhaps it should do `root'.
288 "^\\s-*(element\\s-+(?\\(\\(\\sw\\|\\s-\\)+\\))?" 1)
289 ("Declarations"
290 "^(declare\\(-\\sw+\\)+\\>\\s-+\\(\\sw+\\)" 2))
291 "Imenu generic expression for DSSSL mode. See `imenu-generic-expression'.")
293 (defconst scheme-font-lock-keywords-1
294 (eval-when-compile
295 (list
297 ;; Declarations. Hannes Haug <hannes.haug@student.uni-tuebingen.de> says
298 ;; this works for SOS, STklos, SCOOPS, Meroon and Tiny CLOS.
299 (list (concat "(\\(define\\*?\\("
300 ;; Function names.
301 "\\(\\|-public\\|-method\\|-generic\\(-procedure\\)?\\)\\|"
302 ;; Macro names, as variable names. A bit dubious, this.
303 "\\(-syntax\\|-macro\\)\\|"
304 ;; Class names.
305 "-class"
306 ;; Guile modules.
307 "\\|-module"
308 "\\)\\)\\>"
309 ;; Any whitespace and declared object.
310 "[ \t]*(?"
311 "\\(\\sw+\\)?")
312 '(1 font-lock-keyword-face)
313 '(6 (cond ((match-beginning 3) font-lock-function-name-face)
314 ((match-beginning 5) font-lock-variable-name-face)
315 (t font-lock-type-face))
316 nil t))
318 "Subdued expressions to highlight in Scheme modes.")
320 (defconst scheme-font-lock-keywords-2
321 (append scheme-font-lock-keywords-1
322 (eval-when-compile
323 (list
325 ;; Control structures.
326 (cons
327 (concat
328 "(" (regexp-opt
329 '("begin" "call-with-current-continuation" "call/cc"
330 "call-with-input-file" "call-with-output-file" "case" "cond"
331 "do" "else" "for-each" "if" "lambda"
332 "let" "let*" "let-syntax" "letrec" "letrec-syntax"
333 ;; SRFI 11 usage comes up often enough.
334 "let-values" "let*-values"
335 ;; Hannes Haug <hannes.haug@student.uni-tuebingen.de> wants:
336 "and" "or" "delay" "force"
337 ;; Stefan Monnier <stefan.monnier@epfl.ch> says don't bother:
338 ;;"quasiquote" "quote" "unquote" "unquote-splicing"
339 "map" "syntax" "syntax-rules") t)
340 "\\>") 1)
342 ;; It wouldn't be Scheme w/o named-let.
343 '("(let\\s-+\\(\\sw+\\)"
344 (1 font-lock-function-name-face))
346 ;; David Fox <fox@graphics.cs.nyu.edu> for SOS/STklos class specifiers.
347 '("\\<<\\sw+>\\>" . font-lock-type-face)
349 ;; Scheme `:' and `#:' keywords as builtins.
350 '("\\<#?:\\sw+\\>" . font-lock-builtin-face)
352 "Gaudy expressions to highlight in Scheme modes.")
354 (defvar scheme-font-lock-keywords scheme-font-lock-keywords-1
355 "Default expressions to highlight in Scheme modes.")
357 (defconst scheme-sexp-comment-syntax-table
358 (let ((st (make-syntax-table scheme-mode-syntax-table)))
359 (modify-syntax-entry ?\; "." st)
360 (modify-syntax-entry ?\n " " st)
361 (modify-syntax-entry ?# "'" st)
362 st))
364 (put 'lambda 'scheme-doc-string-elt 2)
365 ;; Docstring's pos in a `define' depends on whether it's a var or fun def.
366 (put 'define 'scheme-doc-string-elt
367 (lambda ()
368 ;; The function is called with point right after "define".
369 (forward-comment (point-max))
370 (if (eq (char-after) ?\() 2 0)))
372 (defun scheme-font-lock-syntactic-face-function (state)
373 (when (and (null (nth 3 state))
374 (eq (char-after (nth 8 state)) ?#)
375 (eq (char-after (1+ (nth 8 state))) ?\;))
376 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
377 (save-excursion
378 (let ((pos (point))
379 (end
380 (condition-case err
381 (let ((parse-sexp-lookup-properties nil))
382 (goto-char (+ 2 (nth 8 state)))
383 ;; FIXME: this doesn't handle the case where the sexp
384 ;; itself contains a #; comment.
385 (forward-sexp 1)
386 (point))
387 (scan-error (nth 2 err)))))
388 (when (< pos (- end 2))
389 (put-text-property pos (- end 2)
390 'syntax-table scheme-sexp-comment-syntax-table))
391 (put-text-property (- end 1) end 'syntax-table '(12)))))
392 ;; Choose the face to use.
393 (lisp-font-lock-syntactic-face-function state))
395 ;;;###autoload
396 (define-derived-mode dsssl-mode scheme-mode "DSSSL"
397 "Major mode for editing DSSSL code.
398 Editing commands are similar to those of `lisp-mode'.
400 Commands:
401 Delete converts tabs to spaces as it moves back.
402 Blank lines separate paragraphs. Semicolons start comments.
403 \\{scheme-mode-map}
404 Entering this mode runs the hooks `scheme-mode-hook' and then
405 `dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if
406 that variable's value is a string."
407 (make-local-variable 'page-delimiter)
408 (setq page-delimiter "^;;;" ; ^L not valid SGML char
409 major-mode 'dsssl-mode
410 mode-name "DSSSL")
411 ;; Insert a suitable SGML declaration into an empty buffer.
412 ;; FIXME: This should use `auto-insert-alist' instead.
413 (and (zerop (buffer-size))
414 (stringp dsssl-sgml-declaration)
415 (not buffer-read-only)
416 (insert dsssl-sgml-declaration))
417 (setq font-lock-defaults '(dsssl-font-lock-keywords
418 nil t (("+-*/.<>=?$%_&~^:" . "w"))
419 beginning-of-defun
420 (font-lock-mark-block-function . mark-defun)))
421 (set (make-local-variable 'imenu-case-fold-search) nil)
422 (setq imenu-generic-expression dsssl-imenu-generic-expression)
423 (set (make-local-variable 'imenu-syntax-alist)
424 '(("+-*/.<>=?$%_&~^:" . "w"))))
426 ;; Extra syntax for DSSSL. This isn't separated from Scheme, but
427 ;; shouldn't cause much trouble in scheme-mode.
428 (put 'element 'scheme-indent-function 1)
429 (put 'mode 'scheme-indent-function 1)
430 (put 'with-mode 'scheme-indent-function 1)
431 (put 'make 'scheme-indent-function 1)
432 (put 'style 'scheme-indent-function 1)
433 (put 'root 'scheme-indent-function 1)
435 (defvar dsssl-font-lock-keywords
436 (eval-when-compile
437 (list
438 ;; Similar to Scheme
439 (list "(\\(define\\(-\\w+\\)?\\)\\>[ ]*\\\((?\\)\\(\\sw+\\)\\>"
440 '(1 font-lock-keyword-face)
441 '(4 font-lock-function-name-face))
442 (cons
443 (concat "(\\("
444 ;; (make-regexp '("case" "cond" "else" "if" "lambda"
445 ;; "let" "let*" "letrec" "and" "or" "map" "with-mode"))
446 "and\\|c\\(ase\\|ond\\)\\|else\\|if\\|"
447 "l\\(ambda\\|et\\(\\|*\\|rec\\)\\)\\|map\\|or\\|with-mode"
448 "\\)\\>")
450 ;; DSSSL syntax
451 '("(\\(element\\|mode\\|declare-\\w+\\)\\>[ ]*\\(\\sw+\\)"
452 (1 font-lock-keyword-face)
453 (2 font-lock-type-face))
454 '("(\\(element\\)\\>[ ]*(\\(\\S)+\\))"
455 (1 font-lock-keyword-face)
456 (2 font-lock-type-face))
457 '("\\<\\sw+:\\>" . font-lock-constant-face) ; trailing `:' c.f. scheme
458 ;; SGML markup (from sgml-mode) :
459 '("<\\([!?][-a-z0-9]+\\)" 1 font-lock-keyword-face)
460 '("<\\(/?[-a-z0-9]+\\)" 1 font-lock-function-name-face)))
461 "Default expressions to highlight in DSSSL mode.")
464 (defvar calculate-lisp-indent-last-sexp)
466 ;; Copied from lisp-indent-function, but with gets of
467 ;; scheme-indent-{function,hook}.
468 (defun scheme-indent-function (indent-point state)
469 (let ((normal-indent (current-column)))
470 (goto-char (1+ (elt state 1)))
471 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
472 (if (and (elt state 2)
473 (not (looking-at "\\sw\\|\\s_")))
474 ;; car of form doesn't seem to be a symbol
475 (progn
476 (if (not (> (save-excursion (forward-line 1) (point))
477 calculate-lisp-indent-last-sexp))
478 (progn (goto-char calculate-lisp-indent-last-sexp)
479 (beginning-of-line)
480 (parse-partial-sexp (point)
481 calculate-lisp-indent-last-sexp 0 t)))
482 ;; Indent under the list or under the first sexp on the same
483 ;; line as calculate-lisp-indent-last-sexp. Note that first
484 ;; thing on that line has to be complete sexp since we are
485 ;; inside the innermost containing sexp.
486 (backward-prefix-chars)
487 (current-column))
488 (let ((function (buffer-substring (point)
489 (progn (forward-sexp 1) (point))))
490 method)
491 (setq method (or (get (intern-soft function) 'scheme-indent-function)
492 (get (intern-soft function) 'scheme-indent-hook)))
493 (cond ((or (eq method 'defun)
494 (and (null method)
495 (> (length function) 3)
496 (string-match "\\`def" function)))
497 (lisp-indent-defform state indent-point))
498 ((integerp method)
499 (lisp-indent-specform method state
500 indent-point normal-indent))
501 (method
502 (funcall method state indent-point normal-indent)))))))
505 ;;; Let is different in Scheme
507 (defun would-be-symbol (string)
508 (not (string-equal (substring string 0 1) "(")))
510 (defun next-sexp-as-string ()
511 ;; Assumes that it is protected by a save-excursion
512 (forward-sexp 1)
513 (let ((the-end (point)))
514 (backward-sexp 1)
515 (buffer-substring (point) the-end)))
517 ;; This is correct but too slow.
518 ;; The one below works almost always.
519 ;;(defun scheme-let-indent (state indent-point)
520 ;; (if (would-be-symbol (next-sexp-as-string))
521 ;; (scheme-indent-specform 2 state indent-point)
522 ;; (scheme-indent-specform 1 state indent-point)))
524 (defun scheme-let-indent (state indent-point normal-indent)
525 (skip-chars-forward " \t")
526 (if (looking-at "[-a-zA-Z0-9+*/?!@$%^&_:~]")
527 (lisp-indent-specform 2 state indent-point normal-indent)
528 (lisp-indent-specform 1 state indent-point normal-indent)))
530 ;; (put 'begin 'scheme-indent-function 0), say, causes begin to be indented
531 ;; like defun if the first form is placed on the next line, otherwise
532 ;; it is indented like any other form (i.e. forms line up under first).
534 (put 'begin 'scheme-indent-function 0)
535 (put 'case 'scheme-indent-function 1)
536 (put 'delay 'scheme-indent-function 0)
537 (put 'do 'scheme-indent-function 2)
538 (put 'lambda 'scheme-indent-function 1)
539 (put 'let 'scheme-indent-function 'scheme-let-indent)
540 (put 'let* 'scheme-indent-function 1)
541 (put 'letrec 'scheme-indent-function 1)
542 (put 'let-values 'scheme-indent-function 1) ; SRFI 11
543 (put 'let*-values 'scheme-indent-function 1) ; SRFI 11
544 (put 'sequence 'scheme-indent-function 0) ; SICP, not r4rs
545 (put 'let-syntax 'scheme-indent-function 1)
546 (put 'letrec-syntax 'scheme-indent-function 1)
547 (put 'syntax-rules 'scheme-indent-function 1)
548 (put 'syntax-case 'scheme-indent-function 2) ; not r5rs
550 (put 'call-with-input-file 'scheme-indent-function 1)
551 (put 'with-input-from-file 'scheme-indent-function 1)
552 (put 'with-input-from-port 'scheme-indent-function 1)
553 (put 'call-with-output-file 'scheme-indent-function 1)
554 (put 'with-output-to-file 'scheme-indent-function 1)
555 (put 'with-output-to-port 'scheme-indent-function 1)
556 (put 'call-with-values 'scheme-indent-function 1) ; r5rs?
557 (put 'dynamic-wind 'scheme-indent-function 3) ; r5rs?
559 ;;;; MIT Scheme specific indentation.
561 (if scheme-mit-dialect
562 (progn
563 (put 'fluid-let 'scheme-indent-function 1)
564 (put 'in-package 'scheme-indent-function 1)
565 (put 'local-declare 'scheme-indent-function 1)
566 (put 'macro 'scheme-indent-function 1)
567 (put 'make-environment 'scheme-indent-function 0)
568 (put 'named-lambda 'scheme-indent-function 1)
569 (put 'using-syntax 'scheme-indent-function 1)
571 (put 'with-input-from-string 'scheme-indent-function 1)
572 (put 'with-output-to-string 'scheme-indent-function 0)
573 (put 'with-values 'scheme-indent-function 1)
575 (put 'syntax-table-define 'scheme-indent-function 2)
576 (put 'list-transform-positive 'scheme-indent-function 1)
577 (put 'list-transform-negative 'scheme-indent-function 1)
578 (put 'list-search-positive 'scheme-indent-function 1)
579 (put 'list-search-negative 'scheme-indent-function 1)
581 (put 'access-components 'scheme-indent-function 1)
582 (put 'assignment-components 'scheme-indent-function 1)
583 (put 'combination-components 'scheme-indent-function 1)
584 (put 'comment-components 'scheme-indent-function 1)
585 (put 'conditional-components 'scheme-indent-function 1)
586 (put 'disjunction-components 'scheme-indent-function 1)
587 (put 'declaration-components 'scheme-indent-function 1)
588 (put 'definition-components 'scheme-indent-function 1)
589 (put 'delay-components 'scheme-indent-function 1)
590 (put 'in-package-components 'scheme-indent-function 1)
591 (put 'lambda-components 'scheme-indent-function 1)
592 (put 'lambda-components* 'scheme-indent-function 1)
593 (put 'lambda-components** 'scheme-indent-function 1)
594 (put 'open-block-components 'scheme-indent-function 1)
595 (put 'pathname-components 'scheme-indent-function 1)
596 (put 'procedure-components 'scheme-indent-function 1)
597 (put 'sequence-components 'scheme-indent-function 1)
598 (put 'unassigned\?-components 'scheme-indent-function 1)
599 (put 'unbound\?-components 'scheme-indent-function 1)
600 (put 'variable-components 'scheme-indent-function 1)))
602 (provide 'scheme)
604 ;; arch-tag: a8f06bc1-ad11-42d2-9e36-ce651df37a90
605 ;;; scheme.el ends here