Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.lang.tcl Frequently Asked Questions (Mar 05, 2005) (3/6)
Section - -I- Hilit 19 Tcl mode

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Restaurant inspections ]


Top Document: comp.lang.tcl Frequently Asked Questions (Mar 05, 2005) (3/6)
Previous Document: -H- Tcl/Tk Quick Reference Guides
Next Document: -J- HTML versions of Tcl man pages and FAQ.
See reader questions & answers on this topic! - Help others by sharing your knowledge
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))))


Donal K. Fellows <URL: mailto:fellowsd@cs.man.ac.uk > also has provided
<URL: http://www.cs.man.ac.uk/%7Efellowsd/tcl/tcl-font.el > which provides
better colorization of Tcl, recognizing Tcl comments more frequently.

See <URL: http://www.emacswiki.org/cgi-bin/wiki.pl?TclMode > for 
information regarding XEmacs's tcl.el and GNU EMACS 20.[47].1 .

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: comp.lang.tcl Frequently Asked Questions (Mar 05, 2005) (3/6)
Previous Document: -H- Tcl/Tk Quick Reference Guides
Next Document: -J- HTML versions of Tcl man pages and FAQ.

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
lvirden@yahoo.com (Larry W. Virden)





Last Update March 27 2014 @ 02:12 PM