Advanced Search
Mail us
Home    Manuel    Links    Faq    Submit a tcl/tk Reference    Contact Us

    Some examples tcl/tk codes     Man of Bwidget     Man of blt     mkwidget screenshots     TkOgl     Video Demo real.

  Hilit 19 Tcl mode
 Aaron Roydhouse  wrote, and (Julian Anderson) posted, the following:

 `(("\s #.*$" nil comment)
   ("^#.*$" nil comment)
\)[^\"]*\)*"" 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)
for\|foreach\|return\|expr\|catch\)\b" nil keyword)))

Dwight Shih  later posted the following font lock mode:
(defvar tcl-font-lock-keywords
   (list (concat "\b\("
                 (mapconcat `identity
                            `("set" "lset" "list" "if" "case" "while"
                              "switch" "then" "else" "for" "foreach"
                              "return" "expr" "catch" "puts" "proc"
         1 `font-lock-keyword-face t)
   (list (concat "\b\("
                 (mapconcat `identity
                            `("global" "upvar" "uplevel" "error" "debug")
         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))))