Mercurial > emacs
comparison lisp/progmodes/tcl.el @ 25163:451b28d426e6
Many doc fixes.
(tcl-add-emacs-menu): Renamed from tcl-add-fsf-menu.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 03 Aug 1999 12:42:09 +0000 |
parents | e26249ed0833 |
children | 51eb4568f70b |
comparison
equal
deleted
inserted
replaced
25162:ec613559ec18 | 25163:451b28d426e6 |
---|---|
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.57 $ | 9 ;; Version: $Revision: 1.58 $ |
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 |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 ;; GNU General Public License for more details. | 21 ;; GNU General Public License for more details. |
22 | 22 |
23 ;; You should have received a copy of the GNU General Public License | 23 ;; You should have received a copy of the GNU General Public License |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
26 | 26 ;; Boston, MA 02111-1307, USA. |
27 ;; HOW TO INSTALL: | 27 |
28 ;; Put the following forms in your .emacs to enable autoloading of Tcl | 28 ;; BEFORE USE: |
29 ;; mode, and auto-recognition of ".tcl" files. | |
30 ;; | |
31 ;; (autoload 'tcl-mode "tcl" "Tcl mode." t) | |
32 ;; (autoload 'inferior-tcl "tcl" "Run inferior Tcl process." t) | |
33 ;; (setq auto-mode-alist (append '(("\\.tcl$" . tcl-mode)) auto-mode-alist)) | |
34 ;; | 29 ;; |
35 ;; If you plan to use the interface to the TclX help files, you must | 30 ;; If you plan to use the interface to the TclX help files, you must |
36 ;; set the variable tcl-help-directory-list to point to the topmost | 31 ;; set the variable tcl-help-directory-list to point to the topmost |
37 ;; directories containing the TclX help files. Eg: | 32 ;; directories containing the TclX help files. Eg: |
38 ;; | 33 ;; |
39 ;; (setq tcl-help-directory-list '("/usr/local/lib/tclx/help")) | 34 ;; (setq tcl-help-directory-list '("/usr/local/lib/tclx/help")) |
40 ;; | 35 ;; |
41 ;; Also you will want to add the following to your .emacs: | |
42 ;; | |
43 ;; (autoload 'tcl-help-on-word "tcl" "Help on Tcl commands" t) | |
44 ;; | |
45 ;; FYI a *very* useful thing to do is nroff all the Tk man pages and | |
46 ;; put them in a subdir of the help system. | |
47 ;; | |
48 | |
49 ;;; Commentary: | 36 ;;; Commentary: |
50 | |
51 ;; LCD Archive Entry: | |
52 ;; tcl|Tom Tromey|tromey@busco.lanl.gov| | |
53 ;; Major mode for editing Tcl| | |
54 ;; $Date: 1999/07/19 00:35:36 $|$Revision: 1.57 $|~/modes/tcl.el.Z| | |
55 | 37 |
56 ;; CUSTOMIZATION NOTES: | 38 ;; CUSTOMIZATION NOTES: |
57 ;; * tcl-proc-list can be used to customize a list of things that | 39 ;; * tcl-proc-list can be used to customize a list of things that |
58 ;; "define" other things. Eg in my project I put "defvar" in this | 40 ;; "define" other things. Eg in my project I put "defvar" in this |
59 ;; list. | 41 ;; list. |
60 ;; * tcl-typeword-list is similar, but uses font-lock-type-face. | 42 ;; * tcl-typeword-list is similar, but uses font-lock-type-face. |
61 ;; * 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 |
62 ;; 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. |
63 ;; * tcl-type-alist can be used to minimally customize indentation | 45 ;; * tcl-type-alist can be used to minimally customize indentation |
64 ;; according to context. | 46 ;; according to context. |
65 | |
66 ;; Change log: | |
67 ;; $Log: tcl.el,v $ | |
68 ;; Revision 1.57 1999/07/19 00:35:36 tromey | |
69 ;; (tcl-keyword-list): Added method, body, configbody, class | |
70 ;; | |
71 ;; Revision 1.56 1999/07/18 18:40:27 tromey | |
72 ;; (tcl-mode): Set font-lock-defaults, not font-lock-keywords. | |
73 ;; | |
74 ;; Revision 1.55 1999/07/18 05:21:33 tromey | |
75 ;; (tcl-proc-list): Reverted; already had `body'. | |
76 ;; | |
77 ;; Revision 1.54 1999/07/18 05:19:57 tromey | |
78 ;; (tcl-proc-list): Added `body'. | |
79 ;; | |
80 ;; Revision 1.53 1999/03/29 07:35:55 tromey | |
81 ;; (tcl-using-emacs-19-23): Recognize Emacs 20. | |
82 ;; | |
83 ;; Revision 1.52 1998/07/02 17:47:49 tromey | |
84 ;; Some itcl additions: | |
85 ;; (tcl-typeword-list): Added private, itk_option. | |
86 ;; (tcl-proc-list): Added body, configbody, class. | |
87 ;; | |
88 ;; Revision 1.51 1996/09/12 17:02:52 tromey | |
89 ;; (tcl-indent-command): Use insert-tab, not self-insert-command. | |
90 ;; | |
91 ;; Revision 1.50 1996/03/23 05:14:50 tromey | |
92 ;; (tcl-using-emacs-19): Work with XEmacs 20.0. From Ben Wing. | |
93 ;; | |
94 ;; Revision 1.49 1995/12/07 18:27:47 tromey | |
95 ;; (add-log-tcl-defun): Don't use tcl-beginning-of-defun; just go to end | |
96 ;; of line before searching. | |
97 ;; | |
98 ;; Revision 1.48 1995/12/07 18:18:21 tromey | |
99 ;; (add-log-tcl-defun): Now uses tcl-beginning-of-defun. | |
100 ;; | |
101 ;; Revision 1.47 1995/08/22 17:49:45 tromey | |
102 ;; (tcl-hilit): New function from "Chris Alfeld" <calfeld@math.utah.edu> | |
103 ;; (tcl-mode): Call it | |
104 ;; | |
105 ;; Revision 1.46 1995/08/07 16:02:01 tromey | |
106 ;; (tcl-do-auto-fill): Only fill past fill-column; for 19.29. | |
107 ;; (tcl-auto-fill-mode): Use force-mode-line-update. | |
108 ;; | |
109 ;; Revision 1.45 1995/07/23 23:51:25 tromey | |
110 ;; (tcl-word-no-props): New function. | |
111 ;; (tcl-figure-type): Use it. | |
112 ;; (tcl-current-word): Ditto. | |
113 ;; | |
114 ;; Revision 1.44 1995/07/23 20:26:47 tromey | |
115 ;; Doc fixes. | |
116 ;; | |
117 ;; Revision 1.43 1995/07/17 19:59:49 tromey | |
118 ;; (inferior-tcl-mode): Use modeline-process if it exists. | |
119 ;; | |
120 ;; Revision 1.42 1995/07/17 19:55:25 tromey | |
121 ;; XEmacs currently must use tcl-internal-end-of-defun | |
122 ;; | |
123 ;; Revision 1.41 1995/07/14 21:54:56 tromey | |
124 ;; Changes to make menus work in XEmacs. | |
125 ;; From Mike Scheidler <c23mts@kocrsv01.delcoelect.com> | |
126 ;; | |
127 ;; Revision 1.40 1995/07/11 03:13:15 tromey | |
128 ;; (tcl-mode): Customize for new dabbrev. | |
129 ;; | |
130 ;; Revision 1.39 1995/07/09 21:58:03 tromey | |
131 ;; (tcl-do-fill-paragraph): New function. | |
132 ;; (tcl-mode): Set up for paragraph filling. | |
133 ;; | |
134 ;; Revision 1.38 1995/07/09 21:30:32 tromey | |
135 ;; (tcl-mode): Fixes to 19.29 paragraph variables. | |
136 ;; | |
137 ;; Revision 1.37 1995/07/09 18:52:16 tromey | |
138 ;; (tcl-do-auto-fill): Set fill-prefix. | |
139 ;; | |
140 ;; Revision 1.36 1995/07/09 01:07:57 tromey | |
141 ;; (tcl-imenu-create-index-function): Work with imenu from Emacs 19.29 | |
142 ;; | |
143 ;; Revision 1.35 1995/06/27 20:12:00 tromey | |
144 ;; (tcl-type-alist): More itcl changes. | |
145 ;; | |
146 ;; Revision 1.34 1995/06/27 20:06:05 tromey | |
147 ;; More changes for itcl. | |
148 ;; Bug fixes for Emacs 19.29. | |
149 ;; | |
150 ;; Revision 1.33 1995/06/27 20:01:29 tromey | |
151 ;; (tcl-set-proc-regexp): Allow leading spaces. | |
152 ;; (tcl-proc-list): Changes for itcl. | |
153 ;; (tcl-typeword-list): Ditto. | |
154 ;; (tcl-keyword-list): Ditto. | |
155 ;; | |
156 ;; Revision 1.32 1995/05/11 22:12:49 tromey | |
157 ;; (tcl-type-alist): Include entry for "proc". | |
158 ;; | |
159 ;; Revision 1.31 1995/05/10 23:38:12 tromey | |
160 ;; (tcl-add-fsf-menu): Use make-lucid-menu-keymap, not | |
161 ;; "make-xemacs-menu-keymap". | |
162 ;; | |
163 ;; Revision 1.30 1995/05/10 18:22:21 tromey | |
164 ;; Bug fix in menu code for XEmacs. | |
165 ;; | |
166 ;; Revision 1.29 1995/05/09 21:36:53 tromey | |
167 ;; Changed "Lucid Emacs" to "XEmacs". | |
168 ;; Tcl's popup menu now added to existing one, courtesy | |
169 ;; dfarmer@evolving.com (Doug Farmer) | |
170 ;; | |
171 ;; Revision 1.28 1995/04/08 19:52:50 tromey | |
172 ;; (tcl-outline-level): New function | |
173 ;; (tcl-mode): Added outline-handling stuff. | |
174 ;; From Jesper Pedersen <blackie@imada.ou.dk> | |
175 ;; | |
176 ;; Revision 1.27 1994/10/11 02:01:27 tromey | |
177 ;; (tcl-mode): imenu-create-index-function made buffer local. | |
178 ;; | |
179 ;; Revision 1.26 1994/09/01 18:06:24 tromey | |
180 ;; Added filename completion in inferior tcl mode | |
181 ;; | |
182 ;; Revision 1.25 1994/08/22 15:56:24 tromey | |
183 ;; tcl-load-file default to current buffer. | |
184 ;; | |
185 ;; Revision 1.24 1994/08/21 20:33:05 tromey | |
186 ;; Fixed bug in tcl-guess-application. | |
187 ;; | |
188 ;; Revision 1.23 1994/08/21 03:54:45 tromey | |
189 ;; Keybindings don't overshadown comint bindings. | |
190 ;; | |
191 ;; Revision 1.22 1994/07/26 00:46:07 tromey | |
192 ;; Emacs 18 changes from Carl Witty. | |
193 ;; | |
194 ;; Revision 1.21 1994/07/14 22:49:21 tromey | |
195 ;; Added ";;;###autoload" comments where appropriate. | |
196 ;; | |
197 ; Revision 1.20 1994/06/05 16:57:22 tromey | |
198 ; tcl-current-word does the right thing in inferior-tcl-mode. | |
199 ; | |
200 ; Revision 1.19 1994/06/03 21:09:19 tromey | |
201 ; Another menu fix. | |
202 ; | |
203 ; Revision 1.18 1994/06/03 20:39:14 tromey | |
204 ; Fixed menu bug. | |
205 ; | |
206 ; Revision 1.17 1994/06/03 00:47:15 tromey | |
207 ; Fixed bug in bug-reporting code. | |
208 ; | |
209 ; Revision 1.16 1994/05/26 05:06:14 tromey | |
210 ; Menu items now sensitive as appropriate. | |
211 ; | |
212 ; Revision 1.15 1994/05/22 20:38:11 tromey | |
213 ; Added bug-report keybindings and menu entries. | |
214 ; | |
215 ; Revision 1.14 1994/05/22 20:18:28 tromey | |
216 ; Even more compile stuff. | |
217 ; | |
218 ; Revision 1.13 1994/05/22 20:17:15 tromey | |
219 ; Moved emacs version checking code to very beginning. | |
220 ; | |
221 ; Revision 1.12 1994/05/22 20:14:59 tromey | |
222 ; Compile fixes. | |
223 ; | |
224 ; Revision 1.11 1994/05/22 20:12:44 tromey | |
225 ; Fixed mark-defun for 19.23. | |
226 ; More menu fixes. | |
227 ; | |
228 ; Revision 1.10 1994/05/22 20:02:03 tromey | |
229 ; Fixed bug with M-;. | |
230 ; Wrote bug-reporting code. | |
231 ; | |
232 ; Revision 1.9 1994/05/22 05:26:51 tromey | |
233 ; Fixes for imenu. | |
234 ; | |
235 ; Revision 1.8 1994/05/22 03:38:07 tromey | |
236 ; Fixed menu support. | |
237 ; | |
238 ; Revision 1.7 1994/05/03 01:23:42 tromey | |
239 ; *** empty log message *** | |
240 ; | |
241 ; Revision 1.6 1994/04/23 16:23:36 tromey | |
242 ; Wrote tcl-indent-for-comment | |
243 ; | |
244 ;; | |
245 ;; 18-Mar-1994 Tom Tromey Fourth beta release. | |
246 ;; Added {un,}comment-region to menu. Idea from | |
247 ;; Mike Scheidler <c23mts@kocrsv01.delcoelect.com> | |
248 ;; 17-Mar-1994 Tom Tromey | |
249 ;; Fixed tcl-restart-with-file. Bug fix attempt in | |
250 ;; tcl-internal-end-of-defun. | |
251 ;; 16-Mar-1994 Tom Tromey Third beta release | |
252 ;; Added support code for menu (from Tcl mode written by | |
253 ;; schmid@fb3-s7.math.TU-Berlin.DE (Gregor Schmid)). | |
254 ;; 12-Mar-1994 Tom Tromey | |
255 ;; Better documentation for inferior-tcl-buffer. Wrote | |
256 ;; tcl-restart-with-file. Wrote Lucid Emacs menu (but no | |
257 ;; code to install it). | |
258 ;; 12-Mar-1994 Tom Tromey | |
259 ;; Wrote tcl-guess-application. Another stab at making | |
260 ;; tcl-omit-ws-regexp work. | |
261 ;; 10-Mar-1994 Tom Tromey Second beta release | |
262 ;; Last Modified: Thu Mar 10 01:24:25 1994 (Tom Tromey) | |
263 ;; Wrote perl-mode style line indentation command. | |
264 ;; Wrote more documentation. Added tcl-continued-indent-level. | |
265 ;; Integrated help code. | |
266 ;; 8-Mar-1994 Tom Tromey | |
267 ;; Last Modified: Tue Mar 8 11:58:44 1994 (Tom Tromey) | |
268 ;; Bug fixes. | |
269 ;; 6-Mar-1994 Tom Tromey | |
270 ;; Last Modified: Sun Mar 6 18:55:41 1994 (Tom Tromey) | |
271 ;; Updated auto-newline support. | |
272 ;; 6-Mar-1994 Tom Tromey Beta release | |
273 ;; Last Modified: Sat Mar 5 17:24:32 1994 (Tom Tromey) | |
274 ;; Wrote tcl-hashify-buffer. Other minor bug fixes. | |
275 ;; 5-Mar-1994 Tom Tromey | |
276 ;; Last Modified: Sat Mar 5 16:11:20 1994 (Tom Tromey) | |
277 ;; Wrote electric-hash code. | |
278 ;; 3-Mar-1994 Tom Tromey | |
279 ;; Last Modified: Thu Mar 3 02:53:40 1994 (Tom Tromey) | |
280 ;; Added code to handle auto-fill in comments. | |
281 ;; Added imenu support code. | |
282 ;; Cleaned up code. | |
283 ;; Better font-lock support. | |
284 ;; 28-Feb-1994 Tom Tromey | |
285 ;; Last Modified: Mon Feb 28 14:08:05 1994 (Tom Tromey) | |
286 ;; Made tcl-figure-type more easily configurable. | |
287 ;; 28-Feb-1994 Tom Tromey | |
288 ;; Last Modified: Mon Feb 28 01:02:58 1994 (Tom Tromey) | |
289 ;; Wrote inferior-tcl mode. | |
290 ;; 16-Feb-1994 Tom Tromey | |
291 ;; Last Modified: Wed Feb 16 17:05:19 1994 (Tom Tromey) | |
292 ;; Added support for font-lock-mode. | |
293 ;; 29-Oct-1993 Tom Tromey | |
294 ;; Last Modified: Sun Oct 24 17:39:14 1993 (Tom Tromey) | |
295 ;; Patches from Guido Bosch to make things work with Lucid Emacs. | |
296 ;; 22-Oct-1993 Tom Tromey | |
297 ;; Last Modified: Fri Oct 22 15:26:46 1993 (Tom Tromey) | |
298 ;; Made many characters have "_" syntax class; suggested by Guido | |
299 ;; Bosch <Guido.Bosch@loria.fr>. Note that this includes the "$" | |
300 ;; character, which might be a change you'd notice. | |
301 ;; 21-Oct-1993 Tom Tromey | |
302 ;; Last Modified: Thu Oct 21 20:28:40 1993 (Tom Tromey) | |
303 ;; More fixes for tcl-omit-ws-regexp. | |
304 ;; 20-Oct-1993 Tom Tromey | |
305 ;; Started keeping history. Fixed tcl-{beginning,end}-of-defun. | |
306 ;; Added some code to make things work with Emacs 18. | |
307 | 47 |
308 ;; THANKS TO: | 48 ;; THANKS TO: |
309 ;; Guido Bosch <Guido.Bosch@loria.fr> | 49 ;; Guido Bosch <Guido.Bosch@loria.fr> |
310 ;; pgs1002@esc.cam.ac.uk (Dr P.G. Sjoerdsma) | 50 ;; pgs1002@esc.cam.ac.uk (Dr P.G. Sjoerdsma) |
311 ;; Mike Scheidler <c23mts@kocrsv01.delcoelect.com> | 51 ;; Mike Scheidler <c23mts@kocrsv01.delcoelect.com> |
330 ;; to enclose offending hash characters in quotes or precede it with | 70 ;; to enclose offending hash characters in quotes or precede it with |
331 ;; a backslash. Note that using braces won't work -- quotes change | 71 ;; a backslash. Note that using braces won't work -- quotes change |
332 ;; the syntax class of characters between them, while braces do not. | 72 ;; the syntax class of characters between them, while braces do not. |
333 ;; The electric-# mode helps alleviate this problem somewhat. | 73 ;; The electric-# mode helps alleviate this problem somewhat. |
334 ;; * indent-tcl-exp is untested. | 74 ;; * indent-tcl-exp is untested. |
335 ;; * Doesn't work under Emacs 18 yet. | |
336 ;; * There's been a report that font-lock does strange things under | |
337 ;; Lucid Emacs 19.6. For instance in "proc foobar", the space | |
338 ;; before "foobar" is highlighted. | |
339 | 75 |
340 ;; TODO: | 76 ;; TODO: |
341 ;; * make add-log-tcl-defun smarter. should notice if we are in the | 77 ;; * make add-log-tcl-defun smarter. should notice if we are in the |
342 ;; middle of a defun, or between defuns. should notice if point is | 78 ;; middle of a defun, or between defuns. should notice if point is |
343 ;; on first line of defun (or maybe even in comments before defun). | 79 ;; on first line of defun (or maybe even in comments before defun). |
370 ;;; Code: | 106 ;;; Code: |
371 | 107 |
372 ;; I sure wish Emacs had a package that made it easy to extract this | 108 ;; I sure wish Emacs had a package that made it easy to extract this |
373 ;; sort of information. Strange definition works with XEmacs 20.0. | 109 ;; sort of information. Strange definition works with XEmacs 20.0. |
374 (defconst tcl-using-emacs-19 (not (string-match "18\\." emacs-version)) | 110 (defconst tcl-using-emacs-19 (not (string-match "18\\." emacs-version)) |
375 "Nil unless using Emacs 19 (XEmacs or FSF).") | 111 "Non-nil if using Emacs 19.") |
376 | 112 |
377 ;; FIXME this will break on Emacs 19.100. | |
378 (defconst tcl-using-emacs-19-23 | 113 (defconst tcl-using-emacs-19-23 |
379 (or (string-match "19\\.\\(2[3-9]\\|[3-9][0-9]\\)" emacs-version) | 114 (or (string-match "19\\.\\(2[3-9]\\|[3-9][0-9]\\)" emacs-version) |
380 (string-match "^20\\." emacs-version)) | 115 (string-match "^20\\." emacs-version)) |
381 "Nil unless using Emacs 19-23 or later.") | 116 "Non-nil if using Emacs 19-23 or later.") |
382 | 117 |
383 (defconst tcl-using-xemacs-19 (string-match "XEmacs" emacs-version) | 118 (defconst tcl-using-xemacs-19 (string-match "XEmacs" emacs-version) |
384 "Nil unless using XEmacs).") | 119 "Non-nil if using XEmacs.") |
385 | 120 |
386 (require 'comint) | 121 (require 'comint) |
387 | 122 |
388 ;; When compiling under GNU Emacs, load imenu during compilation. If | 123 ;; When compiling under Emacs, load imenu during compilation. If |
389 ;; you have 19.22 or earlier, comment this out, or get imenu. | 124 ;; you have 19.22 or earlier, comment this out, or get imenu. |
390 (and (fboundp 'eval-when-compile) | 125 (and (fboundp 'eval-when-compile) |
391 (eval-when-compile | 126 (eval-when-compile |
392 (if (and (string-match "19\\." emacs-version) | 127 (if (and (string-match "19\\." emacs-version) |
393 (not (string-match "XEmacs" emacs-version))) | 128 (not (string-match "XEmacs" emacs-version))) |
394 (require 'imenu)) | 129 (require 'imenu)) |
395 ())) | 130 ())) |
396 | 131 |
397 (defconst tcl-version "$Revision: 1.57 $") | 132 (defconst tcl-version "$Revision: 1.58 $") |
398 (defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>") | 133 (defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>") |
399 | 134 |
400 ;; | 135 ;; |
401 ;; User variables. | 136 ;; User variables. |
402 ;; | 137 ;; |
406 | 141 |
407 (defvar tcl-continued-indent-level 4 | 142 (defvar tcl-continued-indent-level 4 |
408 "*Indentation of continuation line relative to first line of command.") | 143 "*Indentation of continuation line relative to first line of command.") |
409 | 144 |
410 (defvar tcl-auto-newline nil | 145 (defvar tcl-auto-newline nil |
411 "*Non-nil means automatically newline before and after braces | 146 "*Non-nil means automatically newline before and after braces you insert.") |
412 inserted in Tcl code.") | |
413 | 147 |
414 (defvar tcl-tab-always-indent t | 148 (defvar tcl-tab-always-indent t |
415 "*Control effect of TAB key. | 149 "*Control effect of TAB key. |
416 If t (the default), always indent current line. | 150 If t (the default), always indent current line. |
417 If nil and point is not in the indentation area at the beginning of | 151 If nil and point is not in the indentation area at the beginning of |
425 4. Move forward to end of line, indenting if necessary. | 159 4. Move forward to end of line, indenting if necessary. |
426 5. Create an empty comment. | 160 5. Create an empty comment. |
427 6. Move backward to start of comment, indenting if necessary.") | 161 6. Move backward to start of comment, indenting if necessary.") |
428 | 162 |
429 (defvar tcl-use-hairy-comment-detector t | 163 (defvar tcl-use-hairy-comment-detector t |
430 "*If not `nil', the the more complicated, but slower, comment | 164 "*If not nil, use the more complicated, but slower, comment-delete method. |
431 detecting function is used. This variable is only used in GNU Emacs | 165 This variable is only used in Emacs 19; |
432 19 (the fast function is always used elsewhere).") | 166 the fast function is always used in other versions.") |
433 | 167 |
434 (defvar tcl-electric-hash-style 'smart | 168 (defvar tcl-electric-hash-style 'smart |
435 "*Style of electric hash insertion to use. | 169 "*Style of electric hash insertion to use. |
436 Possible values are 'backslash, meaning that `\\' quoting should be | 170 Possible values are `backslash', meaning that `\\' quoting should be |
437 done; 'quote, meaning that `\"' quoting should be done; 'smart, | 171 done; `quote', meaning that `\"' quoting should be done; `smart', |
438 meaning that the choice between 'backslash and 'quote should be | 172 meaning that the choice between `backslash' and `quote' should be |
439 made depending on the number of hashes inserted; or nil, meaning that | 173 made depending on the number of hashes inserted; or nil, meaning that |
440 no quoting should be done. Any other value for this variable is | 174 no quoting should be done. Any other value for this variable is |
441 taken to mean 'smart. The default is 'smart.") | 175 taken to mean `smart'. The default is `smart'.") |
442 | 176 |
443 (defvar tcl-help-directory-list nil | 177 (defvar tcl-help-directory-list nil |
444 "*List of topmost directories containing TclX help files") | 178 "*List of topmost directories containing TclX help files") |
445 | 179 |
446 (defvar tcl-use-smart-word-finder t | 180 (defvar tcl-use-smart-word-finder t |
447 "*If not nil, use a better way of finding the current word when | 181 "*If not nil, use smart way to find current word, for Tcl help feature.") |
448 looking up help on a Tcl command.") | |
449 | 182 |
450 (defvar tcl-application "wish" | 183 (defvar tcl-application "wish" |
451 "*Name of Tcl application to run in inferior Tcl mode.") | 184 "*Name of Tcl application to run in inferior Tcl mode.") |
452 | 185 |
453 (defvar tcl-command-switches nil | 186 (defvar tcl-command-switches nil |
531 "----" | 264 "----" |
532 ["Tcl help" tcl-help-on-word tcl-help-directory-list] | 265 ["Tcl help" tcl-help-on-word tcl-help-directory-list] |
533 ["Send bug report" tcl-submit-bug-report t]) | 266 ["Send bug report" tcl-submit-bug-report t]) |
534 "XEmacs menu for Tcl mode.") | 267 "XEmacs menu for Tcl mode.") |
535 | 268 |
536 ;; GNU Emacs does menus via keymaps. Do it in a function in case we | 269 ;; Emacs does menus via keymaps. Do it in a function in case we |
537 ;; later decide to add it to inferior Tcl mode as well. | 270 ;; later decide to add it to inferior Tcl mode as well. |
538 (defun tcl-add-fsf-menu (map) | 271 (defun tcl-add-emacs-menu (map) |
539 (define-key map [menu-bar] (make-sparse-keymap)) | 272 (define-key map [menu-bar] (make-sparse-keymap)) |
540 ;; This fails in Emacs 19.22 and earlier. | 273 ;; This fails in Emacs 19.22 and earlier. |
541 (require 'lmenu) | 274 (require 'lmenu) |
542 (let ((menu (make-lucid-menu-keymap "Tcl" tcl-xemacs-menu))) | 275 (let ((menu (make-lucid-menu-keymap "Tcl" tcl-xemacs-menu))) |
543 (define-key map [menu-bar tcl] (cons "Tcl" menu)) | 276 (define-key map [menu-bar tcl] (cons "Tcl" menu)) |
574 (define-key tcl-mode-map "\C-c\C-s" 'switch-to-tcl) | 307 (define-key tcl-mode-map "\C-c\C-s" 'switch-to-tcl) |
575 | 308 |
576 ;; Make menus. | 309 ;; Make menus. |
577 (if (and tcl-using-emacs-19 (not tcl-using-xemacs-19)) | 310 (if (and tcl-using-emacs-19 (not tcl-using-xemacs-19)) |
578 (progn | 311 (progn |
579 (tcl-add-fsf-menu tcl-mode-map)))) | 312 (tcl-add-emacs-menu tcl-mode-map)))) |
580 | 313 |
581 (defun tcl-fill-inferior-map () | 314 (defun tcl-fill-inferior-map () |
582 (define-key inferior-tcl-mode-map "\t" 'comint-dynamic-complete) | 315 (define-key inferior-tcl-mode-map "\t" 'comint-dynamic-complete) |
583 (define-key inferior-tcl-mode-map "\M-?" | 316 (define-key inferior-tcl-mode-map "\M-?" |
584 'comint-dynamic-list-filename-completions) | 317 'comint-dynamic-list-filename-completions) |
662 Tcl comments. (Useful when editing code not originally created | 395 Tcl comments. (Useful when editing code not originally created |
663 with this mode). | 396 with this mode). |
664 tcl-auto-fill-mode | 397 tcl-auto-fill-mode |
665 Auto-filling of Tcl comments. | 398 Auto-filling of Tcl comments. |
666 | 399 |
667 Emacs 19 users can add functions to the hook with `add-hook': | 400 Add functions to the hook with `add-hook': |
668 | 401 |
669 (add-hook 'tcl-mode-hook 'tcl-guess-application) | 402 (add-hook 'tcl-mode-hook 'tcl-guess-application) |
670 | 403 |
671 Emacs 18 users must use `setq': | 404 Emacs 18 users must use `setq' instead: |
672 | 405 |
673 (setq tcl-mode-hook (cons 'tcl-guess-application tcl-mode-hook))") | 406 (setq tcl-mode-hook (cons 'tcl-guess-application tcl-mode-hook))") |
674 | 407 |
675 | 408 |
676 (defvar inferior-tcl-mode-hook nil | 409 (defvar inferior-tcl-mode-hook nil |
677 "Hook for customizing Inferior Tcl mode.") | 410 "Hook for customizing Inferior Tcl mode.") |
678 | 411 |
679 (defvar tcl-proc-list | 412 (defvar tcl-proc-list |
680 '("proc" "method" "itcl_class" "body" "configbody" "class") | 413 '("proc" "method" "itcl_class" "body" "configbody" "class") |
681 "List of commands whose first argument defines something. | 414 "List of commands whose first argument defines something. |
682 This exists because some people (eg, me) use \"defvar\" et al. | 415 This exists because some people (eg, me) use `defvar' et al. |
683 Call `tcl-set-proc-regexp' and `tcl-set-font-lock-keywords' | 416 Call `tcl-set-proc-regexp' and `tcl-set-font-lock-keywords' |
684 after changing this list.") | 417 after changing this list.") |
685 | 418 |
686 (defvar tcl-proc-regexp nil | 419 (defvar tcl-proc-regexp nil |
687 "Regexp to use when matching proc headers.") | 420 "Regexp to use when matching proc headers.") |
759 | 492 |
760 ;; | 493 ;; |
761 ;; Work around differences between various versions of Emacs. | 494 ;; Work around differences between various versions of Emacs. |
762 ;; | 495 ;; |
763 | 496 |
764 ;; We use this because Lemacs 19.9 has what we need. | |
765 (defconst tcl-pps-has-arg-6 | 497 (defconst tcl-pps-has-arg-6 |
766 (or tcl-using-emacs-19 | 498 (or tcl-using-emacs-19 |
767 (and tcl-using-xemacs-19 | 499 (and tcl-using-xemacs-19 |
768 (condition-case nil | 500 (condition-case nil |
769 (progn | 501 (progn |
770 (parse-partial-sexp (point) (point) nil nil nil t) | 502 (parse-partial-sexp (point) (point) nil nil nil t) |
771 t) | 503 t) |
772 (error nil)))) | 504 (error nil)))) |
773 "t if using an emacs which supports sixth (\"commentstop\") argument | 505 "t if Emacs supports \"commentstop\" argument to `parse-partial-sexp'.") |
774 to parse-partial-sexp.") | |
775 | 506 |
776 ;; Its pretty bogus to have to do this, but there is no easier way to | 507 ;; Its pretty bogus to have to do this, but there is no easier way to |
777 ;; say "match not syntax-1 and not syntax-2". Too bad you can't put | 508 ;; say "match not syntax-1 and not syntax-2". Too bad you can't put |
778 ;; \s in [...]. This sickness is used in Emacs 19 to match a defun | 509 ;; \s in [...]. This sickness is used in Emacs 19 to match a defun |
779 ;; starter. (It is used for this in v18 as well). | 510 ;; starter. (It is used for this in v18 as well). |
794 ;; end-of-defun doesn't really use the brace matching the one that | 525 ;; end-of-defun doesn't really use the brace matching the one that |
795 ;; trails defun-prompt-regexp. | 526 ;; trails defun-prompt-regexp. |
796 (defconst tcl-omit-ws-regexp "^[^ \t\n#}][^\n}]+}*[ \t]+") | 527 (defconst tcl-omit-ws-regexp "^[^ \t\n#}][^\n}]+}*[ \t]+") |
797 | 528 |
798 (defun tcl-internal-beginning-of-defun (&optional arg) | 529 (defun tcl-internal-beginning-of-defun (&optional arg) |
799 "Move backward to next beginning-of-defun. | 530 "Move backward to next beginning of defun. |
800 With argument, do this that many times. | 531 With argument, do this that many times. |
801 Returns t unless search stops due to end of buffer." | 532 Returns t unless search stops due to end of buffer." |
802 (interactive "p") | 533 (interactive "p") |
803 (if (or (null arg) (= arg 0)) | 534 (if (or (null arg) (= arg 0)) |
804 (setq arg 1)) | 535 (setq arg 1)) |
834 (while (< (point) next-line) | 565 (while (< (point) next-line) |
835 (forward-sexp))) | 566 (forward-sexp))) |
836 (forward-line) | 567 (forward-line) |
837 (if (> (point) start) (setq arg (1- arg)))))) | 568 (if (> (point) start) (setq arg (1- arg)))))) |
838 | 569 |
839 ;; In Emacs 19, we can use begining-of-defun as long as we set up a | 570 ;; We can now use begining-of-defun as long as we set up a |
840 ;; certain regexp. In Emacs 18, we need our own function. | 571 ;; certain regexp. In Emacs 18, we need our own function. |
841 (fset 'tcl-beginning-of-defun | 572 (fset 'tcl-beginning-of-defun |
842 (if tcl-using-emacs-19 | 573 (if tcl-using-emacs-19 |
843 'beginning-of-defun | 574 'beginning-of-defun |
844 'tcl-internal-beginning-of-defun)) | 575 'tcl-internal-beginning-of-defun)) |
859 (push-mark (point) nil t) | 590 (push-mark (point) nil t) |
860 (push-mark (point))) | 591 (push-mark (point))) |
861 (tcl-beginning-of-defun) | 592 (tcl-beginning-of-defun) |
862 (backward-paragraph)) | 593 (backward-paragraph)) |
863 | 594 |
864 ;; In GNU Emacs 19-23 and later, mark-defun works as advertised. I | 595 ;; In Emacs 19.23 and later, mark-defun works as advertised. I |
865 ;; don't know about XEmacs, so for now it and Emacs 18 just lose. | 596 ;; don't know about XEmacs, so for now it and Emacs 18 just lose. |
866 (fset 'tcl-mark-defun | 597 (fset 'tcl-mark-defun |
867 (if tcl-using-emacs-19-23 | 598 (if tcl-using-emacs-19-23 |
868 'mark-defun | 599 'mark-defun |
869 'tcl-internal-mark-defun)) | 600 'tcl-internal-mark-defun)) |
870 | 601 |
871 ;; In GNU Emacs 19, mark takes an additional "force" argument. I | 602 ;; In Emacs 19, mark takes an additional "force" argument. I |
872 ;; don't know about XEmacs, so I'm just assuming it is the same. | 603 ;; don't know about XEmacs, so I'm just assuming it is the same. |
873 ;; Emacs 18 doesn't have this argument. | 604 ;; Emacs 18 doesn't have this argument. |
874 (defun tcl-mark () | 605 (defun tcl-mark () |
875 "Return mark, or nil if none." | 606 "Return mark, or nil if none." |
876 (if tcl-using-emacs-19 | 607 (if tcl-using-emacs-19 |
952 and semicolons inserted in Tcl code. | 683 and semicolons inserted in Tcl code. |
953 tcl-electric-hash-style | 684 tcl-electric-hash-style |
954 Controls action of `#' key. | 685 Controls action of `#' key. |
955 tcl-use-hairy-comment-detector | 686 tcl-use-hairy-comment-detector |
956 If t, use more complicated, but slower, comment detector. | 687 If t, use more complicated, but slower, comment detector. |
957 This variable is only used in GNU Emacs 19. | 688 This variable is only used in Emacs 19. |
958 tcl-use-smart-word-finder | 689 tcl-use-smart-word-finder |
959 If not nil, use a smarter, Tcl-specific way to find the current | 690 If not nil, use a smarter, Tcl-specific way to find the current |
960 word when looking up help on a Tcl command. | 691 word when looking up help on a Tcl command. |
961 | 692 |
962 Turning on Tcl mode calls the value of the variable `tcl-mode-hook' | 693 Turning on Tcl mode calls the value of the variable `tcl-mode-hook' |
977 (make-local-variable 'paragraph-start) | 708 (make-local-variable 'paragraph-start) |
978 (make-local-variable 'paragraph-separate) | 709 (make-local-variable 'paragraph-separate) |
979 (if (and tcl-using-emacs-19-23 | 710 (if (and tcl-using-emacs-19-23 |
980 (>= emacs-minor-version 29)) | 711 (>= emacs-minor-version 29)) |
981 (progn | 712 (progn |
982 ;; In Emacs 19.29, you aren't supposed to start these with a | 713 ;; In Emacs 19.29, you aren't supposed to start these with a ^. |
983 ;; ^. | |
984 (setq paragraph-start "$\\|") | 714 (setq paragraph-start "$\\|") |
985 (setq paragraph-separate paragraph-start)) | 715 (setq paragraph-separate paragraph-start)) |
986 (setq paragraph-start (concat "^$\\|" page-delimiter)) | 716 (setq paragraph-start (concat "^$\\|" page-delimiter)) |
987 (setq paragraph-separate paragraph-start)) | 717 (setq paragraph-separate paragraph-start)) |
988 (make-local-variable 'paragraph-ignore-fill-prefix) | 718 (make-local-variable 'paragraph-ignore-fill-prefix) |
1012 | 742 |
1013 (make-local-variable 'font-lock-defaults) | 743 (make-local-variable 'font-lock-defaults) |
1014 (setq font-lock-defaults | 744 (setq font-lock-defaults |
1015 '(tcl-font-lock-keywords)) | 745 '(tcl-font-lock-keywords)) |
1016 | 746 |
1017 ;; The following only really makes sense under GNU Emacs 19. | |
1018 (make-local-variable 'imenu-create-index-function) | 747 (make-local-variable 'imenu-create-index-function) |
1019 (setq imenu-create-index-function 'tcl-imenu-create-index-function) | 748 (setq imenu-create-index-function 'tcl-imenu-create-index-function) |
1020 (make-local-variable 'parse-sexp-ignore-comments) | 749 (make-local-variable 'parse-sexp-ignore-comments) |
1021 | 750 |
1022 ;; Settings for new dabbrev code. | 751 ;; Settings for new dabbrev code. |
1044 (make-local-variable 'add-log-current-defun-function) | 773 (make-local-variable 'add-log-current-defun-function) |
1045 (setq add-log-current-defun-function 'add-log-tcl-defun)) | 774 (setq add-log-current-defun-function 'add-log-tcl-defun)) |
1046 (setq parse-sexp-ignore-comments nil)) | 775 (setq parse-sexp-ignore-comments nil)) |
1047 | 776 |
1048 ;; Put Tcl menu into menubar for XEmacs. This happens | 777 ;; Put Tcl menu into menubar for XEmacs. This happens |
1049 ;; automatically for GNU Emacs. | 778 ;; automatically in Emacs. |
1050 (if (and tcl-using-xemacs-19 | 779 (if (and tcl-using-xemacs-19 |
1051 current-menubar | 780 current-menubar |
1052 (not (assoc "Tcl" current-menubar))) | 781 (not (assoc "Tcl" current-menubar))) |
1053 (progn | 782 (progn |
1054 (set-buffer-menubar (copy-sequence current-menubar)) | 783 (set-buffer-menubar (copy-sequence current-menubar)) |
1107 | 836 |
1108 | 837 |
1109 | 838 |
1110 (defun tcl-indent-command (&optional arg) | 839 (defun tcl-indent-command (&optional arg) |
1111 "Indent current line as Tcl code, or in some cases insert a tab character. | 840 "Indent current line as Tcl code, or in some cases insert a tab character. |
1112 If tcl-tab-always-indent is t (the default), always indent current line. | 841 If `tcl-tab-always-indent' is t (the default), always indent current line. |
1113 If tcl-tab-always-indent is nil and point is not in the indentation | 842 If `tcl-tab-always-indent' is nil and point is not in the indentation |
1114 area at the beginning of the line, a TAB is inserted. | 843 area at the beginning of the line, a TAB is inserted. |
1115 Other values of tcl-tab-always-indent cause the first possible action | 844 Other values of `tcl-tab-always-indent' cause the first possible action |
1116 from the following list to take place: | 845 from the following list to take place: |
1117 | 846 |
1118 1. Move from beginning of line to correct indentation. | 847 1. Move from beginning of line to correct indentation. |
1119 2. Delete an empty comment. | 848 2. Delete an empty comment. |
1120 3. Move forward to start of comment, indenting if necessary. | 849 3. Move forward to start of comment, indenting if necessary. |
1207 (goto-char (- (point-max) pos)))) | 936 (goto-char (- (point-max) pos)))) |
1208 shift-amt)) | 937 shift-amt)) |
1209 | 938 |
1210 (defun tcl-figure-type () | 939 (defun tcl-figure-type () |
1211 "Determine type of sexp at point. | 940 "Determine type of sexp at point. |
1212 This is either 'tcl-expr, 'tcl-commands, or nil. Puts point at start | 941 This is either `tcl-expr', `tcl-commands', or nil. Puts point at start |
1213 of sexp that indicates types. | 942 of sexp that indicates types. |
1214 | 943 |
1215 See documentation for variable `tcl-type-alist' for more information." | 944 See documentation for variable `tcl-type-alist' for more information." |
1216 (let ((count 0) | 945 (let ((count 0) |
1217 result | 946 result |
1584 (defun inferior-tcl-mode () | 1313 (defun inferior-tcl-mode () |
1585 "Major mode for interacting with Tcl interpreter. | 1314 "Major mode for interacting with Tcl interpreter. |
1586 | 1315 |
1587 A Tcl process can be started with M-x inferior-tcl. | 1316 A Tcl process can be started with M-x inferior-tcl. |
1588 | 1317 |
1589 Entry to this mode runs the hooks comint-mode-hook and | 1318 Entry to this mode runs the normal hooks `comint-mode-hook' and |
1590 inferior-tcl-mode-hook, in that order. | 1319 `inferior-tcl-mode-hook', in that order. |
1591 | 1320 |
1592 You can send text to the inferior Tcl process from other buffers | 1321 You can send text to the inferior Tcl process from other buffers |
1593 containing Tcl source. | 1322 containing Tcl source. |
1594 | 1323 |
1595 Variables controlling Inferior Tcl mode: | 1324 Variables controlling Inferior Tcl mode: |
1688 (defun tcl-hairy-scan-for-comment (state end always-stop) | 1417 (defun tcl-hairy-scan-for-comment (state end always-stop) |
1689 "Determine if point is in a comment. | 1418 "Determine if point is in a comment. |
1690 Returns a list of the form `(FLAG . STATE)'. STATE can be used | 1419 Returns a list of the form `(FLAG . STATE)'. STATE can be used |
1691 as input to future invocations. FLAG is nil if not in comment, | 1420 as input to future invocations. FLAG is nil if not in comment, |
1692 t otherwise. If in comment, leaves point at beginning of comment. | 1421 t otherwise. If in comment, leaves point at beginning of comment. |
1693 Only works in Emacs 19. See also `tcl-simple-scan-for-comment', a | 1422 |
1423 This function does not work in Emacs 18. | |
1424 See also `tcl-simple-scan-for-comment', a | |
1694 simpler version that is often right, and works in Emacs 18." | 1425 simpler version that is often right, and works in Emacs 18." |
1695 (let ((bol (save-excursion | 1426 (let ((bol (save-excursion |
1696 (goto-char end) | 1427 (goto-char end) |
1697 (beginning-of-line) | 1428 (beginning-of-line) |
1698 (point))) | 1429 (point))) |
1727 (and last-cstart | 1458 (and last-cstart |
1728 (goto-char last-cstart)) | 1459 (goto-char last-cstart)) |
1729 (cons real-comment state))) | 1460 (cons real-comment state))) |
1730 | 1461 |
1731 (defun tcl-hairy-in-comment () | 1462 (defun tcl-hairy-in-comment () |
1732 "Return t if point is in a comment, and leave point at beginning | 1463 "Return t if point is in a comment, and leave point at beginning of comment." |
1733 of comment." | |
1734 (let ((save (point))) | 1464 (let ((save (point))) |
1735 (tcl-beginning-of-defun) | 1465 (tcl-beginning-of-defun) |
1736 (car (tcl-hairy-scan-for-comment nil save nil)))) | 1466 (car (tcl-hairy-scan-for-comment nil save nil)))) |
1737 | 1467 |
1738 (defun tcl-simple-in-comment () | 1468 (defun tcl-simple-in-comment () |
1739 "Return t if point is in comment, and leave point at beginning | 1469 "Return t if point is in comment, and leave point at beginning of comment. |
1740 of comment. This is faster that `tcl-hairy-in-comment', but is | 1470 This is faster that `tcl-hairy-in-comment', but is correct less often." |
1741 correct less often." | |
1742 (let ((save (point)) | 1471 (let ((save (point)) |
1743 comment) | 1472 comment) |
1744 (beginning-of-line) | 1473 (beginning-of-line) |
1745 (while (and (< (point) save) (not comment)) | 1474 (while (and (< (point) save) (not comment)) |
1746 (search-forward "#" save 'move) | 1475 (search-forward "#" save 'move) |
1747 (setq comment (tcl-real-comment-p))) | 1476 (setq comment (tcl-real-comment-p))) |
1748 comment)) | 1477 comment)) |
1749 | 1478 |
1750 (defun tcl-in-comment () | 1479 (defun tcl-in-comment () |
1751 "Return t if point is in comment, and leave point at beginning | 1480 "Return t if point is in comment, and leave point at beginning of comment." |
1752 of comment." | |
1753 (if (and tcl-pps-has-arg-6 | 1481 (if (and tcl-pps-has-arg-6 |
1754 tcl-use-hairy-comment-detector) | 1482 tcl-use-hairy-comment-detector) |
1755 (tcl-hairy-in-comment) | 1483 (tcl-hairy-in-comment) |
1756 (tcl-simple-in-comment))) | 1484 (tcl-simple-in-comment))) |
1757 | 1485 |
1995 (process-name proc) | 1723 (process-name proc) |
1996 "inferior-tcl") | 1724 "inferior-tcl") |
1997 tcl-application file tcl-command-switches) | 1725 tcl-application file tcl-command-switches) |
1998 (if and-go (switch-to-tcl t))))))) | 1726 (if and-go (switch-to-tcl t))))))) |
1999 | 1727 |
2000 ;; FIXME I imagine you can do this under Emacs 18. I just don't know | |
2001 ;; how. | |
2002 (defun tcl-auto-fill-mode (&optional arg) | 1728 (defun tcl-auto-fill-mode (&optional arg) |
2003 "Like `auto-fill-mode', but controls filling of Tcl comments." | 1729 "Like `auto-fill-mode', but controls filling of Tcl comments." |
2004 (interactive "P") | 1730 (interactive "P") |
2005 (and (not tcl-using-emacs-19) | 1731 (and (not tcl-using-emacs-19) |
2006 (error "You must use Emacs 19 to get this feature.")) | 1732 (error "This feature is not supported in Emacs 18")) |
2007 ;; Following code taken from "auto-fill-mode" (simple.el). | 1733 ;; Following code taken from "auto-fill-mode" (simple.el). |
2008 (prog1 | 1734 (prog1 |
2009 (setq auto-fill-function | 1735 (setq auto-fill-function |
2010 (if (if (null arg) | 1736 (if (if (null arg) |
2011 (not auto-fill-function) | 1737 (not auto-fill-function) |
2094 (forward-char)))))) | 1820 (forward-char)))))) |
2095 | 1821 |
2096 (defun tcl-indent-for-comment () | 1822 (defun tcl-indent-for-comment () |
2097 "Indent this line's comment to comment column, or insert an empty comment. | 1823 "Indent this line's comment to comment column, or insert an empty comment. |
2098 Is smart about syntax of Tcl comments. | 1824 Is smart about syntax of Tcl comments. |
2099 Parts of this were taken from indent-for-comment (simple.el)." | 1825 Parts of this were taken from `indent-for-comment'." |
2100 (interactive "*") | 1826 (interactive "*") |
2101 (end-of-line) | 1827 (end-of-line) |
2102 (or (tcl-in-comment) | 1828 (or (tcl-in-comment) |
2103 (progn | 1829 (progn |
2104 ;; Not in a comment, so we have to insert one. Create an | 1830 ;; Not in a comment, so we have to insert one. Create an |
2167 | 1893 |
2168 ;; | 1894 ;; |
2169 ;; XEmacs menu support. | 1895 ;; XEmacs menu support. |
2170 ;; Taken from schmid@fb3-s7.math.TU-Berlin.DE (Gregor Schmid), | 1896 ;; Taken from schmid@fb3-s7.math.TU-Berlin.DE (Gregor Schmid), |
2171 ;; who wrote a different Tcl mode. | 1897 ;; who wrote a different Tcl mode. |
2172 ;; We also have support for menus in FSF. We do this by | 1898 ;; We also have support for menus in Emacs. We do this by |
2173 ;; loading the XEmacs menu emulation code. | 1899 ;; loading the XEmacs menu emulation code. |
2174 ;; | 1900 ;; |
2175 | 1901 |
2176 (defun tcl-popup-menu (e) | 1902 (defun tcl-popup-menu (e) |
2177 (interactive "@e") | 1903 (interactive "@e") |
2184 ;; * lmenu.el causes menubars to be turned on everywhere. | 1910 ;; * lmenu.el causes menubars to be turned on everywhere. |
2185 ;; Doubly bogus! | 1911 ;; Doubly bogus! |
2186 ;; Both of these problems are fixed in Emacs 19.23. People | 1912 ;; Both of these problems are fixed in Emacs 19.23. People |
2187 ;; using an Emacs before that just suffer. | 1913 ;; using an Emacs before that just suffer. |
2188 (require 'menubar "lmenu"))) ;; This is annoying | 1914 (require 'menubar "lmenu"))) ;; This is annoying |
2189 ;; IMHO popup-menu should be autoloaded in FSF Emacs. Oh well. | 1915 ;; IMHO popup-menu should be autoloaded. Oh well. |
2190 (popup-menu tcl-xemacs-menu)) | 1916 (popup-menu tcl-xemacs-menu)) |
2191 | 1917 |
2192 | 1918 |
2193 | 1919 |
2194 ;; | 1920 ;; |