comparison lisp/progmodes/tcl.el @ 25176:51eb4568f70b

Customized.
author Richard M. Stallman <rms@gnu.org>
date Wed, 04 Aug 1999 22:55:56 +0000
parents 451b28d426e6
children da3eec3be04b
comparison
equal deleted inserted replaced
25175:d780a1dc11f2 25176:51eb4568f70b
4 4
5 ;; Maintainer: Tom Tromey <tromey@busco.lanl.gov> 5 ;; Maintainer: Tom Tromey <tromey@busco.lanl.gov>
6 ;; Author: Tom Tromey <tromey@busco.lanl.gov> 6 ;; Author: Tom Tromey <tromey@busco.lanl.gov>
7 ;; Chris Lindblad <cjl@lcs.mit.edu> 7 ;; Chris Lindblad <cjl@lcs.mit.edu>
8 ;; Keywords: languages tcl modes 8 ;; Keywords: languages tcl modes
9 ;; Version: $Revision: 1.58 $ 9 ;; Version: $Revision: 1.59 $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
43 ;; * tcl-keyword-list is a list of keywords. I've generally used this 43 ;; * tcl-keyword-list is a list of keywords. I've generally used this
44 ;; for flow-control words. Eg I add "unwind_protect" to this list. 44 ;; for flow-control words. Eg I add "unwind_protect" to this list.
45 ;; * tcl-type-alist can be used to minimally customize indentation 45 ;; * tcl-type-alist can be used to minimally customize indentation
46 ;; according to context. 46 ;; according to context.
47 47
48 ;; THANKS TO: 48 ;; THANKS FOR CRITICISM AND SUGGESTIONS TO:
49 ;; Guido Bosch <Guido.Bosch@loria.fr> 49 ;; Guido Bosch <Guido.Bosch@loria.fr>
50 ;; pgs1002@esc.cam.ac.uk (Dr P.G. Sjoerdsma) 50 ;; pgs1002@esc.cam.ac.uk (Dr P.G. Sjoerdsma)
51 ;; Mike Scheidler <c23mts@kocrsv01.delcoelect.com> 51 ;; Mike Scheidler <c23mts@kocrsv01.delcoelect.com>
52 ;; Matt Newman <men@charney.colorado.edu> 52 ;; Matt Newman <men@charney.colorado.edu>
53 ;; rwhitby@research.canon.oz.au (Rod Whitby) 53 ;; rwhitby@research.canon.oz.au (Rod Whitby)
61 ;; dfarmer@evolving.com (Doug Farmer) 61 ;; dfarmer@evolving.com (Doug Farmer)
62 ;; "Chris Alfeld" <calfeld@math.utah.edu> 62 ;; "Chris Alfeld" <calfeld@math.utah.edu>
63 ;; Ben Wing <wing@666.com> 63 ;; Ben Wing <wing@666.com>
64 64
65 ;; KNOWN BUGS: 65 ;; KNOWN BUGS:
66 ;; * indent-region should skip blank lines. (It does in v19, so I'm
67 ;; not motivated to fix it here).
68 ;; * In Tcl "#" is not always a comment character. This can confuse 66 ;; * In Tcl "#" is not always a comment character. This can confuse
69 ;; tcl.el in certain circumstances. For now the only workaround is 67 ;; tcl.el in certain circumstances. For now the only workaround is
70 ;; to enclose offending hash characters in quotes or precede it with 68 ;; to enclose offending hash characters in quotes or precede it with
71 ;; a backslash. Note that using braces won't work -- quotes change 69 ;; a backslash. Note that using braces won't work -- quotes change
72 ;; the syntax class of characters between them, while braces do not. 70 ;; the syntax class of characters between them, while braces do not.
127 (if (and (string-match "19\\." emacs-version) 125 (if (and (string-match "19\\." emacs-version)
128 (not (string-match "XEmacs" emacs-version))) 126 (not (string-match "XEmacs" emacs-version)))
129 (require 'imenu)) 127 (require 'imenu))
130 ())) 128 ()))
131 129
132 (defconst tcl-version "$Revision: 1.58 $") 130 (defconst tcl-version "$Revision: 1.59 $")
133 (defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>") 131 (defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>")
134 132
135 ;; 133 ;;
136 ;; User variables. 134 ;; User variables.
137 ;; 135 ;;
138 136
139 (defvar tcl-indent-level 4 137 (defgroup tcl nil
140 "*Indentation of Tcl statements with respect to containing block.") 138 "Major mode for editing Tcl source in Emacs"
141 139 :group 'languages)
142 (defvar tcl-continued-indent-level 4 140
143 "*Indentation of continuation line relative to first line of command.") 141 (defcustom tcl-indent-level 4
144 142 "*Indentation of Tcl statements with respect to containing block."
145 (defvar tcl-auto-newline nil 143 :group 'tcl
146 "*Non-nil means automatically newline before and after braces you insert.") 144 :type 'integer)
147 145
148 (defvar tcl-tab-always-indent t 146 (defcustom tcl-continued-indent-level 4
147 "*Indentation of continuation line relative to first line of command."
148 :group 'tcl
149 :type 'integer)
150
151 (defcustom tcl-auto-newline nil
152 "*Non-nil means automatically newline before and after braces you insert."
153 :group 'tcl
154 :type 'boolean)
155
156 (defcustom tcl-tab-always-indent t
149 "*Control effect of TAB key. 157 "*Control effect of TAB key.
150 If t (the default), always indent current line. 158 If t (the default), always indent current line.
151 If nil and point is not in the indentation area at the beginning of 159 If nil and point is not in the indentation area at the beginning of
152 the line, a TAB is inserted. 160 the line, a TAB is inserted.
153 Other values cause the first possible action from the following list 161 Other values cause the first possible action from the following list
156 1. Move from beginning of line to correct indentation. 164 1. Move from beginning of line to correct indentation.
157 2. Delete an empty comment. 165 2. Delete an empty comment.
158 3. Move forward to start of comment, indenting if necessary. 166 3. Move forward to start of comment, indenting if necessary.
159 4. Move forward to end of line, indenting if necessary. 167 4. Move forward to end of line, indenting if necessary.
160 5. Create an empty comment. 168 5. Create an empty comment.
161 6. Move backward to start of comment, indenting if necessary.") 169 6. Move backward to start of comment, indenting if necessary."
162 170 :group 'tcl
163 (defvar tcl-use-hairy-comment-detector t 171 :type '(choice (const :tag "Always" t)
164 "*If not nil, use the more complicated, but slower, comment-delete method. 172 (const :tag "Beginning only" nil)
165 This variable is only used in Emacs 19; 173 (const :tag "Maybe move or make or delete comment" 'tcl)))
166 the fast function is always used in other versions.") 174
167 175
168 (defvar tcl-electric-hash-style 'smart 176 (defcustom tcl-use-hairy-comment-detector t
177 "*If not nil, use the more sophisticated, but slower, comment-delete method.
178 This variable is not effective in Emacs 18;
179 the fast function is always used in that version."
180 :group 'tcl
181 :type 'boolean)
182
183 (defcustom tcl-electric-hash-style 'smart
169 "*Style of electric hash insertion to use. 184 "*Style of electric hash insertion to use.
170 Possible values are `backslash', meaning that `\\' quoting should be 185 Possible values are `backslash', meaning that `\\' quoting should be
171 done; `quote', meaning that `\"' quoting should be done; `smart', 186 done; `quote', meaning that `\"' quoting should be done; `smart',
172 meaning that the choice between `backslash' and `quote' should be 187 meaning that the choice between `backslash' and `quote' should be
173 made depending on the number of hashes inserted; or nil, meaning that 188 made depending on the number of hashes inserted; or nil, meaning that
174 no quoting should be done. Any other value for this variable is 189 no quoting should be done. Any other value for this variable is
175 taken to mean `smart'. The default is `smart'.") 190 taken to mean `smart'. The default is `smart'."
176 191 :group 'tcl
177 (defvar tcl-help-directory-list nil 192 :type '(choice (const backslash) (const quote) (const smart) (const nil)))
178 "*List of topmost directories containing TclX help files") 193
179 194 (defcustom tcl-help-directory-list nil
180 (defvar tcl-use-smart-word-finder t 195 "*List of topmost directories containing TclX help files."
181 "*If not nil, use smart way to find current word, for Tcl help feature.") 196 :group 'tcl
182 197 :type '(list directory))
183 (defvar tcl-application "wish" 198
184 "*Name of Tcl application to run in inferior Tcl mode.") 199 (defcustom tcl-use-smart-word-finder t
185 200 "*If not nil, use smart way to find current word, for Tcl help feature."
186 (defvar tcl-command-switches nil 201 :group 'tcl
187 "*Switches to supply to `tcl-application'.") 202 :type 'boolean)
188 203
189 (defvar tcl-prompt-regexp "^\\(% \\|\\)" 204 (defcustom tcl-application "wish"
205 "*Name of Tcl program to run in inferior Tcl mode."
206 :group 'tcl
207 :type 'string)
208
209 (defcustom tcl-command-switches nil
210 "*List of switches to supply to the `tcl-application' program."
211 :group 'tcl
212 :type '(list string))
213
214 (defcustom tcl-prompt-regexp "^\\(% \\|\\)"
190 "*If not nil, a regexp that will match the prompt in the inferior process. 215 "*If not nil, a regexp that will match the prompt in the inferior process.
191 If nil, the prompt is the name of the application with \">\" appended. 216 If nil, the prompt is the name of the application with \">\" appended.
192 217
193 The default is \"^\\(% \\|\\)\", which will match the default primary 218 The default is \"^\\(% \\|\\)\", which will match the default primary
194 and secondary prompts for tclsh and wish.") 219 and secondary prompts for tclsh and wish."
195 220 :group 'tcl
196 (defvar inferior-tcl-source-command "source %s\n" 221 :type 'regexp)
222
223 (defcustom inferior-tcl-source-command "source %s\n"
197 "*Format-string for building a Tcl command to load a file. 224 "*Format-string for building a Tcl command to load a file.
198 This format string should use `%s' to substitute a file name 225 This format string should use `%s' to substitute a file name
199 and should result in a Tcl expression that will command the 226 and should result in a Tcl expression that will command the
200 inferior Tcl to load that file. The filename will be appropriately 227 inferior Tcl to load that file. The filename will be appropriately
201 quoted for Tcl.") 228 quoted for Tcl."
229 :group 'tcl
230 :type 'string)
202 231
203 ;; 232 ;;
204 ;; Keymaps, abbrevs, syntax tables. 233 ;; Keymaps, abbrevs, syntax tables.
205 ;; 234 ;;
206 235
522 551
523 ;; Here's another stab. I think this one actually works. Now the 552 ;; Here's another stab. I think this one actually works. Now the
524 ;; problem seems to be that there is a bug in Emacs 19.22 where 553 ;; problem seems to be that there is a bug in Emacs 19.22 where
525 ;; end-of-defun doesn't really use the brace matching the one that 554 ;; end-of-defun doesn't really use the brace matching the one that
526 ;; trails defun-prompt-regexp. 555 ;; trails defun-prompt-regexp.
556 ;; ?? Is there a bug now ??
527 (defconst tcl-omit-ws-regexp "^[^ \t\n#}][^\n}]+}*[ \t]+") 557 (defconst tcl-omit-ws-regexp "^[^ \t\n#}][^\n}]+}*[ \t]+")
528 558
529 (defun tcl-internal-beginning-of-defun (&optional arg) 559 (defun tcl-internal-beginning-of-defun (&optional arg)
530 "Move backward to next beginning of defun. 560 "Move backward to next beginning of defun.
531 With argument, do this that many times. 561 With argument, do this that many times.