annotate lisp/progmodes/scheme.el @ 112395:f1de024f822c

* nsterm.m (keyDown): If ns_right_alternate_modifier is Qleft, check if ns_alternate_modifier is none.
author Jan D. <jan.h.d@swipnet.se>
date Fri, 21 Jan 2011 09:35:30 +0100
parents ef719132ddfa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 33487
diff changeset
1 ;;; scheme.el --- Scheme (and DSSSL) editing mode
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
68773
dc49655f57ae Update copyright for 2006.
Nick Roberts <nickrob@snap.net.nz>
parents: 66963
diff changeset
3 ;; Copyright (C) 1986, 1987, 1988, 1997, 1998, 2001, 2002, 2003, 2004, 2005,
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
4 ;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
5
17976
852464ce5d6a Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17578
diff changeset
6 ;; Author: Bill Rozas <jinx@martigny.ai.mit.edu>
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
7 ;; Adapted-by: Dave Love <d.love@dl.ac.uk>
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
8 ;; Keywords: languages, lisp
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
9
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94187
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94187
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94187
diff changeset
15 ;; (at your option) any later version.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94187
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
25 ;;; Commentary:
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
27 ;; The major mode for editing Scheme-type Lisp code, very similar to
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
28 ;; the Lisp mode documented in the Emacs manual. `dsssl-mode' is a
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
29 ;; variant of scheme-mode for editing DSSSL specifications for SGML
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
30 ;; documents. [As of Apr 1997, some pointers for DSSSL may be found,
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
31 ;; for instance, at <URL:http://www.sil.org/sgml/related.html#dsssl>.]
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
32 ;; All these Lisp-ish modes vary basically in details of the language
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
33 ;; syntax they highlight/indent/index, but dsssl-mode uses "^;;;" as
80045
6e1ffbecad0b *** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents: 79717
diff changeset
34 ;; the page-delimiter since ^L isn't normally a valid SGML character.
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
35 ;;
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
36 ;; For interacting with a Scheme interpreter See also `run-scheme' in
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
37 ;; the `cmuscheme' package and also the implementation-specific
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
38 ;; `xscheme' package.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
40 ;; Here's a recipe to generate a TAGS file for DSSSL, by the way:
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
41 ;; etags --lang=scheme --regex='/[ \t]*(\(mode\|element\)[ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
42 ;; ]+\([^ \t(
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
43 ;; ]+\)/\2/' --regex='/[ \t]*(element[ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
44 ;; ]*([^)]+[ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
45 ;; ]+\([^)]+\)[ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
46 ;; ]*)/\1/' --regex='/(declare[^ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
47 ;; ]*[ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
48 ;; ]+\([^ \t
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
49 ;; ]+\)/\1/' "$@"
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
50
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
51 ;;; Code:
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
53 (require 'lisp-mode)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
54
49732
ada6655eb465 (scheme-mode-syntax-table): Don't switch the current buffer's syntax-table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48074
diff changeset
55 (defvar scheme-mode-syntax-table
ada6655eb465 (scheme-mode-syntax-table): Don't switch the current buffer's syntax-table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48074
diff changeset
56 (let ((st (make-syntax-table))
ada6655eb465 (scheme-mode-syntax-table): Don't switch the current buffer's syntax-table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48074
diff changeset
57 (i 0))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
59 ;; Default is atom-constituent.
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
60 (while (< i 256)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
61 (modify-syntax-entry i "_ " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
62 (setq i (1+ i)))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
64 ;; Word components.
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
65 (setq i ?0)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
66 (while (<= i ?9)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
67 (modify-syntax-entry i "w " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
68 (setq i (1+ i)))
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
69 (setq i ?A)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
70 (while (<= i ?Z)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
71 (modify-syntax-entry i "w " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
72 (setq i (1+ i)))
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
73 (setq i ?a)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
74 (while (<= i ?z)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
75 (modify-syntax-entry i "w " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
76 (setq i (1+ i)))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
78 ;; Whitespace
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
79 (modify-syntax-entry ?\t " " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
80 (modify-syntax-entry ?\n "> " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
81 (modify-syntax-entry ?\f " " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
82 (modify-syntax-entry ?\r " " st)
64050
a81b0edd5034 (scheme): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 61173
diff changeset
83 (modify-syntax-entry ?\s " " st)
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
85 ;; These characters are delimiters but otherwise undefined.
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
86 ;; Brackets and braces balance for editing convenience.
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
87 (modify-syntax-entry ?\[ "(] " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
88 (modify-syntax-entry ?\] ")[ " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
89 (modify-syntax-entry ?{ "(} " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
90 (modify-syntax-entry ?} "){ " st)
65850
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
91 (modify-syntax-entry ?\| "\" 23bn" st)
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
92 ;; Guile allows #! ... !# comments.
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
93 ;; But SRFI-22 defines the comment as #!...\n instead.
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
94 ;; Also Guile says that the !# should be on a line of its own.
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
95 ;; It's too difficult to get it right, for too little benefit.
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
96 ;; (modify-syntax-entry ?! "_ 2" st)
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
98 ;; Other atom delimiters
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
99 (modify-syntax-entry ?\( "() " st)
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
100 (modify-syntax-entry ?\) ")( " st)
65853
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
101 ;; It's used for single-line comments as well as for #;(...) sexp-comments.
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
102 (modify-syntax-entry ?\; "< 2 " st)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
103 (modify-syntax-entry ?\" "\" " st)
50678
106688eb08d8 (scheme-mode-syntax-table): Use prefix syntax for ', `, comma, @ and #.
Richard M. Stallman <rms@gnu.org>
parents: 50070
diff changeset
104 (modify-syntax-entry ?' "' " st)
106688eb08d8 (scheme-mode-syntax-table): Use prefix syntax for ', `, comma, @ and #.
Richard M. Stallman <rms@gnu.org>
parents: 50070
diff changeset
105 (modify-syntax-entry ?` "' " st)
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
107 ;; Special characters
50678
106688eb08d8 (scheme-mode-syntax-table): Use prefix syntax for ', `, comma, @ and #.
Richard M. Stallman <rms@gnu.org>
parents: 50070
diff changeset
108 (modify-syntax-entry ?, "' " st)
106688eb08d8 (scheme-mode-syntax-table): Use prefix syntax for ', `, comma, @ and #.
Richard M. Stallman <rms@gnu.org>
parents: 50070
diff changeset
109 (modify-syntax-entry ?@ "' " st)
109757
818e325e0469 Introduce a new comment style "c" flag.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106815
diff changeset
110 (modify-syntax-entry ?# "' 14" st)
50070
25c2d7555a11 (scheme-mode-syntax-table): Construct
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49732
diff changeset
111 (modify-syntax-entry ?\\ "\\ " st)
49732
ada6655eb465 (scheme-mode-syntax-table): Don't switch the current buffer's syntax-table.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48074
diff changeset
112 st))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
114 (defvar scheme-mode-abbrev-table nil)
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (define-abbrev-table 'scheme-mode-abbrev-table ())
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
117 (defvar scheme-imenu-generic-expression
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
118 '((nil
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
119 "^(define\\(\\|-\\(generic\\(\\|-procedure\\)\\|method\\)\\)*\\s-+(?\\(\\sw+\\)" 4)
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
120 ("Types"
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
121 "^(define-class\\s-+(?\\(\\sw+\\)" 1)
21632
1f3afd785962 (scheme-imenu-generic-expression,
Dave Love <fx@gnu.org>
parents: 21133
diff changeset
122 ("Macros"
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
123 "^(\\(defmacro\\|define-macro\\|define-syntax\\)\\s-+(?\\(\\sw+\\)" 2))
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
124 "Imenu generic expression for Scheme mode. See `imenu-generic-expression'.")
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
125
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defun scheme-mode-variables ()
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (set-syntax-table scheme-mode-syntax-table)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (setq local-abbrev-table scheme-mode-abbrev-table)
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
129 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
130 (set (make-local-variable 'paragraph-separate) paragraph-start)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
131 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
132 (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph)
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
133 ;; Adaptive fill mode gets in the way of auto-fill,
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
134 ;; and should make no difference for explicit fill
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
135 ;; because lisp-fill-paragraph should do the job.
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
136 (set (make-local-variable 'adaptive-fill-mode) nil)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
137 (set (make-local-variable 'indent-line-function) 'lisp-indent-line)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
138 (set (make-local-variable 'parse-sexp-ignore-comments) t)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
139 (set (make-local-variable 'outline-regexp) ";;; \\|(....")
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
140 (set (make-local-variable 'comment-start) ";")
59761
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
141 (set (make-local-variable 'comment-add) 1)
15598
c5f04e0724ec (scheme-mode-variables): Set comment-start-skip to ignore backslash-quoted
Miles Bader <miles@gnu.org>
parents: 14169
diff changeset
142 ;; Look within the line for a ; following an even number of backslashes
c5f04e0724ec (scheme-mode-variables): Set comment-start-skip to ignore backslash-quoted
Miles Bader <miles@gnu.org>
parents: 14169
diff changeset
143 ;; after either a non-backslash or the line beginning.
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
144 (set (make-local-variable 'comment-start-skip)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
145 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
78591
b9750e17698c (scheme-mode-variables): Set font-lock-comment-start-skip.
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
146 (set (make-local-variable 'font-lock-comment-start-skip) ";+ *")
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
147 (set (make-local-variable 'comment-column) 40)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
148 (set (make-local-variable 'parse-sexp-ignore-comments) t)
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
149 (set (make-local-variable 'lisp-indent-function) 'scheme-indent-function)
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
150 (setq mode-line-process '("" scheme-mode-line-process))
32375
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
151 (set (make-local-variable 'imenu-case-fold-search) t)
20459
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 20334
diff changeset
152 (setq imenu-generic-expression scheme-imenu-generic-expression)
32375
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
153 (set (make-local-variable 'imenu-syntax-alist)
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
154 '(("+-*/.<>=?!$%_&~^:" . "w")))
65853
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
155 (set (make-local-variable 'font-lock-defaults)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
156 '((scheme-font-lock-keywords
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
157 scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
158 nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
159 beginning-of-defun
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
160 (font-lock-mark-block-function . mark-defun)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
161 (font-lock-syntactic-face-function
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
162 . scheme-font-lock-syntactic-face-function)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
163 (parse-sexp-lookup-properties . t)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
164 (font-lock-extra-managed-props syntax-table)))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
165 (set (make-local-variable 'lisp-doc-string-elt-property)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
166 'scheme-doc-string-elt))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (defvar scheme-mode-line-process "")
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169
59761
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
170 (defvar scheme-mode-map
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
171 (let ((smap (make-sparse-keymap))
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
172 (map (make-sparse-keymap "Scheme")))
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
173 (set-keymap-parent smap lisp-mode-shared-map)
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
174 (define-key smap [menu-bar scheme] (cons "Scheme" map))
33483
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
175 (define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme))
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
176 (define-key map [uncomment-region]
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
177 '("Uncomment Out Region" . (lambda (beg end)
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
178 (interactive "r")
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
179 (comment-region beg end '(4)))))
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
180 (define-key map [comment-region] '("Comment Out Region" . comment-region))
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
181 (define-key map [indent-region] '("Indent Region" . indent-region))
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
182 (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
183 (put 'comment-region 'menu-enable 'mark-active)
ed634043ad08 Fix bogus last checkin.
Dave Love <fx@gnu.org>
parents: 33480
diff changeset
184 (put 'uncomment-region 'menu-enable 'mark-active)
59761
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
185 (put 'indent-region 'menu-enable 'mark-active)
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
186 smap)
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
187 "Keymap for Scheme mode.
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
188 All commands in `lisp-mode-shared-map' are inherited by this map.")
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
189
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
190 ;; Used by cmuscheme
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 (defun scheme-mode-commands (map)
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
192 ;;(define-key map "\t" 'indent-for-tab-command) ; default
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (define-key map "\177" 'backward-delete-char-untabify)
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
194 (define-key map "\e\C-q" 'indent-sexp))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195
266
e0142855e083 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 65
diff changeset
196 ;;;###autoload
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
197 (define-derived-mode scheme-mode prog-mode "Scheme"
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 "Major mode for editing Scheme code.
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
199 Editing commands are similar to those of `lisp-mode'.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 In addition, if an inferior Scheme process is running, some additional
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 commands will be defined, for evaluating expressions and controlling
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 the interpreter, and the state of the process will be displayed in the
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 modeline of all Scheme buffers. The names of commands that interact
32375
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
205 with the Scheme process start with \"xscheme-\" if you use the MIT
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
206 Scheme-specific `xscheme' package; for more information see the
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
207 documentation for `xscheme-interaction-mode'. Use \\[run-scheme] to
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
208 start an inferior Scheme using the more general `cmuscheme' package.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 Commands:
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 Delete converts tabs to spaces as it moves back.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 Blank lines separate paragraphs. Semicolons start comments.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 \\{scheme-mode-map}
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
214 Entry to this mode calls the value of `scheme-mode-hook'
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 if that value is non-nil."
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
216 (scheme-mode-variables))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
218 (defgroup scheme nil
64050
a81b0edd5034 (scheme): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 61173
diff changeset
219 "Editing Scheme code."
66963
a11fdee52c05 Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66597
diff changeset
220 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
221 :group 'lisp)
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
222
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
223 (defcustom scheme-mit-dialect t
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 "If non-nil, scheme mode is specialized for MIT Scheme.
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
225 Set this to nil if you normally use another dialect."
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
226 :type 'boolean
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
227 :group 'scheme)
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
228
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
229 (defcustom dsssl-sgml-declaration
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
230 "<!DOCTYPE style-sheet PUBLIC \"-//James Clark//DTD DSSSL Style Sheet//EN\">
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
231 "
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
232 "*An SGML declaration for the DSSSL file.
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
233 If it is defined as a string this will be inserted into an empty buffer
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
234 which is in `dsssl-mode'. It is typically James Clark's style-sheet
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
235 doctype, as required for Jade."
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
236 :type '(choice (string :tag "Specified string")
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
237 (const :tag "None" :value nil))
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
238 :group 'scheme)
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
239
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
240 (defcustom scheme-mode-hook nil
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
241 "Normal hook run when entering `scheme-mode'.
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
242 See `run-hooks'."
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
243 :type 'hook
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
244 :group 'scheme)
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
245
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
246 (defcustom dsssl-mode-hook nil
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
247 "Normal hook run when entering `dsssl-mode'.
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
248 See `run-hooks'."
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
249 :type 'hook
18285
d38d2b26bd52 (scheme): Add defgroup.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
250 :group 'scheme)
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251
33487
71de6ba64af7 Fix again.
Dave Love <fx@gnu.org>
parents: 33483
diff changeset
252 ;; This is shared by cmuscheme and xscheme.
71de6ba64af7 Fix again.
Dave Love <fx@gnu.org>
parents: 33483
diff changeset
253 (defcustom scheme-program-name "scheme"
71de6ba64af7 Fix again.
Dave Love <fx@gnu.org>
parents: 33483
diff changeset
254 "*Program invoked by the `run-scheme' command."
71de6ba64af7 Fix again.
Dave Love <fx@gnu.org>
parents: 33483
diff changeset
255 :type 'string
71de6ba64af7 Fix again.
Dave Love <fx@gnu.org>
parents: 33483
diff changeset
256 :group 'scheme)
71de6ba64af7 Fix again.
Dave Love <fx@gnu.org>
parents: 33483
diff changeset
257
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
258 (defvar dsssl-imenu-generic-expression
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
259 ;; Perhaps this should also look for the style-sheet DTD tags. I'm
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
260 ;; not sure it's the best way to organize it; perhaps one type
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
261 ;; should be at the first level, though you don't see this anyhow if
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
262 ;; it gets split up.
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
263 '(("Defines"
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
264 "^(define\\s-+(?\\(\\sw+\\)" 1)
21632
1f3afd785962 (scheme-imenu-generic-expression,
Dave Love <fx@gnu.org>
parents: 21133
diff changeset
265 ("Modes"
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
266 "^\\s-*(mode\\s-+\\(\\(\\sw\\|\\s-\\)+\\)" 1)
21632
1f3afd785962 (scheme-imenu-generic-expression,
Dave Love <fx@gnu.org>
parents: 21133
diff changeset
267 ("Elements"
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
268 ;; (element foo ...) or (element (foo bar ...) ...)
17578
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
269 ;; Fixme: Perhaps it should do `root'.
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
270 "^\\s-*(element\\s-+(?\\(\\(\\sw\\|\\s-\\)+\\))?" 1)
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
271 ("Declarations"
20891
0b58035a48ca (scheme-imenu-generic-expression): Simplify regexps.
Dave Love <fx@gnu.org>
parents: 20461
diff changeset
272 "^(declare\\(-\\sw+\\)+\\>\\s-+\\(\\sw+\\)" 2))
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
273 "Imenu generic expression for DSSSL mode. See `imenu-generic-expression'.")
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
274
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
275 (defconst scheme-font-lock-keywords-1
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
276 (eval-when-compile
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
277 (list
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
278 ;;
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
279 ;; Declarations. Hannes Haug <hannes.haug@student.uni-tuebingen.de> says
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
280 ;; this works for SOS, STklos, SCOOPS, Meroon and Tiny CLOS.
22709
5fc9fd384c5c (scheme-font-lock-keywords-1): Fontify SCWM/Guile
Richard M. Stallman <rms@gnu.org>
parents: 21632
diff changeset
281 (list (concat "(\\(define\\*?\\("
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
282 ;; Function names.
22709
5fc9fd384c5c (scheme-font-lock-keywords-1): Fontify SCWM/Guile
Richard M. Stallman <rms@gnu.org>
parents: 21632
diff changeset
283 "\\(\\|-public\\|-method\\|-generic\\(-procedure\\)?\\)\\|"
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
284 ;; Macro names, as variable names. A bit dubious, this.
32375
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
285 "\\(-syntax\\|-macro\\)\\|"
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
286 ;; Class names.
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
287 "-class"
22709
5fc9fd384c5c (scheme-font-lock-keywords-1): Fontify SCWM/Guile
Richard M. Stallman <rms@gnu.org>
parents: 21632
diff changeset
288 ;; Guile modules.
5fc9fd384c5c (scheme-font-lock-keywords-1): Fontify SCWM/Guile
Richard M. Stallman <rms@gnu.org>
parents: 21632
diff changeset
289 "\\|-module"
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
290 "\\)\\)\\>"
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
291 ;; Any whitespace and declared object.
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
292 "[ \t]*(?"
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
293 "\\(\\sw+\\)?")
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
294 '(1 font-lock-keyword-face)
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
295 '(6 (cond ((match-beginning 3) font-lock-function-name-face)
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
296 ((match-beginning 5) font-lock-variable-name-face)
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
297 (t font-lock-type-face))
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
298 nil t))
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
299 ))
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
300 "Subdued expressions to highlight in Scheme modes.")
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
301
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
302 (defconst scheme-font-lock-keywords-2
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
303 (append scheme-font-lock-keywords-1
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
304 (eval-when-compile
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
305 (list
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
306 ;;
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
307 ;; Control structures.
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
308 (cons
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
309 (concat
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
310 "(" (regexp-opt
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
311 '("begin" "call-with-current-continuation" "call/cc"
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
312 "call-with-input-file" "call-with-output-file" "case" "cond"
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
313 "do" "else" "for-each" "if" "lambda"
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
314 "let" "let*" "let-syntax" "letrec" "letrec-syntax"
92103
51d024394524 (scheme-font-lock-keywords-2): Add SRFI 11 support.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 79717
diff changeset
315 ;; SRFI 11 usage comes up often enough.
51d024394524 (scheme-font-lock-keywords-2): Add SRFI 11 support.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 79717
diff changeset
316 "let-values" "let*-values"
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
317 ;; Hannes Haug <hannes.haug@student.uni-tuebingen.de> wants:
53589
5e2f11c3b2a9 (scheme-font-lock-keywords-2): Add "force".
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52677
diff changeset
318 "and" "or" "delay" "force"
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
319 ;; Stefan Monnier <stefan.monnier@epfl.ch> says don't bother:
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
320 ;;"quasiquote" "quote" "unquote" "unquote-splicing"
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
321 "map" "syntax" "syntax-rules") t)
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
322 "\\>") 1)
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
323 ;;
60180
d5618f820425 (scheme-font-lock-keywords-2): Handle named-let.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 59761
diff changeset
324 ;; It wouldn't be Scheme w/o named-let.
d5618f820425 (scheme-font-lock-keywords-2): Handle named-let.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 59761
diff changeset
325 '("(let\\s-+\\(\\sw+\\)"
d5618f820425 (scheme-font-lock-keywords-2): Handle named-let.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 59761
diff changeset
326 (1 font-lock-function-name-face))
d5618f820425 (scheme-font-lock-keywords-2): Handle named-let.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 59761
diff changeset
327 ;;
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
328 ;; David Fox <fox@graphics.cs.nyu.edu> for SOS/STklos class specifiers.
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
329 '("\\<<\\sw+>\\>" . font-lock-type-face)
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
330 ;;
52677
a4cf4569e557 (scheme-mode-variables): When setting
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
331 ;; Scheme `:' and `#:' keywords as builtins.
a4cf4569e557 (scheme-mode-variables): When setting
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
332 '("\\<#?:\\sw+\\>" . font-lock-builtin-face)
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
333 )))
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
334 "Gaudy expressions to highlight in Scheme modes.")
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
335
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
336 (defvar scheme-font-lock-keywords scheme-font-lock-keywords-1
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
337 "Default expressions to highlight in Scheme modes.")
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
338
65853
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
339 (defconst scheme-sexp-comment-syntax-table
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
340 (let ((st (make-syntax-table scheme-mode-syntax-table)))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
341 (modify-syntax-entry ?\; "." st)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
342 (modify-syntax-entry ?\n " " st)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
343 (modify-syntax-entry ?# "'" st)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
344 st))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
345
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
346 (put 'lambda 'scheme-doc-string-elt 2)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
347 ;; Docstring's pos in a `define' depends on whether it's a var or fun def.
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
348 (put 'define 'scheme-doc-string-elt
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
349 (lambda ()
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
350 ;; The function is called with point right after "define".
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
351 (forward-comment (point-max))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
352 (if (eq (char-after) ?\() 2 0)))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
353
65850
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
354 (defun scheme-font-lock-syntactic-face-function (state)
65853
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
355 (when (and (null (nth 3 state))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
356 (eq (char-after (nth 8 state)) ?#)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
357 (eq (char-after (1+ (nth 8 state))) ?\;))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
358 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
359 (save-excursion
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
360 (let ((pos (point))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
361 (end
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
362 (condition-case err
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
363 (let ((parse-sexp-lookup-properties nil))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
364 (goto-char (+ 2 (nth 8 state)))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
365 ;; FIXME: this doesn't handle the case where the sexp
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
366 ;; itself contains a #; comment.
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
367 (forward-sexp 1)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
368 (point))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
369 (scan-error (nth 2 err)))))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
370 (when (< pos (- end 2))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
371 (put-text-property pos (- end 2)
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
372 'syntax-table scheme-sexp-comment-syntax-table))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
373 (put-text-property (- end 1) end 'syntax-table '(12)))))
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
374 ;; Choose the face to use.
78fc6b412d17 (scheme-mode-syntax-table): Mark ; as being also the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65850
diff changeset
375 (lisp-font-lock-syntactic-face-function state))
65850
125c8f7cc7d2 (scheme-mode-syntax-table): Move the nesting bit from # to |.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65566
diff changeset
376
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
377 ;;;###autoload
59761
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
378 (define-derived-mode dsssl-mode scheme-mode "DSSSL"
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
379 "Major mode for editing DSSSL code.
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
380 Editing commands are similar to those of `lisp-mode'.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
382 Commands:
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
383 Delete converts tabs to spaces as it moves back.
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
384 Blank lines separate paragraphs. Semicolons start comments.
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
385 \\{scheme-mode-map}
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
386 Entering this mode runs the hooks `scheme-mode-hook' and then
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
387 `dsssl-mode-hook' and inserts the value of `dsssl-sgml-declaration' if
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
388 that variable's value is a string."
111870
b47e85affa59 Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 109757
diff changeset
389 (set (make-local-variable 'page-delimiter) "^;;;") ; ^L not valid SGML char
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
390 ;; Insert a suitable SGML declaration into an empty buffer.
59761
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
391 ;; FIXME: This should use `auto-insert-alist' instead.
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
392 (and (zerop (buffer-size))
17578
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
393 (stringp dsssl-sgml-declaration)
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
394 (not buffer-read-only)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
395 (insert dsssl-sgml-declaration))
21133
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
396 (setq font-lock-defaults '(dsssl-font-lock-keywords
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
397 nil t (("+-*/.<>=?$%_&~^:" . "w"))
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
398 beginning-of-defun
ea8428070d53 (scheme-mode-variables): Set font-lock-defaults locally.
Dave Love <fx@gnu.org>
parents: 20953
diff changeset
399 (font-lock-mark-block-function . mark-defun)))
32375
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
400 (set (make-local-variable 'imenu-case-fold-search) nil)
20459
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 20334
diff changeset
401 (setq imenu-generic-expression dsssl-imenu-generic-expression)
32375
b9b7ecbf8925 (scheme-mode-variables, dsssl-mode): Avoid
Dave Love <fx@gnu.org>
parents: 32367
diff changeset
402 (set (make-local-variable 'imenu-syntax-alist)
59761
6803187d322e (scheme-mode-variables): Set comment-add.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53589
diff changeset
403 '(("+-*/.<>=?$%_&~^:" . "w"))))
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
404
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
405 ;; Extra syntax for DSSSL. This isn't separated from Scheme, but
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
406 ;; shouldn't cause much trouble in scheme-mode.
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
407 (put 'element 'scheme-indent-function 1)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
408 (put 'mode 'scheme-indent-function 1)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
409 (put 'with-mode 'scheme-indent-function 1)
17402
1c01c986afc9 (make): Add scheme-indent-function property.
Richard M. Stallman <rms@gnu.org>
parents: 17359
diff changeset
410 (put 'make 'scheme-indent-function 1)
17578
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
411 (put 'style 'scheme-indent-function 1)
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
412 (put 'root 'scheme-indent-function 1)
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
413
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
414 (defvar dsssl-font-lock-keywords
17578
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
415 (eval-when-compile
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
416 (list
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
417 ;; Similar to Scheme
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
418 (list "(\\(define\\(-\\w+\\)?\\)\\>[ ]*\\\((?\\)\\(\\sw+\\)\\>"
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
419 '(1 font-lock-keyword-face)
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
420 '(4 font-lock-function-name-face))
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
421 (cons
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
422 (concat "(\\("
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
423 ;; (make-regexp '("case" "cond" "else" "if" "lambda"
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
424 ;; "let" "let*" "letrec" "and" "or" "map" "with-mode"))
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
425 "and\\|c\\(ase\\|ond\\)\\|else\\|if\\|"
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
426 "l\\(ambda\\|et\\(\\|*\\|rec\\)\\)\\|map\\|or\\|with-mode"
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
427 "\\)\\>")
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
428 1)
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
429 ;; DSSSL syntax
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
430 '("(\\(element\\|mode\\|declare-\\w+\\)\\>[ ]*\\(\\sw+\\)"
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
431 (1 font-lock-keyword-face)
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
432 (2 font-lock-type-face))
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
433 '("(\\(element\\)\\>[ ]*(\\(\\S)+\\))"
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
434 (1 font-lock-keyword-face)
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
435 (2 font-lock-type-face))
20953
f3f9df46d008 Changed font-lock-reference-face to font-lock-constant-face.
Simon Marshall <simon@gnu.org>
parents: 20891
diff changeset
436 '("\\<\\sw+:\\>" . font-lock-constant-face) ; trailing `:' c.f. scheme
17578
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
437 ;; SGML markup (from sgml-mode) :
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
438 '("<\\([!?][-a-z0-9]+\\)" 1 font-lock-keyword-face)
86a3f6bf749a (dsssl-sgml-declaration): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17402
diff changeset
439 '("<\\(/?[-a-z0-9]+\\)" 1 font-lock-function-name-face)))
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
440 "Default expressions to highlight in DSSSL mode.")
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
441
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
443 (defvar calculate-lisp-indent-last-sexp)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
444
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
445 ;; Copied from lisp-indent-function, but with gets of
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
446 ;; scheme-indent-{function,hook}.
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 (defun scheme-indent-function (indent-point state)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (let ((normal-indent (current-column)))
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
449 (goto-char (1+ (elt state 1)))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
450 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
451 (if (and (elt state 2)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
452 (not (looking-at "\\sw\\|\\s_")))
46159
bd315b9fa3f0 Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 38436
diff changeset
453 ;; car of form doesn't seem to be a symbol
17359
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
454 (progn
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
455 (if (not (> (save-excursion (forward-line 1) (point))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
456 calculate-lisp-indent-last-sexp))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
457 (progn (goto-char calculate-lisp-indent-last-sexp)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
458 (beginning-of-line)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
459 (parse-partial-sexp (point)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
460 calculate-lisp-indent-last-sexp 0 t)))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
461 ;; Indent under the list or under the first sexp on the same
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
462 ;; line as calculate-lisp-indent-last-sexp. Note that first
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
463 ;; thing on that line has to be complete sexp since we are
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
464 ;; inside the innermost containing sexp.
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
465 (backward-prefix-chars)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
466 (current-column))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
467 (let ((function (buffer-substring (point)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
468 (progn (forward-sexp 1) (point))))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
469 method)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
470 (setq method (or (get (intern-soft function) 'scheme-indent-function)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
471 (get (intern-soft function) 'scheme-indent-hook)))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
472 (cond ((or (eq method 'defun)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
473 (and (null method)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
474 (> (length function) 3)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
475 (string-match "\\`def" function)))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
476 (lisp-indent-defform state indent-point))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
477 ((integerp method)
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
478 (lisp-indent-specform method state
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
479 indent-point normal-indent))
13ebd090612a Add DSSSL mode and share code with newly required
Richard M. Stallman <rms@gnu.org>
parents: 15598
diff changeset
480 (method
20067
694a165b5b0d (scheme-let-indent): New arg NORMAL-INDENT.
Karl Heuer <kwzh@gnu.org>
parents: 18285
diff changeset
481 (funcall method state indent-point normal-indent)))))))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 ;;; Let is different in Scheme
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (defun would-be-symbol (string)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (not (string-equal (substring string 0 1) "(")))
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (defun next-sexp-as-string ()
26938
0f38ebc510d3 Small doc fixes.
Dave Love <fx@gnu.org>
parents: 22709
diff changeset
490 ;; Assumes that it is protected by a save-excursion
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 (forward-sexp 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 (let ((the-end (point)))
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 (backward-sexp 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (buffer-substring (point) the-end)))
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 ;; This is correct but too slow.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 ;; The one below works almost always.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 ;;(defun scheme-let-indent (state indent-point)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 ;; (if (would-be-symbol (next-sexp-as-string))
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 ;; (scheme-indent-specform 2 state indent-point)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 ;; (scheme-indent-specform 1 state indent-point)))
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502
20067
694a165b5b0d (scheme-let-indent): New arg NORMAL-INDENT.
Karl Heuer <kwzh@gnu.org>
parents: 18285
diff changeset
503 (defun scheme-let-indent (state indent-point normal-indent)
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 (skip-chars-forward " \t")
6310
c40e283c262b Put hyphen in a safer place in the character class.
Karl Heuer <kwzh@gnu.org>
parents: 3591
diff changeset
505 (if (looking-at "[-a-zA-Z0-9+*/?!@$%^&_:~]")
20067
694a165b5b0d (scheme-let-indent): New arg NORMAL-INDENT.
Karl Heuer <kwzh@gnu.org>
parents: 18285
diff changeset
506 (lisp-indent-specform 2 state indent-point normal-indent)
694a165b5b0d (scheme-let-indent): New arg NORMAL-INDENT.
Karl Heuer <kwzh@gnu.org>
parents: 18285
diff changeset
507 (lisp-indent-specform 1 state indent-point normal-indent)))
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 ;; (put 'begin 'scheme-indent-function 0), say, causes begin to be indented
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 ;; like defun if the first form is placed on the next line, otherwise
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 ;; it is indented like any other form (i.e. forms line up under first).
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (put 'begin 'scheme-indent-function 0)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (put 'case 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 (put 'delay 'scheme-indent-function 0)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 (put 'do 'scheme-indent-function 2)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 (put 'lambda 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (put 'let 'scheme-indent-function 'scheme-let-indent)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (put 'let* 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (put 'letrec 'scheme-indent-function 1)
92103
51d024394524 (scheme-font-lock-keywords-2): Add SRFI 11 support.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 79717
diff changeset
521 (put 'let-values 'scheme-indent-function 1) ; SRFI 11
51d024394524 (scheme-font-lock-keywords-2): Add SRFI 11 support.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 79717
diff changeset
522 (put 'let*-values 'scheme-indent-function 1) ; SRFI 11
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
523 (put 'sequence 'scheme-indent-function 0) ; SICP, not r4rs
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
524 (put 'let-syntax 'scheme-indent-function 1)
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
525 (put 'letrec-syntax 'scheme-indent-function 1)
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
526 (put 'syntax-rules 'scheme-indent-function 1)
48074
a3d1322abc88 (syntax-case): Define
Dave Love <fx@gnu.org>
parents: 46159
diff changeset
527 (put 'syntax-case 'scheme-indent-function 2) ; not r5rs
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (put 'call-with-input-file 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (put 'with-input-from-file 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 (put 'with-input-from-port 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 (put 'call-with-output-file 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 (put 'with-output-to-file 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (put 'with-output-to-port 'scheme-indent-function 1)
20461
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
535 (put 'call-with-values 'scheme-indent-function 1) ; r5rs?
3965832648d3 Define indentation in normal dialect for let-syntax,
Dave Love <fx@gnu.org>
parents: 20459
diff changeset
536 (put 'dynamic-wind 'scheme-indent-function 3) ; r5rs?
65
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 ;;;; MIT Scheme specific indentation.
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 (if scheme-mit-dialect
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (progn
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 (put 'fluid-let 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (put 'in-package 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 (put 'local-declare 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (put 'macro 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 (put 'make-environment 'scheme-indent-function 0)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 (put 'named-lambda 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 (put 'using-syntax 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (put 'with-input-from-string 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (put 'with-output-to-string 'scheme-indent-function 0)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (put 'with-values 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 (put 'syntax-table-define 'scheme-indent-function 2)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 (put 'list-transform-positive 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (put 'list-transform-negative 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 (put 'list-search-positive 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 (put 'list-search-negative 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (put 'access-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (put 'assignment-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (put 'combination-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (put 'comment-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (put 'conditional-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 (put 'disjunction-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (put 'declaration-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (put 'definition-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 (put 'delay-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (put 'in-package-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (put 'lambda-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 (put 'lambda-components* 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 (put 'lambda-components** 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 (put 'open-block-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (put 'pathname-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 (put 'procedure-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 (put 'sequence-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (put 'unassigned\?-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (put 'unbound\?-components 'scheme-indent-function 1)
cbd4df147e97 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 (put 'variable-components 'scheme-indent-function 1)))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 266
diff changeset
580
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 266
diff changeset
581 (provide 'scheme)
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
582
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
583 ;;; scheme.el ends here