Mercurial > emacs
comparison lisp/progmodes/tcl.el @ 35712:350ba5553ea3
(outline, dabbrev, add-log): Require when
compiling.
(tcl-using-emacs-19-23): Consider Emacs 21+.
(tcl-help-directory-list, tcl-command-switches): Fix :type.
(tcl-add-emacs-menu): Supply menu name.
(tcl-beginning-of-defun, tcl-end-of-defun): Defalias, don't fset.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 29 Jan 2001 20:58:06 +0000 |
parents | da3eec3be04b |
children | b174db545cfd |
comparison
equal
deleted
inserted
replaced
35711:f17e8743925c | 35712:350ba5553ea3 |
---|---|
1 ;; tcl.el --- Tcl code editing commands for Emacs | 1 ;; tcl.el --- Tcl code editing commands for Emacs |
2 | 2 |
3 ;; Copyright (C) 1994, 1998, 1999, 2000 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. |
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.60 $ | 9 ;; Version: $Revision: 1.61 $ |
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 |
101 | 101 |
102 | 102 |
103 | 103 |
104 ;;; Code: | 104 ;;; Code: |
105 | 105 |
106 (eval-when-compile | |
107 (require 'outline) | |
108 (require 'dabbrev) | |
109 (require 'add-log)) | |
110 | |
106 ;; I sure wish Emacs had a package that made it easy to extract this | 111 ;; I sure wish Emacs had a package that made it easy to extract this |
107 ;; sort of information. Strange definition works with XEmacs 20.0. | 112 ;; sort of information. Strange definition works with XEmacs 20.0. |
108 (defconst tcl-using-emacs-19 (not (string-match "18\\." emacs-version)) | 113 (defconst tcl-using-emacs-19 (not (string-match "18\\." emacs-version)) |
109 "Non-nil if using Emacs 19.") | 114 "Non-nil if using Emacs 19 or later.") |
110 | 115 |
111 (defconst tcl-using-emacs-19-23 | 116 (defconst tcl-using-emacs-19-23 |
112 (or (string-match "19\\.\\(2[3-9]\\|[3-9][0-9]\\)" emacs-version) | 117 (or (string-match "19\\.\\(2[3-9]\\|[3-9][0-9]\\)" emacs-version) |
113 (string-match "^20\\." emacs-version)) | 118 (string-match "^[2-9][0-9]\\." emacs-version)) |
114 "Non-nil if using Emacs 19-23 or later.") | 119 "Non-nil if using Emacs 19-23 or later.") |
115 | 120 |
116 (defconst tcl-using-xemacs-19 (string-match "XEmacs" emacs-version) | 121 (defconst tcl-using-xemacs-19 (string-match "XEmacs" emacs-version) |
117 "Non-nil if using XEmacs.") | 122 "Non-nil if using XEmacs.") |
118 | 123 |
120 | 125 |
121 ;; When compiling under Emacs, load imenu during compilation. If | 126 ;; When compiling under Emacs, load imenu during compilation. If |
122 ;; you have 19.22 or earlier, comment this out, or get imenu. | 127 ;; you have 19.22 or earlier, comment this out, or get imenu. |
123 (and (fboundp 'eval-when-compile) | 128 (and (fboundp 'eval-when-compile) |
124 (eval-when-compile | 129 (eval-when-compile |
125 (if (and (string-match "19\\." emacs-version) | 130 (if (and (not (string< emacs-version "19.23")) |
126 (not (string-match "XEmacs" emacs-version))) | 131 (not (string-match "XEmacs" emacs-version))) |
127 (require 'imenu)) | 132 (require 'imenu)) |
128 ())) | 133 ())) |
129 | 134 |
130 (defconst tcl-version "$Revision: 1.60 $") | 135 (defconst tcl-version "$Revision: 1.61 $") |
131 (defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>") | 136 (defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>") |
132 | 137 |
133 ;; | 138 ;; |
134 ;; User variables. | 139 ;; User variables. |
135 ;; | 140 ;; |
192 :type '(choice (const backslash) (const quote) (const smart) (const nil))) | 197 :type '(choice (const backslash) (const quote) (const smart) (const nil))) |
193 | 198 |
194 (defcustom tcl-help-directory-list nil | 199 (defcustom tcl-help-directory-list nil |
195 "*List of topmost directories containing TclX help files." | 200 "*List of topmost directories containing TclX help files." |
196 :group 'tcl | 201 :group 'tcl |
197 :type '(list directory)) | 202 :type '(repeat directory)) |
198 | 203 |
199 (defcustom tcl-use-smart-word-finder t | 204 (defcustom tcl-use-smart-word-finder t |
200 "*If not nil, use smart way to find current word, for Tcl help feature." | 205 "*If not nil, use smart way to find current word, for Tcl help feature." |
201 :group 'tcl | 206 :group 'tcl |
202 :type 'boolean) | 207 :type 'boolean) |
207 :type 'string) | 212 :type 'string) |
208 | 213 |
209 (defcustom tcl-command-switches nil | 214 (defcustom tcl-command-switches nil |
210 "*List of switches to supply to the `tcl-application' program." | 215 "*List of switches to supply to the `tcl-application' program." |
211 :group 'tcl | 216 :group 'tcl |
212 :type '(list string)) | 217 :type '(repeat string)) |
213 | 218 |
214 (defcustom tcl-prompt-regexp "^\\(% \\|\\)" | 219 (defcustom tcl-prompt-regexp "^\\(% \\|\\)" |
215 "*If not nil, a regexp that will match the prompt in the inferior process. | 220 "*If not nil, a regexp that will match the prompt in the inferior process. |
216 If nil, the prompt is the name of the application with \">\" appended. | 221 If nil, the prompt is the name of the application with \">\" appended. |
217 | 222 |
296 "XEmacs menu for Tcl mode.") | 301 "XEmacs menu for Tcl mode.") |
297 | 302 |
298 ;; Emacs does menus via keymaps. Do it in a function in case we | 303 ;; Emacs does menus via keymaps. Do it in a function in case we |
299 ;; later decide to add it to inferior Tcl mode as well. | 304 ;; later decide to add it to inferior Tcl mode as well. |
300 (defun tcl-add-emacs-menu (map) | 305 (defun tcl-add-emacs-menu (map) |
301 (define-key map [menu-bar] (make-sparse-keymap)) | 306 (define-key map [menu-bar] (make-sparse-keymap "Tcl")) |
302 ;; This fails in Emacs 19.22 and earlier. | 307 ;; This fails in Emacs 19.22 and earlier. |
303 (require 'lmenu) | 308 (require 'lmenu) |
304 (let ((menu (make-lucid-menu-keymap "Tcl" tcl-xemacs-menu))) | 309 (let ((menu (make-lucid-menu-keymap "Tcl" tcl-xemacs-menu))) |
305 (define-key map [menu-bar tcl] (cons "Tcl" menu)) | 310 (define-key map [menu-bar tcl] (cons "Tcl" menu)) |
306 ;; The following is intended to compute the key sequence | 311 ;; The following is intended to compute the key sequence |
597 (forward-line) | 602 (forward-line) |
598 (if (> (point) start) (setq arg (1- arg)))))) | 603 (if (> (point) start) (setq arg (1- arg)))))) |
599 | 604 |
600 ;; We can now use begining-of-defun as long as we set up a | 605 ;; We can now use begining-of-defun as long as we set up a |
601 ;; certain regexp. In Emacs 18, we need our own function. | 606 ;; certain regexp. In Emacs 18, we need our own function. |
602 (fset 'tcl-beginning-of-defun | 607 (defalias 'tcl-beginning-of-defun |
603 (if tcl-using-emacs-19 | 608 (if tcl-using-emacs-19 |
604 'beginning-of-defun | 609 'beginning-of-defun |
605 'tcl-internal-beginning-of-defun)) | 610 'tcl-internal-beginning-of-defun)) |
606 | 611 |
607 ;; Ditto end-of-defun. | 612 ;; Ditto end-of-defun. |
608 (fset 'tcl-end-of-defun | 613 (defalias 'tcl-end-of-defun |
609 (if (and tcl-using-emacs-19 (not tcl-using-xemacs-19)) | 614 (if (and tcl-using-emacs-19 (not tcl-using-xemacs-19)) |
610 'end-of-defun | 615 'end-of-defun |
611 'tcl-internal-end-of-defun)) | 616 'tcl-internal-end-of-defun)) |
612 | 617 |
613 ;; Internal mark-defun that is used for losing Emacsen. | 618 ;; Internal mark-defun that is used for losing Emacsen. |
614 (defun tcl-internal-mark-defun () | 619 (defun tcl-internal-mark-defun () |
615 "Put mark at end of Tcl function, point at beginning." | 620 "Put mark at end of Tcl function, point at beginning." |
616 (interactive) | 621 (interactive) |