# -I- Hilit 19 Tcl mode

    From: -XI- Where can I get these packages?

    AI. Aaron Roydhouse <URL:mailto:aaron@comp.vuw.ac.nz> wrote, and
    <URL:mailto:Julian.Anderson@comp.vuw.ac.nz> (Julian Anderson) posted,
    the following:

    (hilit-set-mode-patterns
     'tcl-mode
     '(("\\s #.*$" nil comment)
       ("^#.*$" nil comment)
       ("\"[^\\\"]*\\(\\\\\\(.\\|\n\\)[^\\\"]*\\)*\"" nil string)
       ("\\$[-_a-zA-Z]+" nil varref)
       ("^source.*$" nil include)
       ("\\b\\(global\\|upvar\\)\\b" nil decl)
       ("\\b\\(error\\|debug\\)\\b" nil decl)
       ("^\\s *proc\\s +\\(\\w\\|[_']\\)+" nil defun)
       ("\\b\\(set\\|lset\\|list\\|if\\|case\\|while\\|switch\\|then\\|else\\|
    for\\|foreach\\|return\\|expr\\|catch\\)\\b" nil keyword)))

    Dwight Shih <URL:mailto:dwight@crl.com> later posted the following font
    lock mode:

    (defvar tcl-font-lock-keywords
      (list
       (list (concat "\\b\\("
                     (mapconcat 'identity
                                '("set" "lset" "list" "if" "case" "while"
                                  "switch" "then" "else" "for" "foreach"
                                  "return" "expr" "catch" "puts" "proc"
                                  "trace")
                                "\\|")
                     "\\)\\b")
             1 'font-lock-keyword-face t)
       (list (concat "\\b\\("
                     (mapconcat 'identity
                                '("global" "upvar" "uplevel" "error" "debug")
                                "\\|")
                     "\\)\\b")
             1 'font-lock-type-face t)
       (list "^\\s *proc\\s +\\(\\(\\w\\|[_']\\)+\\)" 1 'font-lock-function-name-fac
    e t))
      "keywords for tcl-mode")

    (defun font-lock-set-defaults ()
      "Set `font-lock-keywords' to something appropriate for this mode."
      (setq font-lock-keywords
            (cond ((eq major-mode 'lisp-mode)       lisp-font-lock-keywords)
                  ((eq major-mode 'emacs-lisp-mode) lisp-font-lock-keywords)
                  ((eq major-mode 'c-mode)          c-font-lock-keywords)
                  ((eq major-mode 'c++-c-mode)      c-font-lock-keywords)
                  ((eq major-mode 'c++-mode)        c++-font-lock-keywords)
                  ((eq major-mode 'tex-mode)        tex-font-lock-keywords)
                  ((eq major-mode 'perl-mode)       perl-font-lock-keywords)
                  ((eq major-mode 'tcl-mode)        tcl-font-lock-keywords)
                  ((eq major-mode 'texinfo-mode)    texi-font-lock-keywords)
                  (t nil))))

Parent document is top of "comp.lang.tcl Frequently Asked Questions (August 31, 1995) (3/5)"
Previous document is "-H- Tk Quick Reference Card"
Next document is "-J- HTML versions of Tcl man pages and FAQ."