Function: tcl-mode

tcl-mode is an autoloaded, interactive and byte-compiled function defined in tcl.el.gz.

Signature

(tcl-mode)

Documentation

Major mode for editing Tcl code.

Expression and list commands understand all Tcl brackets. Tab indents for Tcl code. Paragraphs are separated by blank lines only. Delete converts tabs to spaces as it moves back.

Variables controlling indentation style:
  tcl-indent-level
    Indentation of Tcl statements within surrounding block.
  tcl-continued-indent-level
    Indentation of continuation line relative to first line of command.

Variables controlling user interaction with mode (see variable documentation for details):
  tcl-tab-always-indent
    Controls action of TAB key.
  tcl-auto-newline
    Non-nil means automatically newline before and after braces, brackets,
    and semicolons inserted in Tcl code.
  tcl-use-smart-word-finder
    If not nil, use a smarter, Tcl-specific way to find the current
    word when looking up help on a Tcl command.

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.

# tcl-electric-hash
; tcl-electric-char
C-M-q tcl-indent-exp
C-M-x tcl-eval-defun
C-c C-f tcl-load-file
C-c C-s switch-to-tcl
C-c C-t inferior-tcl
C-c C-v tcl-eval-defun
C-c C-x tcl-eval-region
C-c TAB tcl-help-on-word
DEL backward-delete-char-untabify
TAB tcl-indent-command
[ tcl-electric-char
] tcl-electric-char
{ tcl-electric-char
} tcl-electric-brace

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/tcl.el.gz
;;;###autoload
(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.
Paragraphs are separated by blank lines only.
Delete converts tabs to spaces as it moves back.

Variables controlling indentation style:
  `tcl-indent-level'
    Indentation of Tcl statements within surrounding block.
  `tcl-continued-indent-level'
    Indentation of continuation line relative to first line of command.

Variables controlling user interaction with mode (see variable
documentation for details):
  `tcl-tab-always-indent'
    Controls action of TAB key.
  `tcl-auto-newline'
    Non-nil means automatically newline before and after braces, brackets,
    and semicolons inserted in Tcl code.
  `tcl-use-smart-word-finder'
    If not nil, use a smarter, Tcl-specific way to find the current
    word when looking up help on a Tcl command.

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."
  (unless (and (boundp 'filladapt-mode) filladapt-mode)
    (setq-local paragraph-ignore-fill-prefix t))

  (setq-local indent-line-function #'tcl-indent-line)
  (setq-local comment-indent-function #'tcl-comment-indent)
  ;; Tcl doesn't require a final newline.
  ;; (setq-local require-final-newline t)

  (setq-local comment-start "# ")
  (setq-local comment-start-skip
              "\\(\\(^\\|[;{[]\\)\\s-*\\)#+ *")
  (setq-local comment-end "")

  (setq-local outline-regexp ".")
  (setq-local outline-level 'tcl-outline-level)

  (setq-local font-lock-defaults
              '(tcl-font-lock-keywords nil nil nil beginning-of-defun))
  (setq-local syntax-propertize-function
              tcl-syntax-propertize-function)
  (add-hook 'syntax-propertize-extend-region-functions
            #'syntax-propertize-multiline 'append 'local)

  (setq-local imenu-generic-expression tcl-imenu-generic-expression)

  ;; Settings for new dabbrev code.
  (setq-local dabbrev-case-fold-search nil)
  (setq-local dabbrev-case-replace nil)
  (setq-local dabbrev-abbrev-skip-leading-regexp "[$!]")
  (setq-local dabbrev-abbrev-char-regexp "\\sw\\|\\s_")

  (setq-local parse-sexp-ignore-comments t)
  (setq-local defun-prompt-regexp tcl-omit-ws-regexp)
  (setq-local add-log-current-defun-function
       #'tcl-add-log-defun)

  (setq-local end-of-defun-function #'tcl-end-of-defun-function))