;;; tcl.el --- Tcl code editing commands for Emacs
-;; Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1998-2016 Free Software Foundation, Inc.
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
;; Author: Tom Tromey <tromey@redhat.com>
;; Chris Lindblad <cjl@lcs.mit.edu>
;; Keywords: languages tcl modes
(eval-when-compile
(require 'imenu)
- (require 'outline)
(require 'dabbrev)
(require 'add-log))
:group 'languages)
(defcustom tcl-indent-level 4
- "*Indentation of Tcl statements with respect to containing block."
+ "Indentation of Tcl statements with respect to containing block."
:type 'integer
:group 'tcl)
(put 'tcl-indent-level 'safe-local-variable 'integerp)
(defcustom tcl-continued-indent-level 4
- "*Indentation of continuation line relative to first line of command."
+ "Indentation of continuation line relative to first line of command."
:type 'integer
:group 'tcl)
(put 'tcl-continued-indent-level 'safe-local-variable 'integerp)
(defcustom tcl-auto-newline nil
- "*Non-nil means automatically newline before and after braces you insert."
+ "Non-nil means automatically newline before and after braces you insert."
:type 'boolean
:group 'tcl)
(defcustom tcl-tab-always-indent tab-always-indent
- "*Control effect of TAB key.
+ "Control effect of TAB key.
If t (the default), always indent current line.
If nil and point is not in the indentation area at the beginning of
the line, a TAB is inserted.
6. Move backward to start of comment, indenting if necessary."
:type '(choice (const :tag "Always" t)
(const :tag "Beginning only" nil)
- (const :tag "Maybe move or make or delete comment" 'tcl))
+ (other :tag "Maybe move or make or delete comment" tcl))
:group 'tcl)
(defcustom tcl-electric-hash-style nil ;; 'smart
- "*Style of electric hash insertion to use.
+ "Style of electric hash insertion to use.
Possible values are `backslash', meaning that `\\' quoting should be
done; `quote', meaning that `\"' quoting should be done; `smart',
meaning that the choice between `backslash' and `quote' should be
:group 'tcl)
(defcustom tcl-help-directory-list nil
- "*List of topmost directories containing TclX help files."
+ "List of topmost directories containing TclX help files."
:type '(repeat directory)
:group 'tcl)
(defcustom tcl-use-smart-word-finder t
- "*If not nil, use smart way to find current word, for Tcl help feature."
+ "If not nil, use smart way to find current word, for Tcl help feature."
:type 'boolean
:group 'tcl)
(defcustom tcl-application "wish"
- "*Name of Tcl program to run in inferior Tcl mode."
+ "Name of Tcl program to run in inferior Tcl mode."
:type 'string
:group 'tcl)
(defcustom tcl-command-switches nil
- "*List of switches to supply to the `tcl-application' program."
+ "List of switches to supply to the `tcl-application' program."
:type '(repeat string)
:group 'tcl)
(defcustom tcl-prompt-regexp "^\\(% \\|\\)"
- "*If not nil, a regexp that will match the prompt in the inferior process.
+ "If not nil, a regexp that will match the prompt in the inferior process.
If nil, the prompt is the name of the application with \">\" appended.
The default is \"^\\(% \\|\\)\", which will match the default primary
:group 'tcl)
(defcustom inferior-tcl-source-command "source %s\n"
- "*Format-string for building a Tcl command to load a file.
+ "Format-string for building a Tcl command to load a file.
This format string should use `%s' to substitute a file name
and should result in a Tcl expression that will command the
inferior Tcl to load that file. The filename will be appropriately
;; Maybe someone has a better set?
(let ((map (make-sparse-keymap)))
;; Will inherit from `comint-mode-map' thanks to define-derived-mode.
- (define-key map "\t" 'comint-dynamic-complete)
+ (define-key map "\t" 'completion-at-point)
(define-key map "\M-?" 'comint-dynamic-list-filename-completions)
(define-key map "\177" 'backward-delete-char-untabify)
(define-key map "\M-\C-x" 'tcl-eval-defun)
["Tcl help" tcl-help-on-word tcl-help-directory-list]))
(defvar inferior-tcl-buffer nil
- "*The current inferior-tcl process buffer.
+ "The current inferior-tcl process buffer.
MULTIPLE PROCESS SUPPORT
===========================================================================
Whenever \\[inferior-tcl] fires up a new process, it resets
`inferior-tcl-buffer' to be the new process's buffer. If you only run
one process, this does the right thing. If you run multiple
-processes, you can change `inferior-tcl-buffer' to another process
-buffer with \\[set-variable].")
+processes, you might need to set `inferior-tcl-buffer' to
+whichever process buffer you want to use.")
;;
;; Hooks and other customization.
`tcl-typeword-list', and `tcl-keyword-list' by the function
`tcl-set-font-lock-keywords'.")
-(defvar tcl-font-lock-syntactic-keywords
- ;; Mark the few `#' that are not comment-markers.
- '(("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")))
+(defconst tcl-syntax-propertize-function
+ (syntax-propertize-rules
+ ;; Mark the few `#' that are not comment-markers.
+ ("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")))
"Syntactic keywords for `tcl-mode'.")
;; FIXME need some way to recognize variables because array refs look
;; The mode itself.
;;
+(defvar outline-regexp)
+(defvar outline-level)
+
;;;###autoload
-(define-derived-mode tcl-mode nil "Tcl"
+(define-derived-mode tcl-mode prog-mode "Tcl"
"Major mode for editing Tcl code.
Expression and list commands understand all Tcl brackets.
Tab indents for Tcl code.
Turning on Tcl mode runs `tcl-mode-hook'. Read the documentation for
`tcl-mode-hook' to see what kinds of interesting hook functions
-already exist.
-
-Commands:
-\\{tcl-mode-map}"
+already exist."
(unless (and (boundp 'filladapt-mode) filladapt-mode)
(set (make-local-variable 'paragraph-ignore-fill-prefix) t))
(set (make-local-variable 'outline-level) 'tcl-outline-level)
(set (make-local-variable 'font-lock-defaults)
- '(tcl-font-lock-keywords nil nil nil beginning-of-defun
- (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)
- (parse-sexp-lookup-properties . t)))
+ '(tcl-font-lock-keywords nil nil nil beginning-of-defun))
+ (set (make-local-variable 'syntax-propertize-function)
+ tcl-syntax-propertize-function)
(set (make-local-variable 'imenu-generic-expression)
tcl-imenu-generic-expression)
\f
-(defun tcl-indent-command (&optional arg)
+(defun tcl-indent-command (&optional _arg)
"Indent current line as Tcl code, or in some cases insert a tab character.
If `tcl-tab-always-indent' is t (the default), always indent current line.
If `tcl-tab-always-indent' is nil and point is not in the indentation
expr-p)
(progn
;; Line is continuation line, or the sexp opener
- ;; is not a curly brace, or we are are looking at
+ ;; is not a curly brace, or we are looking at
;; an `expr' expression (which must be split
;; specially). So indentation is column of first
;; good spot after sexp opener (with some added
(with-current-buffer (process-buffer proc)
;; Delete prompt if requested.
(when (marker-buffer inferior-tcl-delete-prompt-marker)
- (delete-region (process-mark proc) inferior-tcl-delete-prompt-marker)
+ (let ((inhibit-read-only t))
+ (delete-region (process-mark proc) inferior-tcl-delete-prompt-marker))
(set-marker inferior-tcl-delete-prompt-marker nil))))
(comint-output-filter proc string))
(defun inferior-tcl-proc ()
"Return current inferior Tcl process.
See variable `inferior-tcl-buffer'."
- (let ((proc (get-buffer-process (if (eq major-mode 'inferior-tcl-mode)
+ (let ((proc (get-buffer-process (if (derived-mode-p 'inferior-tcl-mode)
(current-buffer)
inferior-tcl-buffer))))
(or proc
t otherwise. If in comment, leaves point at beginning of comment."
(let ((bol (save-excursion
(goto-char end)
- (beginning-of-line)
- (point)))
+ (line-beginning-position)))
real-comment
last-cstart)
(while (and (not last-cstart) (< (point) end))
If FLAG is nil, just uses `current-word'.
Otherwise scans backward for most likely Tcl command word."
(if (and flag
- (memq major-mode '(tcl-mode inferior-tcl-mode)))
+ (derived-mode-p 'tcl-mode 'inferior-tcl-mode))
(condition-case nil
(save-excursion
;; Look backward for first word actually in alist.
;; filename.
(car (comint-get-source "Load Tcl file: "
(or (and
- (eq major-mode 'tcl-mode)
+ (derived-mode-p 'tcl-mode)
(buffer-file-name))
tcl-previous-dir/file)
'(tcl-mode) t))
(list
(car (comint-get-source "Restart with Tcl file: "
(or (and
- (eq major-mode 'tcl-mode)
+ (derived-mode-p 'tcl-mode)
(buffer-file-name))
tcl-previous-dir/file)
'(tcl-mode) t))
current-prefix-arg))
- (let* ((buf (if (eq major-mode 'inferior-tcl-mode)
+ (let* ((buf (if (derived-mode-p 'inferior-tcl-mode)
(current-buffer)
inferior-tcl-buffer))
(proc (and buf (get-process buf))))
;; loading the XEmacs menu emulation code.
;;
-(defun tcl-popup-menu (e)
+(defun tcl-popup-menu (_e)
(interactive "@e")
(popup-menu tcl-mode-menu))
(provide 'tcl)
-;; arch-tag: 8a032554-c3ef-422e-b84c-acec0522179d
;;; tcl.el ends here