aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-10-27 18:46:16 +0100
committerLars Ingebrigtsen2020-10-27 18:46:16 +0100
commit045d2a50ddccbebba315aac55f60dfa270b36d7f (patch)
tree71f0c7d626446fd49ffde8e991f42f6d6d0ec19e
parent5cb9b8c24df39c019966d7335992cdd428dc560c (diff)
downloademacs-045d2a50ddccbebba315aac55f60dfa270b36d7f.tar.gz
emacs-045d2a50ddccbebba315aac55f60dfa270b36d7f.zip
Revert "Fontify strings in {} better in tcl-mode"
This reverts commit 7f32224dc324b0ee0f1b512c8d8b19aeb80141c1. The changes led to things like proc foo5 () { return 6 } being fontified as a string, which is wrong.
-rw-r--r--lisp/progmodes/tcl.el45
1 files changed, 20 insertions, 25 deletions
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 583f4e396e5..717008a0a22 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -386,36 +386,32 @@ Call `tcl-set-font-lock-keywords' after changing this list.")
386Default list includes some TclX keywords. 386Default list includes some TclX keywords.
387Call `tcl-set-font-lock-keywords' after changing this list.") 387Call `tcl-set-font-lock-keywords' after changing this list.")
388 388
389(defvar tcl-builtin-list
390 '("after" "append" "array" "bgerror" "binary" "catch" "cd" "clock"
391 "close" "concat" "console" "dde" "encoding" "eof" "exec" "expr"
392 "fblocked" "fconfigure" "fcopy" "file" "fileevent" "flush"
393 "format" "gets" "glob" "history" "incr" "info" "interp" "join"
394 "lappend" "lindex" "linsert" "list" "llength" "load" "lrange"
395 "lreplace" "lsort" "namespace" "open" "package" "pid" "puts" "pwd"
396 "read" "regexp" "registry" "regsub" "rename" "scan" "seek" "set"
397 "socket" "source" "split" "string" "subst" "tell" "time" "trace"
398 "unknown" "unset" "vwait")
399 "List of Tcl commands. Used only for highlighting.
400Call `tcl-set-font-lock-keywords' after changing this list.
401This list excludes those commands already found in `tcl-proc-list' and
402`tcl-keyword-list'.")
403
389(defvar tcl-font-lock-keywords nil 404(defvar tcl-font-lock-keywords nil
390 "Keywords to highlight for Tcl. See variable `font-lock-keywords'. 405 "Keywords to highlight for Tcl. See variable `font-lock-keywords'.
391This variable is generally set from `tcl-proc-regexp', 406This variable is generally set from `tcl-proc-regexp',
392`tcl-typeword-list', and `tcl-keyword-list' by the function 407`tcl-typeword-list', and `tcl-keyword-list' by the function
393`tcl-set-font-lock-keywords'.") 408`tcl-set-font-lock-keywords'.")
394 409
395(eval-and-compile 410(defconst tcl-syntax-propertize-function
396 (defvar tcl-builtin-list 411 (syntax-propertize-rules
397 '("after" "append" "array" "bgerror" "binary" "catch" "cd" "clock" 412 ;; Mark the few `#' that are not comment-markers.
398 "close" "concat" "console" "dde" "encoding" "eof" "exec" "expr" 413 ("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")))
399 "fblocked" "fconfigure" "fcopy" "file" "fileevent" "flush" 414 "Syntactic keywords for `tcl-mode'.")
400 "format" "gets" "glob" "history" "incr" "info" "interp" "join"
401 "lappend" "lindex" "linsert" "list" "llength" "load" "lrange"
402 "lreplace" "lsort" "namespace" "open" "package" "pid" "puts" "pwd"
403 "read" "regexp" "registry" "regsub" "rename" "scan" "seek" "set"
404 "socket" "source" "split" "string" "subst" "tell" "time" "trace"
405 "unknown" "unset" "vwait")
406 "List of Tcl commands. Used only for highlighting.
407Call `tcl-set-font-lock-keywords' after changing this list.
408This list excludes those commands already found in `tcl-proc-list' and
409`tcl-keyword-list'.")
410
411 (defconst tcl-syntax-propertize-function
412 (syntax-propertize-rules
413 ;; Mark the few `#' that are not comment-markers.
414 ("[^;[{ \t\n][ \t]*\\(#\\)" (1 "."))
415 ((concat "\\_<" (regexp-opt tcl-builtin-list t)
416 "\\_>" "\s*{\\([^}].*\\)}")
417 (2 "_")))
418 "Syntactic keywords for `tcl-mode'."))
419 415
420;; FIXME need some way to recognize variables because array refs look 416;; FIXME need some way to recognize variables because array refs look
421;; like 2 sexps. 417;; like 2 sexps.
@@ -510,7 +506,6 @@ Uses variables `tcl-proc-regexp' and `tcl-keyword-list'."
510 ;; number of "namespace::" qualifiers. A leading "::" refers 506 ;; number of "namespace::" qualifiers. A leading "::" refers
511 ;; to the global namespace. 507 ;; to the global namespace.
512 '("\\${\\([^}]+\\)}" 1 font-lock-variable-name-face) 508 '("\\${\\([^}]+\\)}" 1 font-lock-variable-name-face)
513 '("{\\([^}]+\\)}" 1 font-lock-string-face)
514 '("\\$\\(\\(?:::\\)?\\(?:[[:alnum:]_]+::\\)*[[:alnum:]_]+\\)" 509 '("\\$\\(\\(?:::\\)?\\(?:[[:alnum:]_]+::\\)*[[:alnum:]_]+\\)"
515 1 font-lock-variable-name-face) 510 1 font-lock-variable-name-face)
516 '("\\(?:\\s-\\|^\\|\\[\\)set\\s-+{\\([^}]+\\)}" 511 '("\\(?:\\s-\\|^\\|\\[\\)set\\s-+{\\([^}]+\\)}"