/[emacs]/emacs/lisp/progmodes/tcl.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/tcl.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.81 by monnier, Sun Apr 3 21:20:03 2005 UTC revision 1.82 by gm, Tue Apr 5 13:01:58 2005 UTC
# Line 42  Line 42 
42  ;; * tcl-typeword-list is similar, but uses font-lock-type-face.  ;; * tcl-typeword-list is similar, but uses font-lock-type-face.
43  ;; * tcl-keyword-list is a list of keywords.  I've generally used this  ;; * tcl-keyword-list is a list of keywords.  I've generally used this
44  ;; for flow-control words.  Eg I add "unwind_protect" to this list.  ;; for flow-control words.  Eg I add "unwind_protect" to this list.
45    ;; * tcl-builtin-list lists commands to be given font-lock-builtin-face.
46  ;; * tcl-type-alist can be used to minimally customize indentation  ;; * tcl-type-alist can be used to minimally customize indentation
47  ;; according to context.  ;; according to context.
48    
# Line 193  inferior Tcl to load that file.  The fil Line 194  inferior Tcl to load that file.  The fil
194  quoted for Tcl."  quoted for Tcl."
195    :type 'string)    :type 'string)
196    
197    (defface tcl-escaped-newline '((t :inherit font-lock-string-face))
198      "Face used for (non-escaped) backslash at end of a line in Tcl mode."
199      :group 'tcl
200      :version "22.1")
201    
202  ;;  ;;
203  ;; Keymaps, abbrevs, syntax tables.  ;; Keymaps, abbrevs, syntax tables.
204  ;;  ;;
# Line 372  Call `tcl-set-font-lock-keywords' after Line 378  Call `tcl-set-font-lock-keywords' after
378  Default list includes some TclX keywords.  Default list includes some TclX keywords.
379  Call `tcl-set-font-lock-keywords' after changing this list.")  Call `tcl-set-font-lock-keywords' after changing this list.")
380    
381    (defvar tcl-builtin-list
382      '("after" "append" "array" "bgerror" "binary" "catch" "cd" "clock"
383        "close" "concat" "console" "dde" "encoding" "eof" "exec" "expr"
384        "fblocked" "fconfigure" "fcopy" "file" "fileevent" "flush"
385        "format" "gets" "glob" "history" "incr" "info" "interp" "join"
386        "lappend" "lindex" "linsert" "list" "llength" "load" "lrange"
387        "lreplace" "lsort" "namespace" "open" "package" "pid" "puts" "pwd"
388        "read" "regexp" "registry" "regsub" "rename" "scan" "seek" "set"
389        "socket" "source" "split" "string" "subst" "tell" "time" "trace"
390        "unknown" "unset" "vwait")
391      "List of Tcl commands.  Used only for highlighting.
392    Call `tcl-set-font-lock-keywords' after changing this list.
393    This list excludes those commands already found in `tcl-proc-list' and
394    `tcl-keyword-list'.")
395    
396  (defvar tcl-font-lock-keywords nil  (defvar tcl-font-lock-keywords nil
397    "Keywords to highlight for Tcl.  See variable `font-lock-keywords'.    "Keywords to highlight for Tcl.  See variable `font-lock-keywords'.
398  This variable is generally set from `tcl-proc-regexp',  This variable is generally set from `tcl-proc-regexp',
# Line 467  Uses variables `tcl-proc-regexp' and `tc Line 488  Uses variables `tcl-proc-regexp' and `tc
488                         "\\(\\s-\\|$\\)")                         "\\(\\s-\\|$\\)")
489                 2 'font-lock-type-face)                 2 'font-lock-type-face)
490    
491             (list (concat "\\_<" (regexp-opt tcl-builtin-list t) "\\_>")
492                   1 'font-lock-builtin-face)
493    
494             ;; When variable names are enclosed in {} braces, any
495             ;; character can be used. Otherwise just letters, digits,
496             ;; underscores.  Variable names can be prefixed with any
497             ;; number of "namespace::" qualifiers.  A leading "::" refers
498             ;; to the global namespace.
499             '("\\${\\([^}]+\\)}" 1 font-lock-variable-name-face)
500             '("\\$\\(\\(?:::\\)?\\(?:[[:alnum:]_]+::\\)*[[:alnum:]_]+\\)"
501               1 font-lock-variable-name-face)
502             '("\\(?:\\s-\\|^\\|\\[\\)set\\s-+{\\([^}]+\\)}"
503               1 font-lock-variable-name-face keep)
504             '("\\(?:\\s-\\|^\\|\\[\\)set\\s-+\\(\\(?:::\\)?\
505    \\(?:[[:alnum:]_]+::\\)*[[:alnum:]_]+\\)"
506               1 font-lock-variable-name-face keep)
507    
508             '("\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\\\)$" 3 'tcl-escaped-newline)
509    
510           ;; Keywords.  Only recognized if surrounded by whitespace.           ;; Keywords.  Only recognized if surrounded by whitespace.
511           ;; FIXME consider using "not word or symbol", not           ;; FIXME consider using "not word or symbol", not
512           ;; "whitespace".           ;; "whitespace".
513           (cons (concat "\\_<" (regexp-opt tcl-keyword-list t) "\\_>")           (cons (concat "\\_<" (regexp-opt tcl-keyword-list t) "\\_>")
514                 2))))                 1))))
515    
516  (if tcl-proc-regexp  (if tcl-proc-regexp
517      ()      ()
# Line 542  Commands: Line 582  Commands:
582    
583    (set (make-local-variable 'font-lock-defaults)    (set (make-local-variable 'font-lock-defaults)
584         '(tcl-font-lock-keywords nil nil nil beginning-of-defun         '(tcl-font-lock-keywords nil nil nil beginning-of-defun
585           (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)           (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)
586           (parse-sexp-lookup-properties . t)))           (parse-sexp-lookup-properties . t)))
587    
588    (set (make-local-variable 'imenu-generic-expression)    (set (make-local-variable 'imenu-generic-expression)
589         tcl-imenu-generic-expression)         tcl-imenu-generic-expression)

Legend:
Removed from v.1.81  
changed lines
  Added in v.1.82

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26