aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2005-04-05 13:06:25 +0000
committerGlenn Morris2005-04-05 13:06:25 +0000
commitd6d43bde05e983ae718a39b7d4d12c803f89777c (patch)
tree7fe706b678d83fc995047edae6775028447902cd /lisp
parent39b32c06bffe7327173a390e05cefd9a10d8059d (diff)
downloademacs-d6d43bde05e983ae718a39b7d4d12c803f89777c.tar.gz
emacs-d6d43bde05e983ae718a39b7d4d12c803f89777c.zip
(tcl-escaped-newline): New face.
(tcl-builtin-list): New variable. (tcl-set-font-lock-keywords): Add builtins, variables, and escaped newlines. Fix keywords subexpression number.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/tcl.el46
2 files changed, 48 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2533e7918bc..09f64afbe38 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12005-04-05 Glenn Morris <gmorris@ast.cam.ac.uk> 12005-04-05 Glenn Morris <gmorris@ast.cam.ac.uk>
2 2
3 * progmodes/sh-script.el (sh-builtins) <bash>: Add `caller'.
4 (sh-escaped-newline): New face.
5 (sh-font-lock-keywords) <shell>: Improve regexp for escaped
6 newline, and use sh-escaped-newline face.
7
3 * progmodes/tcl.el (tcl-escaped-newline): New face. 8 * progmodes/tcl.el (tcl-escaped-newline): New face.
4 (tcl-builtin-list): New variable. 9 (tcl-builtin-list): New variable.
5 (tcl-set-font-lock-keywords): Add builtins, variables, and escaped 10 (tcl-set-font-lock-keywords): Add builtins, variables, and escaped
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 24ae19b0ad4..95cfbb15196 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -42,6 +42,7 @@
42;; * tcl-typeword-list is similar, but uses font-lock-type-face. 42;; * 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 43;; * 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. 44;; 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.
45;; * tcl-type-alist can be used to minimally customize indentation 46;; * tcl-type-alist can be used to minimally customize indentation
46;; according to context. 47;; according to context.
47 48
@@ -193,6 +194,11 @@ inferior Tcl to load that file. The filename will be appropriately
193quoted for Tcl." 194quoted for Tcl."
194 :type 'string) 195 :type 'string)
195 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
196;; 202;;
197;; Keymaps, abbrevs, syntax tables. 203;; Keymaps, abbrevs, syntax tables.
198;; 204;;
@@ -372,6 +378,21 @@ Call `tcl-set-font-lock-keywords' after changing this list.")
372Default list includes some TclX keywords. 378Default list includes some TclX keywords.
373Call `tcl-set-font-lock-keywords' after changing this list.") 379Call `tcl-set-font-lock-keywords' after changing this list.")
374 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.
392Call `tcl-set-font-lock-keywords' after changing this list.
393This list excludes those commands already found in `tcl-proc-list' and
394`tcl-keyword-list'.")
395
375(defvar tcl-font-lock-keywords nil 396(defvar tcl-font-lock-keywords nil
376 "Keywords to highlight for Tcl. See variable `font-lock-keywords'. 397 "Keywords to highlight for Tcl. See variable `font-lock-keywords'.
377This variable is generally set from `tcl-proc-regexp', 398This variable is generally set from `tcl-proc-regexp',
@@ -467,11 +488,30 @@ Uses variables `tcl-proc-regexp' and `tcl-keyword-list'."
467 "\\(\\s-\\|$\\)") 488 "\\(\\s-\\|$\\)")
468 2 'font-lock-type-face) 489 2 'font-lock-type-face)
469 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
470 ;; Keywords. Only recognized if surrounded by whitespace. 510 ;; Keywords. Only recognized if surrounded by whitespace.
471 ;; FIXME consider using "not word or symbol", not 511 ;; FIXME consider using "not word or symbol", not
472 ;; "whitespace". 512 ;; "whitespace".
473 (cons (concat "\\_<" (regexp-opt tcl-keyword-list t) "\\_>") 513 (cons (concat "\\_<" (regexp-opt tcl-keyword-list t) "\\_>")
474 2)))) 514 1))))
475 515
476(if tcl-proc-regexp 516(if tcl-proc-regexp
477 () 517 ()
@@ -542,8 +582,8 @@ Commands:
542 582
543 (set (make-local-variable 'font-lock-defaults) 583 (set (make-local-variable 'font-lock-defaults)
544 '(tcl-font-lock-keywords nil nil nil beginning-of-defun 584 '(tcl-font-lock-keywords nil nil nil beginning-of-defun
545 (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords) 585 (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)
546 (parse-sexp-lookup-properties . t))) 586 (parse-sexp-lookup-properties . t)))
547 587
548 (set (make-local-variable 'imenu-generic-expression) 588 (set (make-local-variable 'imenu-generic-expression)
549 tcl-imenu-generic-expression) 589 tcl-imenu-generic-expression)